Commit graph

413 commits

Author SHA1 Message Date
John Eckerdal
974b0e80c7 Add CCACHE_DIR to allowed environment variables
Trying to override the default directory for ccache by using the
CCACHE_DIR environment variable fails unless it is in the allowed
list.

Bug: 149670916
Test: manual
Change-Id: I8e7eea7a5c25d7ea5f0956fafc70d62522f3c4fc
2020-02-18 12:28:53 +01:00
Dan Willemsen
46459b08bb Remove empty directories when removing previously installed files
Apparently PackageManager gets confused when the apk disappears, but the
directory still exists.

Test: lunch aosp_arm-eng; m BasicDreams
      <remove BasicDreams from PRODUCT_PACKAGES>
      m nothing
      ls out/target/product/generic/system/app
Change-Id: I486c0ddadde55fad226049d3fb0f09af88117da0
2020-02-13 18:34:22 -08:00
Treehugger Robot
55f3001447 Merge "Add additional variables to ninja variable whitelist" 2020-01-28 20:40:31 +00:00
Kousik Kumar
0f095e1e65 Add additional variables to ninja variable whitelist
These variables control whether we accept cached-results / not and
whether we should update the cache with locally executed results or not.
I need accpet-cached whitelisted to purge the the RBE cache for the
invalid cache entry we have set for the failure we say yesterday.

Bug: b/148387048

Change-Id: I7344fc083f82e0b7bc11084376a267d19cf30bb8
2020-01-28 10:56:04 -08:00
Ramy Medhat
8ea054a81e Add support for experimentally enabling RBE support on specific rules.
This CL adds RBE support to javac, r8, and d8 rules which is only
enabled if respective environment variables are set.

Test: an aosp_crosshatch build with and without the new variables.
Change-Id: Ic82f3627944f6a5ee7b9f3228170c2709b1bfcb8
2020-01-28 12:42:47 -05:00
Treehugger Robot
6cc0515e82 Merge "Create a highmem pool and put metalava into it" 2020-01-25 01:09:43 +00:00
Colin Cross
8b8bec3b3a Create a highmem pool and put metalava into it
Create a highmem pool based on the total RAM and the number of CPUs,
with an override via the NINJA_HIGHMEM_NUM_JOBS variable.  Put
metalava into the highmem pool.

Ninja does not support nested pools, and when goma or RBE is enabled
the maximum ninja parallelism is set very high with local jobs in a
local pool.  When both the local pool and highmem pool are enabled,
the total number of local jobs will be as high as the sum of the sizes
of the two pools.  Keep the highmem pool limited to 1/16th of the
local pool when remote builds are enabled to try to minimize the
effect while still limiting highmem jobs.

Fixes: 142644983
Test: m nothing, examine pools
Test: m USE_GOMA=true nothing, examine pools
Change-Id: Id79f11f44948992960ac34ecf831dacbe21bd332
2020-01-24 11:44:23 -08:00
Treehugger Robot
5fdf5d4b3e Merge "Add total build time to metrics" 2020-01-17 22:39:11 +00:00
Colin Cross
74cda72f5e Add total build time to metrics
Determining the total build time from the existing metrics is
tricky because some of the metrics are overlapping.  For example,
the "soong" metric includes  "blueprint bootstrap",
"environment check", "minibp", "bpglob", "minibootstrap", and
"bootstrap".  Create a new singleton "total" metric that
covers the interesting parts of the build.

Test: m nothing
Change-Id: Iedcf5c9cf0d27252b694d35e6ff66ca1fcf734ac
2020-01-16 15:25:50 -08:00
Treehugger Robot
0b031cf181 Merge "Disallow system m4" 2020-01-15 19:38:22 +00:00
Elliott Hughes
5ce6dfbd36 Merge "Switch to toybox gzip." 2020-01-13 17:21:02 +00:00
Treehugger Robot
ae7cddd5ad Merge "Sandbox soong_build by changing to root directory" 2020-01-11 06:00:21 +00:00
Colin Cross
988414c2cf Sandbox soong_build by changing to root directory
This relands I12a0f907753fefd1997ab8b4ea2ac331234093cf along with
a fix to blueprint for absolute paths.

Store the current working directory and then change to the root
directory so that all file accesses must go through helpers in
the android package that properly track dependencies.

Change-Id: I24ac485677aa102eec1a2521d16820da6ee1ae77
Fixes: 146437378
Test: m checkbuild
Test: m OUT_DIR=/tmp/out nothing
2020-01-11 01:11:46 +00:00
Colin Cross
e734832d25 Merge "Revert "Sandbox soong_build by changing to root directory"" 2020-01-10 22:00:59 +00:00
Colin Cross
47e4f9e1e8 Revert "Sandbox soong_build by changing to root directory"
This reverts commit 05c25ccb4a.

