Commit graph

402 commits

Author SHA1 Message Date
Daniel Norman
b8e7f81af6 Removes $(PRODUCT_OUT)/misc_info.txt on installclean.
misc_info.txt's build rule does not contain inputs to tell it to
refresh on an incremental build, so incremental builds (even after
installclean) were reusing this file.

With this change, misc_info.txt is removed by installclean so that an
incremental build generates the file fresh.

Test: # misc_info.txt exists; m installclean; # misc_info.txt gone
Bug: 155930200
Change-Id: Ia319925dad26f98049a988ee1ceb1e20db621353
2020-05-07 23:48:30 +00:00
Treehugger Robot
f39f6a4772 Merge changes I2e370952,I811cc8e1
* changes:
  Remove TEMPORARY_DISABLE_PATH_RESTRICTIONS
  nsjail: Always remount /tmp before src/out/dist
2020-05-04 22:11:18 +00:00
Dan Willemsen
347ba75679 Remove TEMPORARY_DISABLE_PATH_RESTRICTIONS
This was a temporary migration tool, and has been broken ever since the
ninja environment started being restricted. Remove it, since it has
lasted two releases.

Test: TEMPORARY_DISABLE_PATH_RESTRICTIONS=true m
Change-Id: I2e3709525598030f5c24d12fa966e531dfed33ae
2020-05-04 19:54:57 +00:00
Dan Willemsen
1612e2641e nsjail: Always remount /tmp before src/out/dist
A user was trying to use OUT_DIR=/tmp/...-out DIST_DIR=/tmp/...-dist

Test: OUT_DIR=/tmp/test-out DIST_DIR=/tmp/test-dist m nothing
Change-Id: I811cc8e1bda8d766406603df47309a8637cef48c
2020-05-01 16:26:56 -07:00
Dan Willemsen
6dfe30a5e2 Disallow OUT_DIR on the command line
By the time we do argument parsing, we've already written to $OUT_DIR or
the default, so don't allow overriding the output directory on the
command line.

Test: m OUT_DIR=newdir
Change-Id: I6f8c07cbef3a71d393b766dc5a01ae9c3df8631c
2020-05-01 02:23:31 +00:00
Ramy Medhat
1dcc27e47c Refactor RBE support for Javac/R8/D8 to use the remoteexec package.
Test: build with and without RBE_JAVAC/RBE_R8/RBE_D8 set.
Change-Id: I1607f8cfb4d2c3cbb3672152bbeb561d9968bc60
2020-04-28 11:37:20 -04:00
Dan Willemsen
c4c33e0e58 Merge "Stop dumping obsolete variables" 2020-04-21 22:35:36 +00:00
Treehugger Robot
9145d847e4 Merge "Turn on ninja phony outputs" 2020-04-21 22:30:24 +00:00
Treehugger Robot
a268d59e8b Merge "Report reverse dependencies for dangling rules." 2020-04-20 13:41:55 +00:00
Dan Willemsen
acafc67399 Add logging for stats on finished commands
Includes the exit code, real time, user time, system time, and maxrss.

Test: m nothing; check out/soong.log
Change-Id: I93dea9fc1c7fb892150e16e11cae09f2372f4429
2020-04-19 12:06:14 -07:00
Dan Willemsen
c615e29b3e Stop dumping obsolete variables
Test: m nothing
Change-Id: I4d7cce3a1d5f7f5f517d74e440059a69de36249d
2020-04-19 03:59:35 +00:00
Dan Willemsen
6587beddfa Turn on ninja phony outputs
This replaces the _kati_always_build_ hack with a ninja feature so that
ninja can actually understand what's happening. This means that we can
turn on some more options and checks around expected output filenames:

* Remove the output file(s) before the command executes
* Error if the output file(s) don't exist after the execution
* Error if the output is a directory

They're turned on immediately during the soong bootstrap runs, as those
run a limited number of rules. The main ninja execution does not remove
the output files, and prints warnings instead of errors for the others.
I'll turn them on as we understand how often those warnings are seen.

Test: m (check for new warnings)
Test: treehugger (check for new warnings)
Change-Id: I7f5c1a361dd1498eb54a2c07a918f3b0aa086e4c
2020-04-18 20:25:59 -07:00
Martin Stjernholm
946fb67272 Report reverse dependencies for dangling rules.
To help find what pulls them in.

Test: m checkbuild on a tree that exhibited the problem in
  https://android-build.googleplex.com/builds/pending/P13607612/aosp_crosshatch-userdebug/latest/view/logs/build_error.log

Change-Id: I59f3c98f21e5fb45dbd0aa814400f734d769a442
2020-04-17 16:00:43 +01:00
Ramy Medhat
383683559c Merge "Allow remote execution of link actions." 2020-04-17 13:59:26 +00:00
Ramy Medhat
9a90fe5e23 Allow remote execution of link actions.
This CL adds a remoteexec package that allows adding a configurable RBE
prefix to the template.