Reason for revert: broke absolute OUT_DIR
Bug: 146437378

Change-Id: I523ed79d40e1c1ef040212ba794a7a084abea75d
2020-01-10 18:51:04 +00:00
Colin Cross
e35e961aa9 Merge "Sandbox soong_build by changing to root directory" 2020-01-10 17:35:22 +00:00
Colin Cross
05c25ccb4a Sandbox soong_build by changing to root directory
Store the current working directory and then change to the root
directory so that all file accesses must go through helpers in
the android package that properly track dependencies.

Fixes: 146437378
Test: m checkbuild
Change-Id: I12a0f907753fefd1997ab8b4ea2ac331234093cf
2020-01-09 14:19:46 -08:00
Kousik Kumar
ade12e744a Add FLAG_compare to whitelisted environment variables
Bug: b/147419757
Test: Ran a compare build and tested that compare mode works again

Change-Id: I743d5070673f3ec9d0c2b099019f88935f3894fc
2020-01-09 08:53:01 -08:00
Dan Willemsen
5cacfe1e24 Allow EMMA_INSTRUMENT_FRAMEWORK during ninja
This is used by the art apex test.

Bug: 147197813
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true art-check-debug-apex-gen
Change-Id: Id185cd35f16131f2c9a8afeba2e5b87834b0e620
2020-01-06 12:25:40 -08:00
Dan Willemsen
7da042912b Likely fix SANITIZE_HOST=address builds
We're passing in ASAN_OPTIONS=detect_leaks=0 on the command line, and
the build started failing after we limited the environment.

Test: forrest of aosp-master/aosp_x86_64-eng
Change-Id: I42c91897c7677e1a249412e5a8bc7bb1edb2f881
2020-01-04 13:58:54 -08:00
Dan Willemsen
2de4152e61 Merge "Limit environment during ninja" 2020-01-04 17:51:03 +00:00
Colin Cross
68534a29d6 Don't print critical path parallelism ratio if elapsed time is 0.
Test: m nothing, examine out/soong.log
Change-Id: Ib23902c703d306337b2a5150d6d63b1e3d0f95b3
2020-01-04 07:26:28 +00:00
Treehugger Robot
6e3b471d3d Merge "Remove files that should no longer be installed" 2020-01-04 05:16:24 +00:00
Dan Willemsen
1e775d7619 Remove files that should no longer be installed
Make now exports (partial) lists of what should be installed. Those
lists are incomplete, but if something is removed from the list, we can
remove it from the filesystem so that incremental builds work better.

Test: built-in tests (m blueprint_tools)
Test: remove a module from PRODUCT_PACKAGES, see the print and file removed
Test: change the name of a cts test, see the old one removed from cts
Change-Id: I6bc14c6a5af63383ea265e97ed8b875fa51af0ed
2020-01-03 16:46:15 -08:00
Dan Willemsen
260db53da3 Limit environment during ninja
See the change that added ALLOW_NINJA_ENV for more information.

Test: m nothing; check out/soong.log for small list
Test: ALLOW_NINJA_ENV=true m nothing; check out/soong.log
Change-Id: I7761c6a07a7f8b0acee107e9c27c7739dd4b63ab
2020-01-03 15:36:33 -08:00
Dan Willemsen
e333635983 Add option to limit environment variables given to ninja
Ninja does not track changes in environment variables, so we get
potentially incorrect builds when environment variables change during
incremental builds if some action was using one of them.

Add a variable to limit exposure of these variables to ninja, and thus,
all actions run by ninja. Kati and Soong can still read environment
variables, they explicitly track which ones they read so that we can
re-run them appropriately.

This list is just the beginning, there's no good way to detect which
environment variables are currently being used and to pass them through.
So this initial change won't have a behavioral change, and we'll flip
the switch and see what fails or who complains, flipping it off and on
and adding to the list until we can make this always happen.

Also adds a board-specific `BUILD_BROKEN_NINJA_USES_ENV_VARS := ...`
list so that we can temporarily allow board-specific variables until
they're fixed.

Test: check out/soong.log
Test: ALLOW_NINJA_ENV=false m nothing; check out/soong.log
Test: set BUILD_BROKEN_NINJA_USES_ENV_VARS := OLDPWD
      ALLOW_NINJA_ENV=false m nothing; check out/soong.log
Change-Id: I08e4834ce12100a577ef7d6a9a21b9e9d345cb93
2020-01-03 15:36:29 -08:00
Dan Willemsen
2bb82d0011 Add TotalRAM detection
Colin originally wrote this for the highmem pool:

https://android-review.googlesource.com/c/platform/build/soong/+/1168271

But while that's a larger change, this is useful to just be in the logs,
and for use in multiproduct_kati to better limit the number of
concurrent jobs.

Test: check soong.log on linux and mac
Change-Id: I0518d303a220d775f8d78dba9f660b2954e68e3e
2019-12-27 09:43:49 -08:00
Elliott Hughes
686dd0c3a4 Switch to toybox gzip.
(Although I was the one who added the gzcat reference, I don't believe
we actually use it. And neither my Debian host nor toybox has gzcat --
as opposed to zcat -- anyway. So just quietly drop that.)

Test: treehugger
Change-Id: I95d94dab1daf72faedfa170770e8ebfaa37b70c6
2019-12-20 12:01:45 -08:00
Elliott Hughes
936a18d8da Merge "Switch to toybox realpath." 2019-12-20 00:27:10 +00:00
Elliott Hughes
c5aedc4c49 Switch to toybox realpath.
Change-Id: I9f1d3df08d860e5bfa131a531e274c75b72148e7
2019-12-17 22:03:45 -08:00
Treehugger Robot
0f41daf682 Merge "Switch the mac back to toybox xargs." 2019-12-15 16:35:05 +00:00
Dan Willemsen
7842826f49 Remove obsolete copy headers
When LOCAL_COPY_HEADER lines are removed, we just removed the copy rule,
we didn't actually remove the old header, so C/C++ files could still
include the old headers during incremental builds.

While we do consider LOCAL_COPY_HEADERS as near-obsolet, and it'll
disappear as we move everything over to Soong, this could produce some
unfortunate incremental build results while people are attempting to
remove them.

Fix this by ensuring that only the files currently listed in
LOCAL_COPY_HEADERS exist in TARGET_OUT_HEADERS after we run Kati.

Test: Remove a LOCAL_COPY_HEADERS entry; see the header removed
Change-Id: I817305703a6996d50490d552623d7df019b608c9
2019-12-13 19:38:23 -08:00
Elliott Hughes
d329254328 Switch the mac back to toybox xargs.
Test: make sdk
Change-Id: I29a6b0404e248553ecfdfdeb263aa9cd0d2fdb3e
2019-12-12 16:52:06 -08:00
Elliott Hughes
e2d33d52e1 Switch to our hermetic bc.
Test: treehugger
Change-Id: I12142a7f54190edd21e719bbd8f5df831ada6161
2019-12-10 10:12:18 -08:00
Colin Cross
d0be2109cf Add CUJ tests
Add a cuj_tests binary that runs through a sequence of critical
user journey builds and collects metrics.

Bug: 145688720
Test: cuj_tests
Change-Id: I6bb1a3fc4a458fd8cea7b7c924f565d0cf3e6df3
2019-12-05 11:11:37 -08:00
Treehugger Robot
dc0e8fd131 Merge changes Id261b5a3,Ice6f34d0
* changes:
  Fix errorProtoLog error messages
  Write BUILD_DATETIME_FILE after SetupOutDir
2019-12-05 09:10:13 +00:00
Colin Cross
ff27ce4cc0 Fix errorProtoLog error messages
Use Printf instead of Println for formatted strings, and pass
the filename instead of the proto.

Test: cuj_tests
Change-Id: Id261b5a34304a0caa61faa1f3bbc388aacdd25a6
2019-11-26 16:21:58 -08:00
Colin Cross
28f527c3da Write BUILD_DATETIME_FILE after SetupOutDir
Delay writing the BUILD_DATETIME_FILE until after the out directory
has been created.

Test: cuj_tests
Change-Id: Ice6f34d003f93c26b5d2d0b64f92b11efe16c2d4
2019-11-26 16:21:58 -08:00
Dan Shi
53f1a190ff Clean vts-core in host/out to ensure old package to be removed.
Bug: None
Test: m installclean
Change-Id: I5aa451d87dc377e62dcf1b88baa58539fa661feb
2019-11-26 10:02:53 -08:00
Dan Willemsen
1c504d9c7e Remove BASH_ENV from the build environment
This runs an arbitrary shell script for all non-interactive bash sessions, and we've got lots of those.

It was causing problems with Fedora 30, which triggers the `manpath` executable, which isn't available in our $PATH:
https://groups.google.com/d/msg/android-building/WqEyZQuxYtY/zDXl9irOCAAJ