Test: built aosp crosshatch userdebug with and without RBE_CXX_LINKS.
Change-Id: Ica920c3d7f79f2996210b9cbd448126451c1707c
2020-04-16 21:18:10 -04:00
Diego Wilson
10e564a98e Dereference paths to be mounted into soong sandbox
Bind mounts require source paths without symbolic links.

Fixes: 153378837
Test: lunch aosp_cf_x86_phone-userdebug && make dist
Change-Id: I5c128f94233d81c52ec5692241b711b3e9d15a85
2020-04-15 20:29:06 +00:00
Diego Wilson
a5d9653cc5 Only mount dist dir to soong sandbox if it exists
The dist dir is created late in the build process. If a
soong sandbox attempts to mount it before it's created
the sandbox will create an empty file in its place.

Test: lunch aosp_cf_x86_phone-userdebug && make -j dist
Change-Id: Ie6513bf702de6e6322c78753d406d70ea3ccc04d
2020-04-06 22:07:56 +00:00
Diego Wilson
a22240bf22 Mount soong sandbox chroot as read-only
It's safer to disallow writing to the root filesystem of the sandbox.
Still allow write access to the source, tmp, out and dist directories.

Test: build aosp_cf_x86_64_phone-userdebug
Change-Id: Idf0d3a420669fbf6c3aba24e058f09a314ec6d0e
2020-04-02 18:11:28 +00:00
Dan Shi
984c129c84 Rename VTS to VTS10
Bug: 151896491
Test: m -j vts10
Change-Id: I7b70b13401678d70e4b46f9e7eb9d844bcfa315e
2020-03-28 16:42:17 -07:00
Treehugger Robot
8bf9eeb912 Merge "Cleanup vendor_boot artifacts in PRODUCT_OUT on installclean" 2020-03-20 17:23:17 +00:00
Ola Rozenfeld
3992e37599 Migrating RBE flags to RBE_ variables.
Test: N/A, this only adds new variables.

Change-Id: Iad09352090ec255af82e77941e6e050137f1e83b
2020-03-19 20:05:14 -04:00
Will McVicker
4cee625279 Cleanup vendor_boot artifacts in PRODUCT_OUT on installclean
This makes sure that we don't keep old vendor_boot artifacts around
after a clean.

Signed-off-by: Will McVicker <willmcvicker@google.com>
Fixes: 151957122
Bug: 151949371
Test: touch $OUT/vendor-ramdisk/test-file && make installclean
Change-Id: I357929583f234212a998dceaa31506fce42e0255
2020-03-19 19:58:03 +00:00
Elliott Hughes
cc868de8a7 Merge "Remove unused mips workarounds." 2020-03-16 21:06:13 +00:00
Dan Willemsen
6d3cad93e8 Always keep rsp files
It's painful to debug without these.

Test: do a build; find out -name '*.rsp'
Change-Id: I6fc25095442178c0bcbc1dea444ba51e9259c600
2020-03-12 10:30:47 -07:00
Dan Willemsen
a17ac9632d Improve error handling around username/hostname
If this couldn't read the current user, it would print a generic
message, then proceed to dereference the invalid user struct :(

Provide somewhat reasonable defaults, and better error messages instead.

Test: m nothing
Test: run docker with misconfigured user
Change-Id: I21af77c7d8d1d2d27cb04546667eb1094c62a7a1
2020-03-10 15:45:47 -07:00
Elliott Hughes
da3a071eaa Remove unused mips workarounds.
This was never really finished, and hasn't been supported for years.

Test: treehugger
Change-Id: I21d4c3112aa8cf0c56e59f0cc19ff8725ef714b9
2020-03-06 18:15:44 -08:00
Dan Willemsen
669f769470 Stop using the host python3
We've now got a prebuilt in prebuilts/build-tools

Test: treehugger
Change-Id: Ic0fb09c8970f3a1c9f3b7b0303168520dcbfc3d8
2020-03-06 10:28:04 -08:00
Dan Willemsen
1871d88e4f Simplify message around nsjail error
We have known problems (docker; distros w/o user namespaces) which mean that we won't be turning this into a fatal error anytime soon. Also remove the bug report link, it's not useful to continue getting the same reports.

Change-Id: I271871d68150417ac938f074d3730cad4518e327
Test: treehugger
2020-03-02 20:36:06 +00:00
Colin Cross
9403e4b704 Merge "Collect metrics from inside soong_build" 2020-02-28 23:23:29 +00:00
Colin Cross
b72c909899 Collect metrics from inside soong_build
Collect the number of modules and variants and some basic statistics
on memory usage inside soong_build by writing out a proto that is
read back in by soong_ui.

Test: examine soong.log
Change-Id: I6926876377a4f6229cf41fdbf166ae03c885ea55
2020-02-25 20:50:00 +00:00
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