Change-Id: If2f63bbbcc3accb8d239f93fa06823d301d69488
2019-11-18 19:13:56 +00:00
Elliott Hughes
7e4452511c Merge "Switch to our own zipinfo(1)." 2019-11-16 00:31:45 +00:00
Elliott Hughes
3efacee1fd Switch to our own zipinfo(1).
Test: treehugger
Change-Id: If71e87e45a52959be9a316810fe79250771eb9d4
2019-11-14 20:09:24 -08:00
Colin Cross
9016b91290 Set default pool when RBE or goma is enabled
Pass --default_pool=local_pool to kati when RBE or goma is enabled
to put most rules into the local_pool.  Specific rules that support
RBE or goma will set .KATI_NINJA_POOL := none to remove themselves
from the local_pool.  Passing --default_pool will also disable the
hack in kati that sets the pool based on the presence of the string
"/gomacc" in the command line.

Fixes: 143938974
Test: inspect pools in build-${TARGET-PRODUCT}.ninja for m USE_RBE=true
Test: inspect pools in build-${TARGET-PRODUCT}.ninja for m USE_GOMA=true
Change-Id: I839b2488383fcd63fffd613e25b0b9abcb72b567
2019-11-11 16:08:42 -08:00
Pete Gillin
a7a3d64a36 Remove the EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN option.
Previously, this setting environment variable to false reverted to an
OpenJDK 9 toolchain. This change removes that option.

Test: m core-all-system-modules
Test: zcat out/verbose.log.gz | grep 'prebuilts/jdk/jdk[0-9]*'
Test: EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN=false m core-all-system-modules (fails)
Bug: 131683177
Change-Id: I0d679648e1236925ce3ef7e1652379127e846b00
2019-11-11 11:03:58 +00:00
Pete Gillin
abbcddaaf4 Switch to an OpenJDK 11 toolchain by default.
Prior to this change, the default was to use and OpenJDK 9 toolchain,
with the EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN=true environment
variable available to opt into OpenJDK 11. After this change, the
default is to use OpenJDK 11, with
EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN=false available to opt out.

This change affects:
 - The version of javac used.
 - The version of javadoc used.
 - The version of other tools used during the build process (e.g. jar,
   jmod, and jlink).
 - For Java bytecode executed on the host, the version of the java
   executable used, and so the versions of the JVM and the OpenJDK
   libraries in the system module (or bootclasspath).

This change does not affect:
 - The Java language level, i.e. the version of Java expected in
   source code (the -source option to javac) or the version of Java
   bytecode produced (the -target option to javac).
 - Anything to do with code execution on the device.

Bug: 131683177
Test: make java droid docs cts tests
Test: zcat out/verbose.log.gz | grep 'prebuilts/jdk/jdk[0-9]*'
Test: make RunBluetoothRoboTests RunCarSettingsLibRoboTests
Test: cts-tradefed help
Test: atest CtsHostTzDataTests
Test: atest CtsLibcoreTestCases
Change-Id: I09dc22f1af4d1f2d7d3b85c08cb0ed9a1105aaca
Merged-In: Iaae89ef25c92ec099575c026fc50e41da4e143e8
2019-11-05 11:33:58 +00:00
Colin Cross
8cc19911b1 smart_status: move channel write outside lock to avoid deadlock
The smartStatusOutput.done channel is read from a goroutine that
locks smartStatusOutput.lock.  If the goroutine that writes to
smartStatusOutput.done is holding smartStatusOutput.lock it can
lead to an AB-BA deadlock.  Call stopActionTableTick from outside
the lock.

Fixes: 143558785
Test: none
Change-Id: I93a10ef9ff16c3953a1c5ccb102b024158358fe4
2019-10-29 15:27:32 -07:00
Elliott Hughes
e23c63de21 Merge "Switch to toybox find for darwin and linux." 2019-10-23 14:52:28 +00:00
Inseob Kim
822fdcab1f Add BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW
A new sysprop neverallow rules are mandatory only for devices launching
with R or later. For devices already launched, neverallow rules can be
relaxed with adding following line to BoardConfig.mk:

BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW := true

Bug: 131162102
Test: Set PRODUCT_SHIPPING_API_LEVEL := 30 and try building with
changing some system_public_prop to system_internal_prop
Test: m cts sepolicy_tests

Change-Id: I5e1640f7b43fd47863bc7bd163c2f43b01fa3326
Merged-In: I5e1640f7b43fd47863bc7bd163c2f43b01fa3326
(cherry picked from commit e36f52754f)
2019-10-15 09:22:42 +09:00
Elliott Hughes
e04b73f100 Merge "Go back to the native mac xargs for now." 2019-10-10 21:18:59 +00:00
Elliott Hughes
27cc0a8f32 Go back to the native mac xargs for now.
Should unbreak the mac build while I work on toybox xargs some more.

Test: suck it and see (since there's no mac presubmit)
Change-Id: I48954f801fc980a1174f93e474d73a24ad12ce66
2019-10-09 18:12:33 -07:00