Commit graph

947 commits

Author SHA1 Message Date
Chris Parsons
e4f148999b Remove build failure with USE_BAZEL_ANALYSIS usage
This verification was present to ensure that users previously using
USE_BAZEL_ANALYSIS=1 realized the change in usage. But this is now dead
code; USE_BAZEL_ANALYSIS=1 will be a complete no-op after this CL.

Test: USE_BAZEL_ANALYSIS=1 m nothing  (and verified this behaves as m
nothing)

Change-Id: I08f75a562c2fb3ce262646fb187f19f3d5857e40
2022-09-13 16:19:54 -04:00
Usta (Tsering) Shrestha
9ba17e8702 Merge "Drop bootstrap.ninja.d" 2022-09-07 22:47:41 +00:00
Chris Parsons
1bb58da17c Remove USE_BAZEL_ANALYSIS
Use --bazel-mode-dev instead.

Test: Treehugger
Bug: 244309479
Change-Id: I570d02651eea92375cd96efbeb8d986a9495e1ed
2022-09-07 14:58:03 -04:00
Treehugger Robot
2701ecd502 Merge "Remove USE_BAZEL and its dead code" 2022-09-01 17:32:00 +00:00
Chris Parsons
19ab9a455f Remove USE_BAZEL and its dead code
This environment variable has been out of use for some time. It used to
control Bazel-as-executor, which has been removed from Bazel for several
releases.

Bug: 243077098
Test: Treehugger
Change-Id: I4edfb5f3574c369a16547ea06ba780293c37ecb3
2022-09-01 11:33:02 -04:00
Usta (Tsering) Shrestha
f768231db1 Merge "cosmetic changes" 2022-08-30 20:13:15 +00:00
usta
5bb4a5db9a Drop bootstrap.ninja.d
This also shaves off a couple seconds from the build.

Test: `time m nothing` 2 times with and without the change
Bug: 243699430
Change-Id: I5cc5cba2b98c845ddd6ba7c3b31ad678451afe41
2022-08-29 22:23:10 +00:00
usta
fb67fd121f cosmetic changes
Test: m nothing
Bug: N/A
Change-Id: Ic3d70339c7b98bf0733dc0e946f3683fe94f5c5b
2022-08-29 19:53:45 +00:00
Chris Parsons
ef615e5841 Add --bazel-mode and --bazel-mode-dev
This allows "bazel mixed builds prod mode", in additional to reworking
the mechanism in which mixed builds dev mode is enabled.

As a followup, CI scripts will be migrated to use the new flags, as
USE_BAZEL_ANALYSIS=1 is deprecated.

Test: Manually ran --bazel-mode with an allowlist verifying that the
module alone was enabled
Test: Manually verified --bazel-mode and --bazel-mode-dev cause a build
failure

Change-Id: If0d34360e60452f428b05828f4ec7596b7cb619a
2022-08-29 10:56:04 -04:00
Jihoon Kang
9f4f8a3cc7 Copy soong variables to dist
Per aosp/2183398, out/soong/soong.variables provide some useful information for debugging purpose.
This change enables copying out/soong/soong.variables to out/dist/soong_ui/soong/soong.variables in dist mode, similar to build.ninja.gz in the same directory.
Test confirmed that the content of the out/soong/soong.variables is
equal to that of out/dist/soong_ui/soong/soong.variables.

Test: m dist $target &&
	diff out/soong/soong.variables out/dist/soong_ui/soong/soong.variables
Change-Id: I1bfa53a8e116c49fda2cc9a7252f4da0c59ce5b5
2022-08-23 21:37:48 +00:00
Jihoon Kang
f171dac47e Merge "Remove unnecessary lunch output" 2022-08-22 21:44:25 +00:00
Usta Shrestha
8dc8b0a065 SOONG_NINJA_ARGS to pass ninja args to soong_ui
Cf soong_build, allow soong_ui to support additional
ninja arguments

Test: NINJA_ARGS='-d explain' nothing
Bug: N/A
Change-Id: I42827fb817bed432251e9b0b94b15a4f6f78cb03
2022-08-19 20:41:56 +00:00
Jihoon Kang
3690485a16 Remove unnecessary lunch output
Currently, running lunch writes multiple lines including less
informative ones.
This change removes unnecessary variables and enables the user to focus
on more useful information when running the lunch command.

Bug: 204196816
Test: m
Change-Id: Ifbbe01abf03a1701158881febe5982489f96dc65
2022-08-17 21:16:44 +00:00
Colin Cross
d079e0b270 Reformat build/soong for go 1.19
Test: none
Change-Id: I132368f0fcbdb5ea088b5b84dbe4ccfdd9e94cad
2022-08-17 10:43:13 -07:00
Treehugger Robot
c2cb917659 Merge "Move bp2build progress proto to soong." 2022-08-15 16:43:35 +00:00
Liz Kammer
15088e45a9 Move bp2build progress proto to soong.
This allows us to reuse existing infra to export to internal.

Test: b build //build/bazel/scripts/bp2build-progress:bp2build-progress
Change-Id: If4888f8f59d56ddf4e98bdb8456ca69ff7f78a49
2022-08-12 16:38:38 -04:00
Usta Shrestha
675564daa8 Cosmetic: More helpful error message
Test: various invocations of ./build/soong/soong_ui.bash
Bug: N/A
Change-Id: I7be5b84330bc7525b5633314a111e5e1fa9fc844
2022-08-12 13:43:48 -04:00
Usta Shrestha
9b3724ad74 bootstrap glob file list in one place
Test: m nothing
Bug: N/A
Change-Id: I2aa4132726b1491db767ccbe695bd98cda08ff50
2022-08-09 18:07:36 -04:00
Usta Shrestha
db46a9bbb8 Cosmetic Changes plus log errors
Test: N/A
Bug: N/A
Change-Id: I39e622a93270c922bdbea27ca79632a606431a2c
2022-08-02 20:24:57 +00:00
Yi-Yo Chiang
da44795563 Remove $PRODUCT_OUT/vendor_kernel_ramdisk on installclean
Make sure the staging directory doesn't have stale file after
installclean.

Test: m installclean && ls $ANDROID_PRODUCT_OUT
Change-Id: Idcd7a883a6cba4b7eb1eb99751f5d03cba365a12
2022-07-21 03:52:02 +00:00
Sasha Smundak
2cec8df3a8 Revert "Suppress all progress messages from Ninja if ANDROID_QUIET_BUILD is set."
Reverts commit 827aead340
The change being reverted is the result of misunderstanding of how the
status system works. It has to be reverted because it would suppress
_all_ error messages from Make. Achieving what this change purports is
is more involved and requires changing the code to separate progress message
stream from application output stream.

Test: run failing build with ANDROID_QUIET_BUILD=tree and observe errors being output
Change-Id: If9148a7fa773ae32fb0870a448e9470560e53900
2022-07-19 08:02:42 -07:00
David Srbecky
2285cfff3d Export default RBE_platform
Export it so that we have one source of truth,
which can be used by the called tools.

Test: Use the exported value in ART build.
Change-Id: Iaa45b1780ffae11e09790e193ca2bd01e2b732a8
2022-07-12 22:59:06 +01:00
Kousik Kumar
c75e1297a3 Run expconfigfetcher only when user has proper auth
It is useless to run this binary when gcert creds aren't available, so
adding a check for gcert creds before calling this binary. Also modified
metrics to capture missing gcert.

Bug: b/237938234
Change-Id: I94b5aa2d53c4e5bb1a5fdc913a33ef5bae965d32
2022-07-07 02:20:51 +00:00
Kousik Kumar
7bc781949a Add a broad warning about missing LOAS creds
This is to generally warn Google devs about lack of LOAS creds.

Given the switch to RBE, lack of LOAS creds will start resulting in build
failures, so adding a warning message ahead of time to all builds. Will
convert this to a build failure after a week.
We need LOAS creds to be able to even fetch the CDPush config file to
determine whether to use RBE in a build a not, which is why I'm making
this a broad error message across builds.

Test: ran "m nothing" build with / without gcert and with / without
"stubby" in $PATH and confirmed appropriate error message.
Bug: b/235985591

Change-Id: I15cbaf372b0a7b79f868a06c7d5ede19b49ae687
2022-06-29 17:48:52 +00:00
Kousik Kumar
595fb1c87b Change experiments config fetch log to be a verbose log
This log is not super useful to be honest, so avoid printing it to
stdout of the build.

Bug: b/236709761
Change-Id: Ic96130a285160b386df3afc269dd5ef97c7965bf
2022-06-24 16:49:55 +00:00
Dan Willemsen
e2cdecf7ba Strip ANSI codes for messages on simple terminals
We had been doing this for actions, but not messages.

Test: m nothing && TERM=dumb m nothing
Bug: 235414673
Change-Id: I5c6c009490abe1d02a4ae2272bd1831bd7ca9f7f
2022-06-09 03:40:14 +00:00
Kousik Kumar
4c180ad7de Cleanup RBE logs directory
RBE logs directory is currently messy:
1. We use RBE_output_dir variable to specify where rbe_metrics.txt /
   rbe_metrics.pb file should go to.
2. We use proxy_log_dir to specify where *.rpl / *.rpi (detailed per
   action info log file) should go to.
3. We use RBE_log_dir to specify where reproxy.* / bootstrap.* log files
   should go to.

Ideally, all RBE related logs should go to one single directory. In this
CL, I'm creating a temporary log directory under out/soong/.temp/rbe/
where all RBE related log files per build would go to. The log dir
prefix is also being set to the same prefix as the socket address file.

Test: Ran a sample build with `m libc` and ensured that logs are getting
cleared across rebuilds and that `rbe_metrics.pb` file is properly
generated and being copied to the right location (i.e., from
out/soong/.temp/rbe/<rand> to out/ dir)

Bug: b/233382420
Change-Id: I46bd38d50419cb9e54e8202d24222979e47ff5ca
2022-06-08 11:50:33 -04:00
Treehugger Robot
7d5cdb69ed Merge "Revert "Add a warning message about missing gcert at the end of the build"" 2022-06-08 04:45:23 +00:00
Colin Cross
d2ee3a6afa Merge "Remove references to *_HOST_DALVIK_*" 2022-05-12 15:44:20 +00:00
MarkDacek
5b08fe1e9e Add Go proto for metrics. The current output is different from head.
Test: N/A

Change-Id: I3230bcec0136e4859118edee2e5e36ff502b2d0e
2022-05-11 21:55:53 +00:00
Lukacs T. Berki
2388f64e76 Add comments for path_interposer.
Test: Presubmits.
Change-Id: I22c08f282019050da1198cce1f92f5d825ee649f
2022-05-06 12:42:05 +02:00
Kousik Kumar
2c8115521a Revert "Add a warning message about missing gcert at the end of the build"
This reverts commit b018b83664.

Reason for revert: Builds will start failing now since the gcert change is about to go in.

Change-Id: I81d36ce6bf4f7a9bc120b34d411f2cb4ec64e5eb
2022-05-04 20:06:00 +00:00
Lukács T. Berki
28ba9c472f Merge "Add a test for correctness of C++ compilation." 2022-05-04 12:06:38 +00:00
Lukacs T. Berki
e3487c8848 Add a test for correctness of C++ compilation.
This required the following:

- Adding Platform_base_sdk_extension_version to default soong.variables
- Teaching the symlink tree creation code to understand symlinks
- Making finder.go follow symlinks when requested

Adding yet another knob is unfortunate, but I can't allow that
unconditionally because the Android code base contains a number of
symlinks giving rise to infinite directory trees because they point back
to their parent and this seemed preferable to adding complicated logic
like "follow symlink but if only its fully resolved version does not
point under the source tree".

I could be convinced about the latter, though.

Test: Presubmits.
Change-Id: I453f6b7e5334771f5832c700db00f9d24ed1d82f
2022-05-04 09:12:01 +02:00
MarkDacek
ff851b83b6 Log information for Mixed Builds modules.
Test: Output matches expected. https://paste.googleplex.com/5913495636803584?raw
Performance evaluated: https://docs.google.com/spreadsheets/d/1X7eOVBKEZUwUWl5i8CDfBo9yUeZrDPXWi2JYO4BEZt4/edit?resourcekey=0-co8crIFW9dpiedhCMkhAgw#gid=0

Change-Id: I88780c7cc52a189a72216c5e2e499c96574b3731
2022-05-03 18:11:32 +00:00
Kousik Kumar
4e3c26602f Merge "Add a warning message about missing gcert at the end of the build" 2022-04-28 19:55:30 +00:00
Kousik Kumar
b018b83664 Add a warning message about missing gcert at the end of the build
Now that we are ready to rollout gcert, adding a warning that builds
will fail if gcert doesn't exist. Doing this only for builds with
ANDROID_BUILD_ENVIRONMENT_CONFIG=googler.

Test: Ran a build without gcert and USE_RBE=true and it printed the
warning.
Bug: b/229743321

Change-Id: I616a4a534ab277873ac7e19baecb78620f07854c
2022-04-27 15:16:41 -04:00
Dan Willemsen
80d7261821 Background distGzipFile to speed up CI builds
These can take a minute or more of build time, and currently hold up
other processing. We could move to a parallel compression scheme to
speed them up, but it's simpler just to background them and continue the
build, waiting to make sure they've finished before exiting.

Testing this on git_master/flame-userdebug:

This brings a local no-op `m nothing dist` build from 2m1s to 1m39s,
even though most of that time is still spent waiting on these (since
there is very little else happening in a `nothing` build when Soong and
Kati don't need to run).

Running `touch art/Android.mk; m nothing dist` (so the above, but with
Kati) goes from 3m39s to 2m2s. We spent 9 seconds at the end waiting for
these to finish.

CI cases that almost always run Kati plus some number of other actions
are likely to completely hide the time taken to dist these files.

Bug: 229932999
Test: Check $DIST_DIR, files still exist
Change-Id: I1fb78d7c4d5103d72b5d71d9277dea0d452f8968
2022-04-22 04:03:29 +00:00
Dan Willemsen
de3604453f Fix some problems with soong metrics loading
If we didn't need to run soong_build during the current run, we still
try to load the soong metrics. But in the case of `dist`, that's in a
directory that is not guaranteed to persist between runs.

Make loading the soong metrics optional if the file does not exist. Also
fixes a variable shadowing issue that meant we never passed it into
ctx.Metrics.

Test: treehugger
Change-Id: Ic836282f4d13e91daa0e7241ad7c488de3293d8b
2022-04-21 21:03:02 +00:00
Yi Kong
6adf2585a1 Expose Clang wrapper's dump usage stats option
This allows us to track how much time is spent in Clang.

Test: TOOLCHAIN_RUSAGE_OUTPUT=/tmp/rusage.txt m
Change-Id: Ib2961904f363bc59bd9d928bb055a96740cb9f17
2022-04-17 15:01:06 +08:00
Colin Cross
645e0251aa Remove references to *_HOST_DALVIK_*
Host dalvik support has been removed from Make.

Test: m checkbuild
Change-Id: I23f02d081d3e1a0334a2ad20fe6ae60922a3d933
2022-04-14 15:57:40 -07:00
David Goldsmith
62243a3691 Add metrics to expconfigfetcher call
Tracks the time to call the expconfigfetcher and whether it updated the
config file or not.

Test:
Ran a build with a "regular" user and verified the metrics indicated
NO_CONFIG and no config file was created.
Ran a build with an "experiment" user and verified the metrics indicated
CONFIG and a googler.json config file was created.

Bug: http://b/227186589
Change-Id: I030e9497c369459ae98c0c4f7765aef6de4c601f
2022-04-11 21:24:03 +00:00
Cole Faust
d9932ad053 Always build mk2rbc/rbcrun
Currently, mk2rbc/rbcrun aren't built in certain phases
of the build, which causes the Starlark product configuration
to fail when using get_build_var if a regular build hasn't
been run before.

Bug: 226677850
Test: Manually
Change-Id: If85608eef63be25fddc4d916c82247c13eb0195f
2022-03-29 14:55:17 -07:00
Treehugger Robot
1c2d87ba83 Merge "Add metrics collection to soong_build" 2022-03-26 00:21:21 +00:00
Chris Parsons
715b08fd82 Add metrics collection to soong_build
Metrics are added to a materialized protobuf soong_build_metrics.pb

Recorded events have scoped names and recorded runtimes.
For example, mixedbuilds includes the following events:

mixedbuilds.prepare
mixedbuilds.analyze.write_files
mixedbuild     (this is a total of all mixedbuild events)

Test: Manually verified materialized protos for mixedbuild, bp2build,
and legacy build.

Change-Id: I2e72d4502c0373bee0279bb1320b2e4dd586129c
2022-03-25 17:19:44 -04:00
Treehugger Robot
13642d4735 Merge "Do not dump metrics if reproxy was never started" 2022-03-21 07:05:41 +00:00
Kousik Kumar
a1d8fa9961 Do not dump metrics if reproxy was never started
Dumping of RBE metrics should only happen when reproxy was started.
Reproxy is started only when Soong is run in make / build mode and not
in dumpvars mode.

Doc: https://docs.google.com/document/d/1Iqhu5QgozB_rA9fucMHO6X4U6A8e8qFtZyub9j83ICQ/edit#
Test: Ran a build with / without RBE. No metrics dumped during lunch
without RBE and metrics dumping worked as expected with RBE.
Bug: b/197213143

Change-Id: Ic3403331e1f4ac2c7c72fd9169aa7b82a7545c75
2022-03-18 02:53:36 -04:00
Kousik Kumar
93d192cc6a Add google_prod_creds to the list of auth mechanisms
This is to ensure that we don't default to using
application_default_creds when it is not set and rather
"RBE_use_google_prod_creds" variable is set. This is necessary to
rollout RBE gcert auth.

Bug: b/224446621
Change-Id: I51e3f1aefadf282240b8f861efafde6b9b61d305
2022-03-18 01:39:56 -04:00
Colin Cross
59c1e6ac0e Support experimental building with OpenJDK 17
Use EXPERIMENTAL_USE_OPENJDK17_TOOLCHAIN=true to build with OpenJDK 17
while still targeting java language version 11.

Bug: 219098645
Test: m EXPERIMENTAL_USE_OPENJDK17_TOOLCHAIN=true
Change-Id: I89fb04ecde4dbd1e102098f316692624dd67f8a2
2022-03-04 21:40:02 +00:00
Kousik Kumar
376cd24d14 Merge "Allowlist stubby to be run within the path imposer" 2022-03-04 16:01:52 +00:00
Christopher Parsons
cb59ea7b2f Merge "Report mkfile metrics with --mk-metrics" 2022-03-03 21:51:29 +00:00
Chris Parsons
53f68ae3b8 Report mkfile metrics with --mk-metrics
Combined with roboleaf CI changes to pass this flag and subsequent
pipeline changes, this will allow basic mkfile metrics to be
dashboarded, which will help track mk2bp progress.

Bug: 217764943
Test: manual; verified mk_metrics.pb is generated iff --mk-metrics is
specified, used printproto on result

Change-Id: I348994b4d7e3479d0dc04de0276b94a702aac95b
2022-03-03 15:28:20 -05:00
Kousik Kumar
9eb43e26c4 Allowlist stubby to be run within the path imposer
To support using google prod credentials for Google developers, we need
to be able to make an RPC call to exchange credentials. This RPC call
needs to be issued via stubby and hence allowlisting the stubby binary.

dwillemsen@ also pointed out that this should be less effective for
other tools running within the build since network access is disabled
for the other tools anyway via sandboxing.

Bug: b/222484146
Change-Id: I29aec9576e86b9ed3051df7943404abd478c549b
2022-03-03 15:07:32 -05:00
Rob Seymour
5e0278ea96 Merge "Add JSON module graph to dist" 2022-03-03 18:47:51 +00:00
Rob Seymour
33cd10d745 Add JSON module graph to dist
Test: m json-module-graph dist nothing
Change-Id: I2a8a89cc5fb767365c9ba92dccc4509c41c6bbb5
2022-03-02 23:12:37 +00:00
Treehugger Robot
eae56c8a52 Merge "Use soong's finder to find included makefiles in mk2rbc" 2022-02-07 22:20:46 +00:00
Cole Faust
8d47c48082 Use soong's finder to find included makefiles in mk2rbc
Having soong generate a list of makefiles for mk2rbc
to look through is much faster than having mk2rbc search
itself. Profiling the readLinesFromeFile() function that
reads the list of makefiles shows it takes on the order
of 200 microseconds, much faster than the ~5 seconds
it takes for mk2rbc to search the tree itself.

This CL also allows include statements that are prefixed
with a variable. The concern with this was that there
would be a lot of load statemnts emitted for generic
include statements, causing the generated code to look
ugly, and converting and loading all those files could
cause performance issues. On the performance issues
front, there's already a check that it doesn't result
in over 150 potentially included files. We can lower
that number if necessary, but it's probably good for now.
On the generated code front, while it's true that it's
ugly, it's better to have working but ugly generated
code than refusing to generate anything working at all.

To ensure the soong finder step isn't slowed down due
to having to find a bunch of new makefiles, I profiled
the combination of newSourceFinder and FindSources in main.go:

Baseline incremental:
338.011634ms
340.853335ms
348.541762ms
333.229644ms
349.124824ms

Baseline clean:
1.003836419s
1.006203912s
996.193648ms
1.031005604s
1.03691152s

Modified incremental:
349.029285ms
349.264496ms
351.774948ms
337.63187ms
359.425306ms

Modified clean:
1.028238704s
1.053103506s
1.032757506s
1.016631201s
1.04288108s

So we can see the times are barely affected by this change.

Fixes: 213508006
Test: go test
Change-Id: Iab18bfb127ba3b7e63f2c01f69064805a8398764
2022-02-07 11:41:28 -08:00
Ramji Jiyani
f0afc9539c system_dlkm: Add in list of partitions to clean
CI builds are doing m installclean between them;
which is not causing the system_dlkm to clean
it's build.prop and it is stuck to the first CI
build when feature landed causing ota signing
test to fail.

Local reproduction using:
m installclean && m -j96 && m dist
validate_target_files out/dist/*target_files-*.zip

Bug: 217507332
Test: Local verification, TH & Forrest
Signed-off-by: Ramji Jiyani <ramjiyani@google.com>
Change-Id: I97f2011a61252d3cb798af0fab99221b754328ca
2022-02-04 23:12:00 +00:00
Kousik Kumar
dedd43c7b9 Merge "Support fetching config files from experiments fetcher binary" 2022-01-31 18:34:33 +00:00
Kousik Kumar
5ddefa3df4 Merge "Move env var config loading to be within the config package." 2022-01-31 04:40:50 +00:00
Kousik Kumar
84bd5bf85c Support fetching config files from experiments fetcher binary
The expfetcher binary (added in
https://critique.corp.google.com/cl/424076941), can fetch experiments
configuration from CDPush and load them into Soong as part of its
startup. If the binary exists, then we use it to fetch experiments
config and put them in the out directory so that those env variables can
be loaded by Soong during startup and inturn control whether RBE should
be enabled or not.
Design doc: go/rbe-android-dev-gradual-rollout

Test:
1. time lunch aosp_bramble-userdebug (first lunch when "out" dir doesn't
   exist) - https://paste.googleplex.com/5824218777255936 - took ~9s and
   ran with RBE enabled.
2. time lunch aosp_bramble-userdebug (when "out" dir already exists) - https://paste.googleplex.com/6485045129773056 -
   took ~3.5s and ran with RBE enabled.
3. time lunch aosp_bramble-userdebug (when
   "vendor/google/tools/soong/expfetcher" doesn't exist) - https://paste.googleplex.com/6103083353374720 - took 6.5s
   and not RBE enabled.

Bug: b/215181607
Change-Id: Ie3c085498c59929119534aa98863566eecb8e4eb
2022-01-29 16:59:04 -05:00
kgui
67007248a5 Add new file name to output inputs/outputs of actions of modules into a new file when m json-module-graph is executed.
And also delete the logic in droidstubs to output JSONDataActions.

Test: local.

Change-Id: Ib5d6f1f69c16c41f128e481131775c7699f96464
2022-01-28 13:52:50 +08:00
Kousik Kumar
3ff037e3d9 Move env var config loading to be within the config package.
When the environment variable config file is loaded after config object
is initialized, we  end up loading the USE_RBE variable in the config
file after the code to start reproxy process is run. This causes a
problem when USE_RBE variable itself is set in the config files. To
avoid this, I've moved the config file loading code to be within the
config package, this makes the main.go file cleaner too.

Test:
Ran a build with USE_RBE:true set in the config json file. The build
fails without this change and succeeds with this change.

Bug: b/209486170
Change-Id: Iab3957b64f4b5456a861057d16ad318f4f78e0cb
2022-01-26 18:40:43 -05:00
Andus Yu
1e698865b5 Merge "Add RBE_num_local_reruns and RBE_num_remote_reruns environment variables to enable reruns in RBE." 2022-01-24 19:32:09 +00:00
Chris Parsons
492bd91a51 Add bp2build metrics per module type
For example, new metrics at HEAD highlight that 99 of 1379 total
cc_library_static modules are converted.

Test: m bp2build, printproto
Change-Id: I6cc4227124e9a130b75911f3e40e6585d731d00a
2022-01-21 11:52:24 -05:00
andusyu
240660d545 Add RBE_num_local_reruns and RBE_num_remote_reruns environment variables
to enable reruns in RBE.

Change-Id: I668ad78027cd0756d5e0bf2f788667b47175785f
2022-01-20 14:00:58 -05:00
Kousik Kumar
35faaef43e Pass along local resource fraction to reproxy
Reproxy should be respecting the -j value set by the user and not be
doing excessive local executions assuming the whole machine is available
to it. The local_resource_fraction flag is a way to ensure reproxy
consumes CPU only upto the -j value specified by the user.

Test:
1. Ran with `USE_RBE=true m -j 10 nothing` and local_resource_fraction
was set to 0.14 on a 72-core workstation.
2. Ran with `USE_RBE=true m nothing` and local_resource_fraction was set
to 1.0 on a 72-core machine.

Bug: b/207296459
Change-Id: I118bc10109f5a55df7a6c1ecd79499320055f2ed
2022-01-13 02:13:10 -05:00
Lukacs T. Berki
136442737d Only disable async preemption in debug mode.
Colin and Jin opined that we shouldn't change production in order to
make debugging easier. I originally thought it's better to have one
fewer knob but I don't have very strong feelings about it and their line
of reasoning makes total sense.

Test: Presubmits.
Change-Id: Id8a914aebbeffec6e8f860157c13f81093194f14
2022-01-05 10:31:21 +01:00
Lukacs T. Berki
2fad341beb Allow not buffering the output of soong_build .
This behavior is enabled by setting the environment variable
SOONG_UNBUFFERED_OUTPUT=1 .

This is not the default behavior because only one process can be running
in the console pool and this would thus result in a loss of parallelism
if multiple soong_build invocations are needed.

Changing the value of this environment variable does not result in a
rebuild, since it does not affect the build outputs.

Test: Presubmits.
Change-Id: I49d15eb145966bd805f0a47b46866285203b122a
2022-01-04 14:55:50 +01:00
Liz Kammer
886774204b Don't run SoongBuildInvocation for bp2build + dist
Test: build/bazel/ci/bp2build.sh
Change-Id: I8d24ba437f8af4528ca739feace84e8cfccc5e0b
2021-12-15 15:03:19 -05:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
947fdbfdee Log bp2build_metrics .pb
Also share `Save(pb proto.Message, filepath string)`

Bug: 201539536
Test: bp2build_metrics.pb has expected content & path
Test: m nothing
Test: {bp2build,mixed_{libc,droid}}.sh
Test: CI
Change-Id: I7d8ad87fca6a4b0355010090a527f5ae67b27c88
2021-12-13 13:03:44 -05:00
Sasha Smundak
827aead340 Suppress all progress messages from Ninja if ANDROID_QUIET_BUILD is set.
Test: build with ANDROID_QUIET_BUILD=true, observe no progress messages
Change-Id: I98b9a657affa2ebbf86c9c081d51c31698072fed
2021-12-10 16:42:34 -08:00
Jingwen Chen
78fd87f25a Add descriptions to soong_build actions.
[  0% 0/5 ] generating Soong docs at out/soong/docs/soong_build.html
0:03 analyzing Android.bp files and generating ninja file at out/soong/build.ninja
0:03 converting Android.bp files to BUILD files at out/soong/bp2build
0:03 generating the Soong module graph at out/soong/module-graph.json
0:03 generating the Soong module graph as a Bazel workspace at out/soong/queryview
0:03 generating Soong docs at out/soong/docs/soong_build.html

Test: m soong_docs json-module-graph bp2build queryview nothing
Change-Id: I33abb8828ead9ef999ffa1a6c9c4b016957c6dd1
2021-12-06 13:29:43 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
142cc2e360 Add bp2build_metrics
Through a .proto

Bug: 201539536
Test: m nothing
Test: {bp2build,mixed_{libc,droid}}.sh
Test: CI
Change-Id: I18d25eb8cd40c8a88d9ae79a85980b956194a0d4
2021-11-16 14:48:45 -05:00
Lukacs T. Berki
5a67da789d Make bgplob an exception to dangling rule check.
It's built explicitly by Microfactory but is under out/ and as such, it
would be normally flagged as a file in out/ that doesn't have a
generating rule.

Previously, a no-op rule was added to the Ninja file to prevent this
from happening, but there is no good reason to have two mechanisms to
exempt files under out/ from that check.

Test: Presubmits.
Change-Id: I37fc458ecc5f5734cd81bce2f4894063658df38f
2021-11-10 12:32:22 +01:00
Colin Cross
acfcc1f682 Move cc module installation into Soong
Move cc module installation rules into Soong by overriding
InstallBypassMake.  Update the locations that find host tools
to look in the Make installation directory instead of the Soong
installation directory, which will no longer be used.

The methods that find host tools are also used on go binaries,
so update the config methods that tell Blueprint where to install
go binaries to the Make installation directory too.

Bug: 204136549
Test: m checkbuild
Change-Id: Id172592c195e506102982a4af0084f6d9c68a896
2021-11-04 10:28:58 -07:00
Lukács T. Berki
a64bd73b18 Merge "Bump the bootstrap epoch number." 2021-11-04 17:10:35 +00:00
Lukacs T. Berki
9985d9a3a5 Bump the bootstrap epoch number.
The bpglob changes in build/blueprint submitted together with this
change make it necessary.

Test: Presubmits.
Change-Id: I3d19761ec1a199c2f77693a882f8744ce404c6de
2021-11-04 11:47:42 +01:00
Lukacs T. Berki
90b4334a64 Remove the out/soong/.bootstrap directory.
It's better not to have state hidden in dotfiles (or rather,
dotdirectories) if we can help.

It's questionable whether the "linux-x86" path segment makes sense since
soong_build only ever runs on one operating system, but I didn't want to
rock the boat now.

Drive-by fixed some quoting fixes in rbc-run. Notably, I didn't wrap
`$@` into double quotes because I don't know whether the lack of double
quotes was intended or not.

Also drive-by fixed the fact that "out/soong" was added twice to the
directory name of bpglob. This turned out not to be a problem because
bpglob doesn't need to be explicitly built: if it's needed, it's
declared as an input of the glob files so it'll be built automatically
(at the cost of the first "null build" not actually being a null build)

Test: Presubmits.
Change-Id: I710d8d16cd8212059a0ca1ee95378505303eed83
2021-11-04 09:47:58 +01:00
Colin Cross
9191df23df Move bpglob out of ToolDir
ToolDir is going to become unstable when switching between KatiEnabled
and Soong-only builds while the duplication between out/soong/host and
out/host is resolved.  bpglob gets executed very early during bootstrap,
before the primary builder has run to update the paths to match the
current configuration.  Move it into SoongOutDir() so that its path
is more stable.

Moving bpglob causes incremental build issues, so add a bootstrapEpoch
constant that can be changed when making incompatible changes and will
wipe bootstrap intermediates.

Bug: 204136549
Test: m nothing
Change-Id: I7b1bd1ebfe1209d11db691b3ee00873ef92658cd
2021-11-02 15:30:36 +00:00
Cole Faust
65f298ca63 Remove MainNinjaFile()
It was the same as SoongNinjaFile, except it used
shared.JoinPath instead of filepath.Join, which
doesn't matter here because the second argument
is never an absolute path.

Test: Presubmits
Change-Id: I95e64a8b8971bd168a1dc6670ae80f4d336045b5
2021-10-28 16:05:13 -07:00
Yu Liu
6e13b40628 Change the approach to decide whether to upload metrics.
1. Don't upload if the uploader binary is not present.

Bug: b/193703183
Test: Run the following tests locally:
1. run "go test ." in build/soong/ui/build
2. create vendor/google/misc/metrics_uploader_prebuilt/metrics_uploader.sh
and run m nothing to ensure metrics_uploader.sh was called
3. remove the file created in step 2 then run m nothing and ensure it
doesn't attempt uploading

Change-Id: I081a5510b3f30480720c3e7dd235623c805fa7a4
2021-10-11 21:05:00 +00:00
Yu Liu
37c3dd3276 Rename desc to description in PerfInfo
Bug: 201326605
Test: Ran go unit tests and verified the generated soong_metrics file.
Change-Id: I3ff0aa11e39f0a9862638706ae50550c78030cca
2021-10-11 11:11:45 -07:00
Yu Liu
c7ece788de Merge "Store build targets in the soong metrics." 2021-10-06 17:53:32 +00:00
Yu Liu
e737a9912b Store build targets in the soong metrics.
Bug: 194519312
Test: Added unit test and verified the soong metrics file generated.
Change-Id: I832da2501e0e8d3435d4f92642cf45ddccb7f2ea
2021-10-04 13:24:48 -07:00
Paul Duffin
39abf8f387 Retry: Support generating sdk snapshot for specific build release
This was reverted unnecessarily along with the change that actually
broke the build.

Previously, the sdk snapshot was assumed to be generated for the
current build system. This change adds support for the
SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE environment variable which can
be used to select the target build release in which the generated
snapshot will be used.

At the moment this will only affect the properties that are output but
if/when it becomes necessary it can also be used to control more
aspects of the snapshots such as supported member types or even
members.

This change does not modify any properties that are build release
specific. That will come in following changes. However, it does add a
test that targets build release S which defines a baseline for
properties that will be affected in following changes. That baseline
makes it easier to see the effect of those follow up changes.

Bug: 197842263
Test: m nothing
Change-Id: If4b452237f105382550d2842c8010249afbc7432
2021-10-04 10:28:31 +01:00
Salmax Chang
203ec0139b Revert "Support generating sdk snapshot for specific build release"
This reverts commit ef2df587be.

Reason for revert: suspect to cause build break in b/201948713

Change-Id: If46219746913bec87ca2030ba51a6094246a0211
2021-10-04 05:41:37 +00:00
Paul Duffin
ef2df587be Support generating sdk snapshot for specific build release
Previously, the sdk snapshot was assumed to be generated for the
current build system. This change adds support for the
SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE environment variable which can
be used to select the target build release in which the generated
snapshot will be used.

At the moment this will only affect the properties that are output but
if/when it becomes necessary it can also be used to control more
aspects of the snapshots such as supported member types or even
members.

This change does not modify any properties that are build release
specific. That will come in following changes. However, it does add a
test that targets build release S which defines a baseline for
properties that will be affected in following changes. That baseline
makes it easier to see the effect of those follow up changes.

Bug: 197842263
Test: m nothing
Change-Id: I5cfde5e9e86af522b0d5030d301e116b0233fd62
2021-10-01 17:27:03 +01:00
Colin Cross
3c0fe0edc0 Add environment variable to force keeping ANSI codes
If SOONG_UI_ANSI_OUTPUT is set to a true value force the simple status
output to keep ANSI codes.  This will allow buildbots to collect logs
with ANSI codes in them.  Smart status output is not affected as it
always keeps ANSI codes.

Bug: 147310922
Test: manual
Change-Id: I0b78ceebb65125b8e8dafb4787816fb679d3eb3e
2021-09-21 12:53:30 -07:00
Colin Cross
72a28a6a13 Disable table mode in smart status if window size is not available
Make smart status output automatically disable table mode when the
window size is not available.

Bug: 147310922
Test: status_test.go
Change-Id: Ic57e1efd742e869bb84b6a86b3014335f5a65d39
2021-09-21 12:36:22 -07:00
Cole Faust
521e951ad4 Fix m product-graph
`m product-graph` runs a "non-full" build, which skips
some steps to improve performance. One of the steps
it skips is making a .installable_files file. Soong
reads this file and removes any files that were removed
from the list in this file. It errored out if the file
didn't exist. Make soong less strict about the presence
of this file, because if it doesn't exist, there shouldn't
be any installed files to remove either.

Fixes: 168105598
Test: rm -rf out/, m product-graph
Change-Id: I366f7b09d87911f9660d4e08c2d2f097cc04800f
2021-09-14 15:09:42 -07:00
Lukacs T. Berki
e1df43fafe Implement cleanups requested in aosp/1818245:
- Remove useValidations: whenever it was used, it was turned on, so
there was no point in keeping that knob
- Use the new soong_build invocation name constants

Test: Presubmits.
Change-Id: Ia3e8928d30d3de1e0adaa741111771304e56b139
2021-09-08 15:33:37 +02:00
Lukacs T. Berki
89fcdcb788 Refactor the creation of soong_build calls.
They were a bit repetitive.

In addition, make the environment checks more correct; they could
probably use an integration test or two to make sure that when the
environment changes, exactly those outputs are rebuilt that need to be,
but for now, this is an improvement already.

Test: Presubmits.
Change-Id: Idd79b81ca6975d57d00e5bf4699d266152505ff8
2021-09-08 09:36:22 +02:00
Lukacs T. Berki
c6012f36e1 Invoke soong_docs from the bootstrap Ninja file.
This makes soong_ui the only place where soong_build is invoked, thus
greatly simplifying the conceptual model of the build.

It comes with the slight limitation that now soong_docs (and queryview
and the JSON module graph) are not Make targets anymore, but I suppose
that's an acceptable loss.

The only place where someone depended on soong_docs from a Makefile is
removed in a separate change.

Test: Presubmits.
Change-Id: I3f9ac327725c15d84de725d05e3cdde1da3dcbe2
2021-09-08 09:31:52 +02:00
Lukacs T. Berki
ffc9e8d812 Pass StopBefore as an argument to RunBlueprint.
Its value is a function of the call site, so it doesn't make a lot of
sense to plumb it through the configuration.

Test: Presubmits.
Change-Id: If928b34de075969fd42932212ce9187808cbdf86
2021-09-07 18:14:07 +02:00
Lukacs T. Berki
3a82169a55 Invoke queryview from the bootstrap Ninja file.
It used to be invoked from out/soong/build.ninja, which required two
soong_build invocations one after the other (ne to generate
out/soong/build.ninja, one to generate the queryview workspace). This
was slower and required some shell-quoted-in-ninja-quoted-in-Go .

Test: Presubmits.
Change-Id: Idda79c067606663b66e9f94626fa24f3b5af4114
2021-09-06 17:10:49 +02:00
Lukacs T. Berki
a1b9372ef7 Make running soong_build in alternate modes nicer.
This includes the JSON graph generator and bp2build.

Before:
GENERATE_BAZEL_FILES=1 m nothing
GENERATE_JSON_MODULE_GRAPH=1 m nothing

Now:
m json-module-graph
m bp2build

They can now also be combined with other targets or each other.

The longer-term goal is to run "m queryview" and "m soong_docs" using
the same infrastructure. There are two alternate approaches:

1. Call soong_build from within the main Ninja invocation. This requires
two sequential soong_build invocations and is thus slower.
2. Do everything requested in the same soong_build invocation. This
would be faster, but one AFAIU can't tell Ninja that multiple possible
actions can build the same output so that doesn't work.

(1) is somewhat more desirable because soong_docs seems to be built
from build/make/core/main.mk ; I assume that that can be worked around
although I haven't checked where the output of "m soong_docs" goes.

Test: Presubmits.
Change-Id: If5ba36490d9f3f60733e6d6be9286eb2b67c3ff5
2021-09-06 16:03:51 +02:00
Lukács T. Berki
399dbe0699 Merge "Do not modules in files called "Blueprints"." 2021-09-03 18:20:39 +00:00
Lukacs T. Berki
b838b0a147 Do not modules in files called "Blueprints".
The only case for this was Blueprint itself at build/blueprint, but with
that being a part of Soong, this special case is not necessary anymore.

Test: Presubmits.
Change-Id: Icc51cd80bd43f936a97018061cfbf76fc385e4c3
2021-09-02 11:46:24 +02:00
Lukacs T. Berki
ea1a31c07f Remove the bootstrap.Config class.
It was confusing because bootstrapping uses two configurations: the
"global" config and the special-cased bootstrap one.

This change merges them.

Test: Presubmits.
Change-Id: I82b482cbe28a343ab6991374b2a28667e1a06b48
2021-09-02 09:59:35 +02:00
Lukacs T. Berki
a806e4176b Remove bootstrap_go_binary .
blueprint_go_binary is enough.

Test: Presubmits.
Change-Id: Ic95ed8533603dff396740bc1d2a7c60ff2cebf20
2021-09-01 11:55:22 +02:00
Lukacs T. Berki
b078ade28d Remove some unused args from Blueprint.
These are: TopFile and GeneratingPrimaryBuilder.

Also re-shuffle the list of flags to make a bit more sense and finish
the rename of BuildDir and NinjaBuildDir to SoongOutDir and OutDir,
respectively.

Test: Presubmits.
Change-Id: I103ff5f09f1c0d16f695a7da5dea13b55028e33e
2021-08-31 11:42:48 +02:00
Colin Cross
e57ecb3eb8 Remove extra checkbuild argument from ninja tools command lines
The dangling rules check was running `ninja checkbuild -t targets rule`.
This apparently worked fine with glibc, but is failing when ninja is
compiled with musl.  Musl's getopt_long is leaving "checkbuild" in argv
when calling ninja's ToolTargets, resulting in:
ninja: error: unknown target tool mode 'checkbuild'

Remove the extraneous checkbuild argument.

Bug: 190084016
Test: m checkbuild
Change-Id: I61b6475a5f7cb9d3d47232057ecfdc798864dd81
2021-08-30 14:32:57 -07:00
Lukacs T. Berki
e571dc3bd0 Print the JSON module graph correctly.
Before, we piggybacked on the implementation of regular soong_build and
wrote a fake build.ninja file to satisfy Ninja.

Now, instead, the JSON module graph is a a separate action in the Ninja
output file. This has the pleasant side effect that one can flip back
and forth between generating the JSON file and regular Soong without
loss of incrementality.

Side cleanup: write .d files in a slightly cleaner way.

Test: Presubmits.
Change-Id: Ia853383567b9dd31c53f3bdf56cfc8d517b498ec
2021-08-27 15:55:51 +02:00
Lukacs T. Berki
9f6c24a887 Rename BuildDir and NinjaBuildDir.
These are just out/ and out/soong/ and the old names were quite
confusing.

Test: Presubmits.
Merged-In: I999ca62162062f27e449f83ffb00fa580d4065b8
Merged-In: I2fcd80a9e376a6842a06aa104a9f6f5c5e16f8c7
Change-Id: Ib481d2aac40df8da1b74174dc8ec576c1cb48be0
2021-08-27 10:08:49 +02:00
Lukacs T. Berki
f7e36d80ff Remove Srcdir() from BootstrapConfig.
It was always ".".

Test: Presubmits.
Change-Id: I5381002b3f2986122f1b335a88119cead0a86d75
2021-08-16 17:05:09 +02:00
Lukacs T. Berki
9d7cf6a336 Move bpglob to .bootstrap from .minibootstrap.
Test: Presubmits.
Change-Id: If6315e497cdc0e6c0f348eb9d4b596ebd13d6303
2021-08-16 14:08:57 +02:00
Lukacs T. Berki
56ebaf35b3 Separate the files of bp2build and soong_build.
The following files are forked:

- build-globs.ninja
- The glob list files
- .d files for the glob list files
- The output file (build.ninja or the bp2build marker file)

This makes bp2build and soong_build not overwrite each other's files
they need for proper incrementality.

Test: Presubmits.

Change-Id: I69d192cbd36ecd9677f46f3fa095dfce6f872227
2021-08-16 09:15:28 +02:00
Rupert Shuttleworth
755ceb01e3 Ensure directories in the Soong output dir have appropriate permissions, so that 'm clean' works.
In particular, Bazel sometimes creates directories whose files cannot be deleted.

Test: m clean used to fail after b build //system/timezone/apex:com.android.tzdata, but now it works
Test: Added integration test which fails without this change

Change-Id: I08c8feed21c31ec187fe40be513f7eb4865c8ac3
2021-08-12 05:07:11 -04:00
Lukacs T. Berki
f656b8434b Cut the multiproduct_kati -> soong-ui-build dep.
This is done by moving SetupSignals() to its own little package.

There are a number of tiny little utility packages for soong_ui we might
be better of merging, but that's for another change (maybe)

Test: Presubmits.
Change-Id: I07b0ca98bfb8884ef4223d665e632183b9896a0d
2021-08-11 15:15:02 +02:00
Lukacs T. Berki
cef87b62e4 Make multiproduct_kati call soong_ui.bash .
This serves to not link parts of soong_ui (and eventually soong_build)
into a separate, weird binary. This is in turn good because they contain
any number of global variables and no one really thought about what
happens when two instances are executing at the same time in the same
address space.

This comes with a slight performance hit: 5 aosp_* projects build 152
seconds instead of 146. I suppose this is a price worth paying for a
clean design?

Test: presubmits.
Change-Id: I5623dcab2290f0fc392dd2ede597b9794a3d2a4e
2021-08-10 17:35:14 +02:00
Dan Willemsen
f42f01b49d Merge "Upgrade to golang protobuf api v2" 2021-07-29 18:29:26 +00:00
Sasha Smundak
7ae80a7044 Build mk2rbc and rbcrun during bootstrap
Bug: 172923994
Test: treehugger
Change-Id: I6b552b40eecbaedd17b39ed5d00ca2a0b0772c81
2021-07-27 10:27:43 -07:00
Dan Willemsen
4591b6496d Upgrade to golang protobuf api v2
Major operations:
 * Fix the go_package entries to be consistent, as the new tool
   complains when it doesn't have a '/'.
 * Regenerate with the new protoc-gen-go tool.
 * github.com/golang/protobuf -> google.golang.org/protobuf
 * proto.[Un]MarshalText -> prototext.[Un]Marshal

Change-Id: Ie1147bd2457fafb66ba555461b3bf14f0561a25d
2021-07-23 11:12:05 -07:00
Liz Kammer
da29c65eb6 Merge "Include bazel-status of build in metrics" 2021-07-15 12:58:04 +00:00
Paul Duffin
fb9a7f99be Support generating sdk snapshots that can be selected by Soong config vars
Allows the builder of an sdk snapshot to specify a Soong config
variable that can be used to control whether the snapshot's prebuilts
are used or not.

Bug: 193523070
Test: m nothing
Change-Id: Ib09500ba61befc1202dff61dc06847c730ba9253
2021-07-14 23:19:53 +01:00
Liz Kammer
ca9cb2e5bd Include bazel-status of build in metrics
Currently within metrics we cannot distinguish between Bazel-involved
configurations:
  Bazel as Ninja vs Ninja as Ninja builds
  Bazel mixed builds vs non-mixed builds

Add these to the build configuration in order to distinguish between and
track them independently.

Test: go soong tests
Test: USE_BAZEL_ANALYSIS=1 m nothing and verify out/soong_metrics
Bug: 193672397
Change-Id: I94ce56c1a98a76d929598d9fe3070df16ffa1376
2021-07-14 17:48:04 -04:00
Spandan Das
3a932550a3 Merge "Add errorHints to stdout when read-only file system errors are detected" 2021-06-30 23:52:19 +00:00
Anton Hansson
17fc5a03da Remove kati marker in soong-only build
Previously we ensured the kati marker exists in kati-enabled builds, but
did not ensure the kati marker didn't exist in non-kati-enabled builds,
resulting in soong thinking kati would run after it when it would not.

Also change the condition to only create the kati_enabled marker if we
don't skip kati or kati ninja.

Bug: 189187214
Test: m nothing && soong_ui --make-mode --soong-only && verify
      kati_enabled marker is gone
Change-Id: If196b194b6aee38e9d4135889a4a4048ee5add82
2021-06-29 15:17:36 +01:00
Spandan Das
0506361a60 Add errorHints to stdout when read-only file system errors are detected
The source tree will eventually be made ReadOnly, and recipes that write
directly to the source tree will fail. Use a pattern-match approach on
the results of stdout/stderr to provide hints to the user in such a
scenario.

If multiple patterns are found in raw output, print error hint
corresponding to first pattern match. first pattern match is chosen
since the failing function will be at the top of the stack, and hence
will be logged first

Test: Wrote a unit test to assert errorhint is added to output.
Wrote an integration test that writes to a file in the source tree
1. When source_tree is RO, the recipe fails and an error hint is printed
to stdout
2. When source tree is RW, the recipe succeeds and no error hint is
printed

Bug: 174726238
Change-Id: Id67b48f8094cdf8a571c239ae469d60464a1e89c
2021-06-29 00:20:21 +00:00
Jingwen Chen
dd9725c177 Fix SOONG_DUMP_JSON_MODULE_GRAPH on a fresh checkout.
This CL adds generateJsonModuleGraph bazelBuildMode and ensures that it
returns Soong early, before Kati and Soong metrics collection begin
(which causes errors, since they're looking for files that Soong in json
dump mode did not write).

Test: TH
Test: rm -rf out && SOONG_DUMP_JSON_MODULE_GRAPH=/tmp/soong.json m nothing

Change-Id: I264eadb3b3b0cd6b6e7a65adc7b39bb1c01ca136
2021-06-24 08:41:19 +00:00
Colin Cross
30e444be67 Add --skip-config flag to soong_ui.bash
--skip-config can be combined with --soong-only to skip creating
soong.variables from Make, allowing a custom soong.varibles.

Test: manual
Change-Id: Iee9bfa4efeed801339e7c3c1e4807709485e701a
2021-06-18 11:26:19 -07:00
Spandan Das
8f99ae6bc0 Bootstrap empty glob file
1. Initialize an empty glob file for .bootstrap/build.ninja. Initializing
in soong_ui (and not soong_build) prevents inadvertently creating the
file inside the source tree
2. Remove soong-build-globs.ninja, which is not used during the build

Bug: 187194795
Test: Ran the following command locally for the target
art-target-arm:git_master-art
```
. ./build/envsetup.sh && lunch armv8-eng &&
art/tools/buildbot-build.sh --target
```

Change-Id: Ibe6eeff65ea1ab25136642299e9878d0da1cac42
2021-06-15 17:50:46 +00:00
Anton Hansson
0b55bdb7af Add a soong-only mode to soong-ui
The previous --skip-kati flag could be interpreted as "do not run kati
to re-generate ninja file". Add a more specific flag for the "soong
only" build use-case, where we do not load the kati-generated ninja
files at all.

Bug: 189187214
Test: build/soong/soong_ui.bash \
  --make-mode \
  --soong-only
  --skip-soong-tests \
  TARGET_PRODUCT=mainline_sdk \
  SOONG_ALLOW_MISSING_DEPENDENCIES=true \
  SOONG_SDK_SNAPSHOT_VERSION=unversioned \
  SOONG_SDK_SNAPSHOT_USE_SRCJAR=true \
  out/soong/mainline-sdks/art-module-sdk.zip
Change-Id: I91abbd28af517d4b550ebc6d88fd64947caf9545
Merged-In: I91abbd28af517d4b550ebc6d88fd64947caf9545
(cherry picked from commit 546de4a1f3)
2021-06-07 14:34:40 +01:00
Anton Hansson
5a7861a272 Various cleanup in soong_ui to aid new feature
- Rename the "BuildX" variables to "RunX"
- Remove redundant comments
- Inline all the "what to do" based on config in build.go
- Inline some constants only used in one place

Bug: 189187214
Test: m nothing
Test: build/soong/build_test.bash
Change-Id: I111a69e642212d7938d4971283545e0d9acbb01a
Merged-In: I111a69e642212d7938d4971283545e0d9acbb01a
(cherry picked from commit d274ea9196)
2021-06-07 14:34:40 +01:00
Spandan Das
8e590ea854 Merge "Create Make flags to set source tree as ReadOnly in soong builds" 2021-06-02 19:23:11 +00:00
Spandan Das
a3639e62cd Create Make flags to set source tree as ReadOnly in soong builds
The following two Make vars control RO/RW access to the source tree
1. BUILD_BROKEN_SRC_DIR_IS_WRITABLE
2. BUILD_BROKEN_SRC_DIR_RW_ALLOWLIST

By default, (1) will be truthy.
- this ensures that this CL is a non breaking change across all products
- different products can opt in to set is as "false"

Bug: 174726238
Test: from build/soong dir, ran go test ./ui/build
Change-Id: I4d55ac74f02b2a73194d31506a9010162620b25a
2021-06-01 21:40:49 +00:00
Colin Cross
f3bdbcbea3 Fix propagating EMPTY_NINJA_FILE from multiproduct_kati to minibp
I6dca478f356f56a8aee1e457d71439272351390b replaced calling
build/blueprint/bootstrap.bash with running minibp directly,
but didn't propagate the EMPTY_NINJA_FILE environment variable
to minibp.  Since everything that uses EMPTY_NINJA_FILE is
executed directly from soong_ui now, replace the EMPTY_NINJA_FILE
environment variable with a config bool and pass it to minibp.

Bug: 189148777
Test: build/soong/build_test.bash --dist --incremental --shard-count=300 --shard=1 && du out/multiproduct
Change-Id: I4d64275ce02c5d68948012f71ac4dc3795af9e85
2021-06-01 11:43:55 -07:00
Jingwen Chen
4fabaf52b0 bp2build/b: exit early in GENERATE_BAZEL_FILES=1.
This CL fixes a typo in writeFakeNinjaFile to correctly write
a fake out/soong/build.ninja and its depfile. It also modifies bootstrap
phase to *not* run the main soong build phase (which takes more than a
minute) if GENERATE_BAZEL_FILES=1.

This change has the side effect that `GENERATE_BAZEL_FILES=1 m nothing`
no longer generates the real build.ninja, which is fine because one
shouldn't be using GENERATE_BAZEL_FILES=1 for that anyway (or, use
USE_BAZEL_ANALYSIS=1). This change has no effect on mixed builds.

Time on a change to Soong or any Android.bp files:

Before: bp2build_workspace_marker (~20 seconds) + build.ninja (1 min)
After: bp2build_workspace_marker (~20 seconds)

Time on the second of two consecutive `b build //bionic/...`: 2.070s

Test: TH
Test: Soong integration tests
Change-Id: I43720641815994caba97b8d165d7c3fc254cbd06
2021-05-25 03:42:38 +00:00
Treehugger Robot
3078f3bddc Merge "Add SOONG_SDK_SNAPSHOT_VERSION support" 2021-05-24 17:58:17 +00:00
Rupert Shuttleworth
c29cace414 In the finder, keep track of BUILD files instead of only BUILD.bazel files.
Test: TH
Change-Id: I95bf638ff1f71849a885d22326c5c527a3d00947
2021-05-18 08:40:24 -04:00
Paul Duffin
43f7bf0efd Add SOONG_SDK_SNAPSHOT_VERSION support
SOONG_SDK_SNAPSHOT_VERSION=current will generate unversioned and
versioned prebuilts and a versioned snapshot module. This is the
default behavior. The zip file containing the generated snapshot will
be <sdk name>-current.zip.

SOONG_SDK_SNAPSHOT_VERSION=unversioned will generate unversioned
prebuilts only and the zip file containing the generated snapshot will
be <sdk name>.zip.

SOONG_SDK_SNAPSHOT_VERSION=<number> will generate versioned prebuilts
and a versioned snapshot module only. The zip file containing the
generated snapshot will be <sdk name>-<number>.zip.

Bug: 157884619
Test: m nothing
      m SOONG_SDK_SNAPSHOT_VERSION=current art-module-sdk
      - check that the generated Android.bp file has not changed
        from the default.
      m SOONG_SDK_SNAPSHOT_VERSION=none art-module-sdk
      - check that the generated Android.bp file does not contain
        versioned modules.
      m SOONG_SDK_SNAPSHOT_VERSION=2 art-module-sdk
      - check that the generated Android.bp file only contains
        version 2 of each module.
Change-Id: I087e9d7d3ad110508a3d6a39bca50cbb46b3ce82
2021-05-12 22:14:32 +01:00
Colin Cross
f7bcd42a4a Clean symbols directory during installclean
Installclean is used in some build server builds when switching between
different TARGET_BUILD_APPS, remove the symbols directory so it doesn't
accumulate old symbols files.

Bug: 186507256
Test: m && m installclean && m
Change-Id: I316703cd0985ee555959a6dcdb39d5a702ab0332
2021-04-28 16:52:52 -07:00
Peter Collingbourne
19947656df Merge "Don't print RBE stats if ANDROID_QUIET_BUILD is set." 2021-04-26 19:47:58 +00:00
Peter Collingbourne
f4d9bd2c4d Don't print RBE stats if ANDROID_QUIET_BUILD is set.
Change-Id: I3823f44fb25f90955f0b42326032fea30683b069
2021-04-20 21:03:02 -07:00
Chris Parsons
ec1a3dc6f8 Subsume INTEGRATED_BP2BUILD into other env modes
This refactors bazel-build mode determination logic in soong_ui so it's
clearer which of three possible modes are being used in a given
invocation (NO_BAZEL, GENERATE_BUILD_FILES, or MIXED_BUILDS).

Test: bootstrap tests
Change-Id: I41d2baebf8d560c2cc42db8daa8b936101d453e3
2021-04-20 19:25:48 -04:00
Lukacs T. Berki
d518e1a407 Make bp2build be more correct.
It now handles adding .bp files and changing globs.

In order to do this, depfiles are now written separately from RunBlueprint.

This is necessary due to the confluence of a number of seemingly
unrelated factors:

1. The glob filelist dependencies are discovered in globSingleton
2. Singletons need to be registered because otherwise singleton module
   types panic
3. Singletons don't work because they require mutators bp2build does not
   run

Due to (1), we would need to run the glob singleton. However, due to (2)
and (3), we can't run singletons and have to run Blueprint with
StopBeforeGeneratingBuildActions, which is when the build actions
writing glob files would be generated. So what happens is:

1. When bp2build is run, the glob singleton is disabled
2. At the end of bp2build, the list of glob files is artifically added
   to the depfile of the workspace marker file
3. When build.ninja is generated, the Ninja file containing the glob
   list file is written by the now-active glob singleton

Test: Presubmits.
Change-Id: I3c5898d8c57c554a93520276c64a952afc912dbe
2021-04-15 13:06:16 +02:00
Lukacs T. Berki
f8e2428c5d Allow running bp2build as part of a regular build.
This is done by setting the INTEGRATED_BP2BUILD environment variable
when invoking the build.

Even though the name of the marker file insinuates that a Bazel
workspace is already created, this is not the case yet.

An issue that remains is that a .d file is not written for the marker
file so it won't be rebuilt if a .bp file changes. Fixing this requires
delicate surgery because writing the .d file is the result of delicate
interplay between Soong and Blueprint.

There are also a number of semi-related fixes:

- The name of soong.environment.{used,available} is now on the command
  line of soong_build (soong_docs is still special cased because its
  command line in the Ninja file is taken from the os.Args of
  soong_build so it's not trivial to remove the --{available,used}_env
  from it
- bp2build writes a separate soong.environment.used file
- I had to call SetAllowMissingDependencies() separately when creating
  the android.Context for bp2build so that bp2build runs in the
  integration tests (it was not obvious how not to do this)
- Fixed a number of integration tests where a command with an expected
  exit code of 1 was used as the last one in a test case, thereby
  breaking the test suite

Test: Presubmits.
Change-Id: Ibeb61c26022cf801dcb98505b4039151b3409873
2021-04-15 08:46:07 +02:00
Lukacs T. Berki
745380ce23 Remove the dependency on a number of env vars.
This is so that the way soong_build is invoked is simpler, which is in
turn useful so that it can be invoked multiple times within a single
build, which in turn will be used to invoke bp2build routinely (as
opposed to manually when needed)

Test: Presubmits.
Change-Id: Iddaebb05ff7bcedc0db8273192bb31284b739920
2021-04-12 12:07:44 +02:00
Rupert Shuttleworth
bf94d2fdba Allow Bazel actions to see the SHELL variable.
Test: TH
Change-Id: I97ffe7ad84dfb8d58d0e6d022f73d97a73778129
2021-04-02 20:09:51 +00:00
Kousik Kumar
2081052592 Print the output from RBE bootstrap shutdown
The output from bootstrap would contain the a one-line summary of RBE
download / upload stats.

Bug: b/183007125
Change-Id: I90082a8433504e40bbf92992c3c8d1d656c49429
2021-03-21 22:39:04 -04:00
Kousik Kumar
47665870d7 Merge "Allowlist RBE_num_retries_if_mismatched variable" 2021-03-18 19:13:29 +00:00
Kousik Kumar
c3a22d8ebd Allowlist RBE_num_retries_if_mismatched variable
This variable tells reproxy the number of times an action that
mismatches between local and remote-executions should be run remotely to
determine if the action is inherently non-deterministic.
An action is considered non-deterministic if the number of unique output
digests we get from the remote-run is > 1.

Bug: b/178842439
Change-Id: I0d50eed29b801be67a7ede9b25ce7f4535980f05
2021-03-17 14:22:05 -04:00
Lukacs T. Berki
5f6cb1d6d3 Compile soong_build for debugging if needed.
That is, when SOONG_DELVE= is set.

Test: "m nothing; SOONG_DELVE=port m nothing; m nothing"
Change-Id: I16bd4e54e81b93202573935df134d413feea9bb2
2021-03-17 15:03:14 +01:00
Lukacs T. Berki
d7ce8402d8 Remove GeneratingPrimaryBuilder().
It's replaced with a flag in bootstrap.Args .

Test: "m nothing" (presubmits take a full workday these days)
Change-Id: Ia0bfa2091013e389890e583c559006077806af99
2021-03-17 14:08:50 +01:00
Lukacs T. Berki
d1e3f1ff08 Embed minibp into soong_ui.
This requires linking Blueprint into soong_ui. It lets us avoid the
complicated dance of Ninja files and shell scripts: now the information
as to how soong_build is built is passed directly to Blueprint using a
struct that contains all the information the command line arguments used
to contain.

The ability to run Blueprint from the command line is kept (for now).

Some variables in bootstrap/command.go needed public accessor functions
because soong_build reads them. This will be disentangled by moving the
flag parsing to soong_build.

The presence of the flag definitions in Blueprint means that soong_ui
now also accepts them. This is not a problem in practice because they
are ignored and because soong_ui itself is hidden behind a few layers of
shell scripts.

Test: Presubmits + the new bootstrap_test.sh .
Change-Id: I6dca478f356f56a8aee1e457d71439272351390b
2021-03-17 08:35:52 +01:00
Lukacs T. Berki
21d5c7aaa9 Hard-wire the path to xcrun as /usr/bin/xcrun.
This lets us not leak $PATH to soong_build. It was only needed for
Darwin tests anyway.

Test: Will ask jingwen@ who has a Mac.
Change-Id: I4647e41275b323fe6283580f8f92718c6229f23e
2021-03-11 08:52:39 +01:00
Lukács T. Berki
2373e597ea Merge "Fix the environment of soong_build:" 2021-03-11 07:09:24 +00:00
Colin Cross
75a38ba791 Merge "Revert "Skip old file cleanup for non-full builds."" 2021-03-10 22:53:43 +00:00
Lukacs T. Berki
b4ced9d886 Fix the environment of soong_build:
- Incorporate BAZEL_* variables in soong.environment.available
- Set SOONG_DELVE when requested

Test: Manual.
Change-Id: I3ac675f4876220b788cc48d288b402ac6016c37b
2021-03-10 15:43:06 +01:00
Lukacs T. Berki
73ab928daa Make $PATH available when building soong_build.
This is exclusively used by tests so it's awful, but Darwin builds are
currently broken so let's unbreak them first then start thinking.

Test: "m nothing" on Linux (I don't have access to a mac OS machine)
Change-Id: I1ea9ca71a5aff36a3454282a4c87ad368138baaa
2021-03-10 11:02:39 +01:00
Colin Cross
41ad6b632f Revert "Skip old file cleanup for non-full builds."
This reverts commit 6e49493dac.

FULL_BUILD is not set during the config stage, so this never calls
cleanOldInstalledFiles.

Bug: 168105598
Bug: 182008128
Test: manual
Change-Id: I58a54f167763cdb77b3c1bd4f18f519fcaf8751a
2021-03-09 12:04:17 -08:00
Lukacs T. Berki
b14ad7b5dc Run Ninja in a clean environment.
This sandboxes Soong's tests better.

Setting "TOP" is slightly ugly, but doing it properly would conflict
with aosp/1609218.

Test: Manual ("m nothing")
Change-Id: Ie3d3cd17f116a5fe0ad25c670fc5ed9c33f8123b
2021-03-09 10:43:57 +01:00
Lukacs T. Berki
7d613bfe2c Make it possible to debug soong_ui.
This works by setting the SOONG_UI_DELVE= environment variable to the
port on which soong_ui should accept a Delve connection on.

This is achieved by reusing the Delve execution logic between soong_ui
and soong_build.

Test: Manual.
Change-Id: Id2c1d4b6faac1a4a3918c91030ce2239f7daf54f
2021-03-08 08:27:58 +01:00
Paul Duffin
5e85c665d0 Do not ignore error when writing environment file
Test: m nothing
Change-Id: I4281e22ae10a649b51b9fbed7f8c1554f18885b9
2021-03-05 17:46:29 +00:00
Lukács T. Berki
ddebd2c82a Merge "cd to / before running soong_build ." 2021-03-04 07:07:02 +00:00
Petri Gynther
ac22956dcb Rename vendor-ramdisk to vendor_ramdisk
Rename to get consistent ramdisk directory naming in
out/target/product/<name>:
  debug_ramdisk
  ramdisk
  vendor_debug_ramdisk
  vendor_ramdisk

Test: build and inspect out/target/product/<name>
Change-Id: Ib86e6509bd910e8c95bcb6e3f7bb639ebbfe3758
2021-03-03 00:15:54 -08:00
Lukacs T. Berki
7690c09953 cd to / before running soong_build .
This lets one avoid any decisions as to when to chdir there during its
execution and leads to better sandboxing because the pwd doesn't leak to
init() functions anymore.

Test: Manual.
Change-Id: I1560da8ed3a621249426f9e8908aa890c21e13ba
2021-03-03 09:14:22 +01:00
Colin Cross
fdf28ca403 Merge changes I3e6bc9b5,If9f8fb10
* changes:
  Disable TestSendLog on the buildbots
  Remove global state from VNDK apexes
2021-03-03 01:45:02 +00:00
Colin Cross
6cb1128b54 Disable TestSendLog on the buildbots
TestSendLog sometimes hangs on the buildbot, although it has never
been reproduced locally.  The cause appears to be a unix domain
packet that was sent but never received.  Skip the test in short
mode for now, which will leave it manually runnable but not run
it as part of the build.

Fixes: 120596545
Test: m nothing
Change-Id: I3e6bc9b5f1d9c15dc9a7294d98cbd917d0637c44
2021-03-02 12:26:14 -08:00
Lukacs T. Berki
3243aa51eb Move environment staleness check to soong_ui.
Also delete the now-unnecessary soong_env binary.

Test: Manually. Also checked what happens when a used environment
variable changes.

Change-Id: Ib393e7f444e94819198c6cce4bcd8719d9fd9441
2021-03-02 09:32:49 +01:00
Bob Badour
02040de891 Add LOCAL_LICENSE_KINDS to build/soong
Added SPDX-license-identifier-Apache-2.0 to:
  Android.bp
  android/Android.bp
  android/soongconfig/Android.bp
  androidmk/Android.bp
  apex/Android.bp
  bazel/Android.bp
  bp2build/Android.bp
  bpf/Android.bp
  bpfix/Android.bp
  cc/Android.bp
  cc/config/Android.bp
  cc/libbuildversion/Android.bp
  cc/libbuildversion/tests/Android.bp
  cc/ndk_api_coverage_parser/Android.bp
  cc/ndkstubgen/Android.bp
  cc/symbolfile/Android.bp
  cmd/dep_fixer/Android.bp
  cmd/diff_target_files/Android.bp
  cmd/extract_apks/Android.bp
  cmd/extract_jar_packages/Android.bp
  cmd/extract_linker/Android.bp
  cmd/fileslist/Android.bp
  cmd/host_bionic_inject/Android.bp
  cmd/javac_wrapper/Android.bp
  cmd/merge_zips/Android.bp
  cmd/multiproduct_kati/Android.bp
  cmd/path_interposer/Android.bp
  cmd/pom2bp/Android.bp
  cmd/pom2mk/Android.bp
  cmd/sbox/Android.bp
  cmd/soong_build/Android.bp
  cmd/soong_env/Android.bp
  cmd/soong_ui/Android.bp
  cmd/zip2zip/Android.bp
  cmd/zipsync/Android.bp
  cuj/Android.bp
  dexpreopt/Android.bp
  dexpreopt/dexpreopt_gen/Android.bp
  env/Android.bp
  etc/Android.bp
  filesystem/Android.bp
  finder/Android.bp
  finder/cmd/Android.bp
  genrule/Android.bp
  jar/Android.bp
  java/Android.bp
  java/config/Android.bp
  kernel/Android.bp
  linkerconfig/Android.bp
  linkerconfig/proto/Android.bp
  makedeps/Android.bp
  partner/Android.bp
  phony/Android.bp
  python/Android.bp
  python/tests/Android.bp
  remoteexec/Android.bp
  rust/Android.bp
  rust/config/Android.bp
  scripts/Android.bp
  sdk/Android.bp
  sh/Android.bp
  shared/Android.bp
  symbol_inject/Android.bp
  symbol_inject/cmd/Android.bp
  sysprop/Android.bp
  tradefed/Android.bp
  ui/build/Android.bp
  ui/logger/Android.bp
  ui/metrics/Android.bp
  ui/metrics/proc/Android.bp
  ui/status/Android.bp
  ui/terminal/Android.bp
  ui/tracer/Android.bp
  xml/Android.bp
  zip/Android.bp
  zip/cmd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  finder/fs/Android.bp
  third_party/zip/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work

Change-Id: Ia47ca14f16b8c9f84f9d533a07e5b00e2c04e8d4
2021-02-06 04:23:21 +00:00
Jingwen Chen
eb76c4319d bp2build: fix running from clean checkout.
bp2build is a Soong mode that returns as soon as the BUILD files are generated. This causes it not generate the build.ninja file, which the Ninja process executing soong_build itself expects to produce as an output. If there isn't an existing build.ninja file generated from a previous build, GENERATE_BAZEL_FILES=true m nothing will fail.

This CL generates the expected files as a workaround, and also makes GENERATE_BAZEL_FILES=true skip the Kati/Ninja steps in soong_ui since they aren't needed.

Test: rm -rf out/ && GENERATE_BAZEL_FILES=true m nothing && m libc

Fixes: 178683777

Change-Id: I2515ef7961682d2be5f096ed24831cc185165a67
2021-01-29 22:33:25 -05:00
Kousik Kumar
1e4d5f3e67 Add FAILED: prefix to RBE Fatal error message
This error message it currently being
logged to stdout which goes to build.log file . We want it to be logged to
build_error.log file instead so that downstream systems that need to run
based on the error message will continue to work.

Test: Tested by running `m toybox` and ensuring that FAILED: prefix is
at the beginning of the line.

Bug: b/177221705
Change-Id: Ie0c9acee2739acf149384e33804b5fca3273c24f
2021-01-26 14:34:30 -05:00
Treehugger Robot
f9be4e07e1 Merge "Moving $OUT/vendor-ramdisk-debug.cpio.lz4 to intermediate dir" 2021-01-24 14:53:43 +00:00
Yo Chiang
d813f12473 Remove GKI artifacts on installclean
Bug: 177495407
Test: m installclean && GKI prebuilts under OUT dir are removed
Change-Id: I05f888376c7f2b253e9966c1a652063a6c4760d9
2021-01-22 00:16:47 +08:00
Bowgo Tsai
ae205c3e32 Moving $OUT/vendor-ramdisk-debug.cpio.lz4 to intermediate dir
Therefore, no need to remove vendor-ramdisk-debug.cpio.lz4
for installclean as it will not be installed to $OUT dir.

Bug: None
Test: make vendorbootimage_debug
Change-Id: Ib7fb9931c55a9bb24e5ca8c4a80bd72f7233c57f
2021-01-20 16:35:31 +08:00
Jaewoong Jung
6e49493dac Skip old file cleanup for non-full builds.
There are few build targets that don't generate an installed file list,
e.g. product-graph. Skip the old installed file cleanup step so that the
func doesn't complain about a lack of the list file.

Fixes: 168105598
Test: m product-graph
Change-Id: Ib7dce6b801979bb565b74d6355143bac23b84fe6
2021-01-05 16:47:04 -08:00
Jaewoong Jung
18aefc1977 Remove unnecessary snake case variables.
Test: m nothing + TreeHugger
Change-Id: I99f7162944daa6c57c6ae4763261e108bb5cb6b1
2020-12-22 12:38:35 -08:00
Patrice Arruda
175500f016 Merge "Read the proc status file when PID is given for metrics purpose." 2020-12-18 04:14:09 +00:00
Patrice Arruda
04157e186f Read the proc status file when PID is given for metrics purpose.
To measure the MaxRSS memory correctly, read the proc status file
under /proc/<pid>/status and extract the MaxRSS value from it. The
implementation is only available for Linux based distributions.

Bug: b/169453825
Test: go test
Change-Id: I32e3068fee7447f9ef5dfb5a8d8dcb6934e0af23
2020-12-17 14:52:14 -08:00
Patrice Arruda
589826bc1e Add and update comments in ui/metrics/metrics.go.
The metrics.go had missing comments and also did minor code refactoring
to be more in golang best practices.

Bug: b/172917718
Test: m nothing.
Change-Id: Id63e4af3f27b582fc13ef3f988ac5c8707fb9adf
2020-12-15 23:36:01 +00:00
Patrice Arruda
5c58b6410c Remove soong_metrics_proto from the import of the protobuf file.
No needed to define soong_metrics_proto since it is defined in
the Android.bp file.

Bug: b/172917718
Test: m nothing
Change-Id: Ib5f4cd6d06c08660803cf070da544e9c2d1dce1f
2020-12-15 19:41:40 +00:00
Patrice Arruda
48d55ad2db Add setup_tools performance metrics to Soong protobuf file.
The setup_tools metrics has been missing since day one and is
needed to track down slowness of setting up the build system.

Bug: b/175706305
Test: m nothing and ran the printproto command to check that the
      setup_tools field has been set.
Change-Id: Idc8a38fa830e0a906170feeede63435715eaa05b
2020-12-15 19:39:09 +00:00
Treehugger Robot
a767196955 Merge "Add and update comments in ui/metrics/event.go" 2020-12-15 15:58:03 +00:00
Patrice Arruda
8a44a37623 Add and update comments in ui/metrics/event.go
The event.go code was refactored to follow the best practices
of golang code style.

Bug: b/172918681
Test: go test ./ui/metrics
Change-Id: Ic57d7cd576a9b146530ae37f03f4f5679d6cffef
2020-12-15 03:01:24 +00:00
Patrice Arruda
05ab2d0731 Enable bazel profiling in soong_build.
Bazel is executed several times during the execution of soong_build.
For each bazel execution, generate a profile and save under the
BAZEL_METRICS_DIR which is defined in soong_ui.

Bug: b/174479924
Test: * USE_BAZEL_ANALYSIS=1 USE_BAZEL=1 m nothing and checked
        if the cquery and graph build bazel profiles were generated.
      * Verified that the generated bazel profiles were uploaded
        to the local dev metrics pipeline.

Change-Id: I3d20204484dc6c5a1525a5d3eec1d62cfb33535b
2020-12-14 18:48:11 +00:00
Treehugger Robot
8574ae773f Merge "Allow Bazel to write to an external DIST_DIR (outside of OUT_DIR)." 2020-12-11 05:16:32 +00:00
Rupert Shuttleworth
3c9f5ac787 Allow Bazel to write to an external DIST_DIR (outside of OUT_DIR).
Also get Bazel to write real files there (not symlinks) so that the DIST_DIR can be independent.

Test: Manually using e.g. DIST_DIR=/tmp/foo USE_BAZEL=1 m dist
Change-Id: I39d5219500864c9ecc85f356a028e9b5bf2607f4
2020-12-11 01:17:58 +00:00
Patrice Arruda
7d235cc24d Allow uploading a directory of metrics files.
The upload functionality now supports directories to be uploaded
for metrics purpose.

Bug: b/174479728
Test: Wrote unit test case.

Change-Id: I6906be4c1b7fd76ddf6ff7b94e48fe1c4209c59d
2020-12-10 21:48:05 +00:00
Treehugger Robot
5839c91074 Merge "Provide an interface for shared paths between Soong and Soong UI." 2020-12-09 17:31:02 +00:00
Rupert Shuttleworth
0bc9a9ad6b Add dependency checker special case for out/build_date.txt.
Test: Future TH presubmit.
Change-Id: I4f80cf12be4aa1a3040b38ac7c6bed593aefd65e
2020-12-08 23:28:25 +00:00
Patrice Arruda
83842d7235 Provide an interface for shared paths between Soong and Soong UI.
Code refactoring has been done for logs directory logic code since
the bazel metrics directory depends on the log directory. For builds
that did not specify a dist directory, the log directory is under
out directory. With dist, the logs directory is under <dist dir>/logs.
This matters for Android CI builds where the metrics files are
placed under logs directory. With this change, the bazel metrics
directory and corresponding files will be under <dist dir>/logs
directory for Android CI builds.

Bug: b/174479728
Test: * USE_BAZEL=1 m nothing (bazel_metrics dir in out dir)
      * m nothing (bazel_metrics dir deleted)
      * DIST_DIR=/tmp/build USE_BAZEL=1 m nothing dist (bazel_metrics
        is in /tmp/build/logs directory)

Change-Id: Ic9e1ff49a1964fcaaf801bde2c19f33597ca1db4
2020-12-08 20:24:14 +00:00
Rupert Shuttleworth
72f72b42cb Print both the implicit and explicit environment variables when running Bazel.
Test: Manually via USE_BAZEL=1 use_rbe m.
Change-Id: I9f0ac8875b47848fdea4ae97d107e4167c4a7f6e
2020-12-08 06:12:51 +00:00
Rupert Shuttleworth
561f2f2d96 Only print the Bazel command line once.
Test: USE_BAZEL=1 m and USE_BAZEL=1 use_rbe m.
Change-Id: I8413e92d91c906f884628bedac6955575cf86a1c
2020-12-07 09:59:13 +00:00
Rupert Shuttleworth
ead7ef6e3b Use lstat instead of stat to avoid permissions issues when creating symlinks.
Also refactor symlink code slightly and add some more error checking.

Test: Manually.
Change-Id: I75119707cdf497e5690ac57abd814c8f18cab1f8
2020-12-07 04:54:18 +00:00
Treehugger Robot
0ec64e5df7 Merge "Print the full Bazel command line (including env) for debugging purposes." 2020-12-07 04:52:37 +00:00
Rupert Shuttleworth
947ed97367 Print the full Bazel command line (including env) for debugging purposes.
Test: Manually ran USE_BAZEL=1 m and USE_BAZEL=1 use_rbe m and looked at the build output.
Change-Id: Idbfdf8b00458fbd4b684cb0c1b58d6515909293c
2020-12-07 04:50:29 +00:00
Treehugger Robot
840708e45b Merge "Remove obsolete environment variables from ninja.go allowlist." 2020-12-05 02:48:42 +00:00
Rupert Shuttleworth
411996ca50 Remove obsolete environment variables from ninja.go allowlist.
Test: N/A.
Change-Id: I717b31f2b68d2cac72cca33f04cfa3b6078cb8eb
2020-12-04 18:42:29 +00:00
Rupert Shuttleworth
ad532f21ab Allow RBE-related environment variables to be visible during Bazel action execution.
Test: Manually.
Change-Id: I1acfdd5f30b2e08288508da8136029e454316622
2020-12-04 11:27:54 +00:00
Anton Hansson
5e5c48b2b5 Add support for skipping just kati
The existing --skip-make flag disables both the config step and the kati
step in the build. Add support for a --skip-kati flag that skips just
the kati step, and refactor things so that the logic is shared between
these two.

Bug: 174315599
Test: TARGET_PRODUCT=aosp_arm64 soong_ui --make-mode --skip-kati;
      (verify soong.variables is regenerated)
Change-Id: I75b1910fc1c12fcda130e37b7bc4c050131c7b33
2020-12-02 10:39:50 +00:00
Treehugger Robot
d74b9c5728 Merge "Minor cleanup of soong.go." 2020-12-02 08:21:59 +00:00
Treehugger Robot
d8c099e12d Merge "Minor cleanup of build.go." 2020-12-02 02:29:08 +00:00
Rupert Shuttleworth
b7d971012a Minor cleanup of soong.go.
Test: TH presubmit.
Change-Id: Ic5b263aa1320d9f70a6749ed12cbdc477acd3067
2020-12-02 00:56:35 +00:00
Rupert Shuttleworth
eeb5caac78 Minor cleanup of build.go.
Test: TH presubmit.
Change-Id: I3a41130b25d39276162850e417f036f9ce6a2ec0
2020-12-02 00:49:03 +00:00
Treehugger Robot
bd8b0d26b2 Merge "Add and update comments in ui/build/upload.go" 2020-11-30 22:01:38 +00:00
Treehugger Robot
b21906cd70 Merge "Minor cleanup of environment.go." 2020-11-25 03:28:33 +00:00
Rupert Shuttleworth
1f304e674d Minor cleanup of cleanbuild.go (and partially build.go).
Test: TH presubmit.
Change-Id: I439c16687b1877d367ff3d0f27e30c9bac97ef58
2020-11-24 14:50:25 +00:00
Rupert Shuttleworth
80115fa6b0 Minor cleanup of environment.go.
Test: TH presubmit.
Change-Id: I89415d6b1219d2204b4fcce4b3a7456250cd0967
2020-11-24 13:16:30 +00:00
Jingwen Chen
cda22c9bb9 Refactor 'in_make' to mean Kati is not skipped.
In Nougat and before, Make wrote a marker file to indicate that
soong_build was invoked from Make to change certain behaviors of Soong
at build time.
https://cs.android.com/android/platform/superproject/+/android-7.1.2_r36:build/core/soong.mk;l=70-73;drc=ae18638b0406ad107b0882a02a13cdd8b92f2a4e

Things have changed, and now soong_build is invoked from soong_ui, which
supports a --skip-make configuration flag:
https://cs.android.com/android/platform/superproject/+/master:build/soong/ui/build/build.go;l=31-33;drc=680387bf1d3ce7cbc77f535be7c42cec411b1687

Thus, the various remnants of 'EmbeddedInMake' and 'inMake'
configuration are misleading, since soong_build is no longer invoked
from Make. This CL refactors all instances to actually mean that
Kati is enabled (not skipped with --skip-make), and will run after
soong_build finishes, so Kati-specific behavior like the AndroidMk
singleton should run.

Test: TH presubmit

Change-Id: I576ab8e54f99f5c8ddf9feaf9a828019b279e266
2020-11-23 00:29:18 -05:00
Treehugger Robot
5898d56912 Merge "soong_ui ninja.go: comment and refactor." 2020-11-22 20:15:46 +00:00
Jingwen Chen
9d1cb491c3 soong_ui ninja.go: comment and refactor.
On top of improving the comments, I also refactored the status checker
to simplify and clarify its use case to be a ninja stuckness checker,
since it doesn't appear to have other purposes.

Test: TH presubmit
Bug: b/173474588
Change-Id: I2cf51a1ebf16071a24a1c13c06c7b1adf60256de
2020-11-21 07:37:28 -05:00
Jingwen Chen
55e0022fc0 Merge "soong_ui path.go: improve comments." 2020-11-20 04:47:51 +00:00
Jingwen Chen
19362b16c3 Merge "soong_ui kati.go: write more comments." 2020-11-20 04:46:18 +00:00
Jingwen Chen
b1d30d63c5 soong_ui kati.go: write more comments.
This CL also removes --warn_real_to_phony and --warn_phony_looks_real,
since --werror_real_to_phony and --wrror_phony_looks_real are already
specified.

Test: treehugger
Bug: 173474588

Change-Id: Icbb0f53182d1b912c62f8044f52bb79d985bf868
2020-11-18 22:16:08 -05:00
Jingwen Chen
6a9bfa122a soong_ui path.go: improve comments.
Test: th presubmit
Bug: 173587901
Change-Id: Ic30fa88ee84cbc48860a7500223432c720039810
2020-11-18 22:13:23 -05:00
Jingwen Chen
db892410f7 Merge "soong_ui finder.go: improve comments/documentation." 2020-11-18 07:53:56 +00:00
Jingwen Chen
27a8719b0f Merge "Integrate bazelenv.sh environment variables into soong_ui environment." 2020-11-18 04:53:22 +00:00
Jingwen Chen
096a3bf08f soong_ui finder.go: improve comments/documentation.
Test: m
Bug: 173474588
Change-Id: I947a34b3d9a5b2cd36fba293b55860a20a11d40b
2020-11-17 19:48:31 -05:00
Jingwen Chen
7c6089ad95 Integrate bazelenv.sh environment variables into soong_ui environment.
This removes the need to source bazelenv.sh for USE_BAZEL_ANALYSIS, and
unifies mixed builds to use the checked in tools/bazel and bazelrc.

It also unifies all bazel-related output to be in out/bazel.

Without aosp/1502095, this change still requires toplevel_output_directories to be an empty
list, otherwise there'll be this error:

ERROR: Directories specified with toplevel_output_directories should be
ignored and can not be used as sources.

Test: With aosp/1441774: rm -rf out/ && lunch aosp_cf_x86_auto && USE_BAZEL_ANALYSIS=1 m libc && prebuilts/build-tools/linux-x86/bin/ninja -f out/combined-aosp_cf_x86_auto.ninja -t commands libc | grep bazel-out | wc -l # 2 results
Change-Id: I69b217ec88da531415792bb6e04b6a194ca4718d
2020-11-17 18:58:03 -05:00
Jingwen Chen
7a5391a979 soong_ui's bazel.go: document/comment with tiny refactoring.
This patch adds information behind the Bazel USE_BAZEL=1 execution
pipeline.

Test: m
Bug: 173474588
Change-Id: I54bdd26fb14c8a371de0922d193419112e8c3ece
2020-11-17 03:46:23 -05:00
Patrice Arruda
92dc64f9c8 Add and update comments in ui/build/upload.go
Bug: b/172918852
Test: go test .
Change-Id: I63ca307e3935fc5a91a550889601397300ba395e
2020-11-16 16:29:16 -08:00
Jingwen Chen
3a4b58dc5d Set PATH and --action_env=PATH for the Bazel build in soong_ui.
Ensures that Bazel and Ninja are using the same binaries from PATH, such
as `sort` from the linked bug.

Test: USE_BAZEL=1 m
Test: rm out/soong/apex/depsinfo/new-allowed-deps.txt && USE_BAZEL=1 m
Bug: 161074854
Fixes: 161074854
Change-Id: Icc3e717e6d3cfcecfe90f0fb3a94a86485a11918
2020-11-16 04:47:14 -05:00
Patrice Arruda
33e7f6a0ca Remove unnecessary break and default statements in metrics.go file.
break and default statements are not needed inside of a switch
statement.

Bug: b/173028918
Test: USE_BAZEL m nothing
Change-Id: I14aa8cbae3a9b3c859f147c5134600f1e75c6a89
2020-11-13 13:15:09 -08:00
Patrice Arruda
b7cf9ba175 Add tracer to runBazel function.
Added a tracer named "bazel" in runBazel function to capture topline
metrics when running bazel.

Bug: b/173028918
Test: * USE_BAZEL=1 m nothing and checked soong_metrics file using
        printproto command to verify that bazel topline metrics
	were captured.
Change-Id: I5cb0728a4da48545dc701cc79627c318d5d9a29d
2020-11-13 13:14:51 -08:00
Patrice Arruda
18cb70d645 Enable bazel metrics from ninja build.
Generate the bazel profile file that contains the metrics of
executing the ninja build phase of Soong.

Bug: b/173028918
Test: * m nothing and check out dir that there is no bazel_metrics dir.
      * USE_BAZEL=1 m nothing and checked
        out/bazel_metrics/build_bazel_profile.gz existed.
      * m nothing and checked out/bazel_metrics does not exist.
Change-Id: I797d1eecf5c2c260ade8b55dc69c237bfd0fcbd4
2020-11-13 11:37:06 -08:00
Patrice Arruda
af880da0c4 Define the bazel_metrics directory in $OUT.
$OUT/bazel_metrics directory is created in order to dump the
set of bazel profile files being created from a single build
execution. The directory is created from soong_ui.

Bug: b/173028918
Test: * m nothing and check out dir that there is no bazel_metrics dir.
      * USE_BAZEL=1 and checked out/bazel_metrics was created.
      * Ran m nothing and verified that out/bazel_metrics directory is
        deleted to ensure no metrics is uploaded or collected from the
	pipeline.

Change-Id: I1d3c2471065fae6931f35cef7f0f35fd84f76bef
2020-11-13 11:16:21 -08:00
Patrice Arruda
0c1c456643 Define UseBazel in Config
The UseBazel() function will be used in several places to perform
different functionality such as setting up the metrics path.

Bug: b/173028918
Test: m nothing
Change-Id: Ie94073b8f0552ec7528e1cc2f3be74b693dc3135
2020-11-13 11:16:21 -08:00
Jingwen Chen
a26ac3caee Export Ninja file paths to lunch repo rule from bazel.go
This ensures that the lunch repo rule always reads the right Ninja file.

Test: USE_BAZEL=1 m
Test: m

Change-Id: I7f670dd538f46c4dae5ea537b857ff04520b60e7
2020-11-12 08:01:33 +00:00
Rupert Shuttleworth
f8ae317d3e Allow extra startup and build args to be passed to Bazel.
For example: USE_BAZEL=1 BAZEL_STARTUP_ARGS="--batch" m

Test: Manually.
Change-Id: I76fa8e17d4a9ccb8dda9fca049113f434dacabbe
2020-11-10 02:06:30 +00:00
Jingwen Chen
8024c95ecc Add TODO bug number to stop hardcoding 'droid'
Test: N/A
Signed-off-by: Jingwen Chen <jingwen@google.com>
Change-Id: I0d60cc4254b3a358085d89e443bd3bfc33b68ed3
2020-11-09 07:03:56 +00:00
Patrice Arruda
bb42c44e71 Merge "Collect useful resource information of each executed process in soong_ui." 2020-11-05 17:17:43 +00:00
Christopher Parsons
fde53fff96 Merge "After bazel execution, symlink results in out/" 2020-11-05 14:54:47 +00:00
Jingwen Chen
70b7eeed1c Move hardcoded bazel flags from soong_ui to common.bazelrc.
Test: USE_BAZEL=1 m
Signed-off-by: Jingwen Chen <jingwen@google.com>
Change-Id: Ib675dba8bfaf615bf3752a4bb4531b818526f267
2020-11-05 03:31:28 -05:00
Chris Parsons
c09495bf96 After bazel execution, symlink results in out/
This ensures that USE_BAZEL=1 mode has the same directory structure
under out/ as it does without USE_BAZEL=1.

Test: Manually verified building USE_BAZEL=1 aosp_flame with droid and
libc

Change-Id: I27e810772d1bf04bd7930ea122217b93d2fd48b4
2020-11-04 20:56:14 -05:00
Patrice Arruda
ca221f3e6d Collect useful resource information of each executed process in soong_ui.
Collect the resource information of each executed process in soong_ui
for metrics analysis.

Bug: b/169453825
Test: m nothing; "lunch 1" && m
Change-Id: I8c7fe019111921c4c59174d133b85439ec825885
2020-11-04 23:35:43 +00:00
Jingwen Chen
ebb0b574c8 Add dependency on dexpreopt.config to soong_build doc generation.
This was caught while running the soong_build docs action under Bazel as
ninja executor. Since the config file is not an explicit input to the
action, it's not present in Bazel's execution root during action
execution time, leading to a missing file error. To fix it, add the file
as an input to the action, if it's configured in product variables.

New soong_build statement:

build out/soong/docs/soong_build.html: s.writedocs.soongDocs $
        out/.module_paths/Android.bp.list out/soong/soong.variables $
        out/soong/dexpreopt.config | out/soong/.bootstrap/bin/soong_build
    outDir = out/soong/docs

Test: m
Test: USE_BAZEL=1 m
Bug: 161958189
Fixes: 161958189
Change-Id: I2bf264e848bb29ac91f4196fbe9c4ecf3cea8a2c
2020-11-04 01:51:40 -05:00
Treehugger Robot
d3e294d8ac Merge "Add --skip-soong-tests argument to soong_ui and use it in multiproduct_kati" 2020-11-02 21:31:31 +00:00
Colin Cross
00a8a3f746 Add --skip-soong-tests argument to soong_ui and use it in multiproduct_kati
There is no need for multiproduct_kati to run the tests for
every product, they don't vary by product config. --skip-soong-tests
can also be used for local development to run soong_build even if
the tests don't pass.

Bug: 156428456
Test: m --skip-soong-tests nothing
Change-Id: I9c00e3d1b6e51d17bb290339c3f124d4d1c9e69f
2020-10-29 14:22:04 -07:00
Patrice Arruda
e92c30dff1 Capture the build command that executed the build system.
We need to capture the user build command to understand what additional
arguments is passed in to Soong. This data is useful to know which
targets are being executed and have statistics on top build targets
are specified.

Bug: b/169453712
Test: ran "m blueprint_tools", "m nothing", "lunch 1" and checked
      in soong_metrics proto.
Change-Id: I7ab94dcf037211f1abffe6afd012b03ffbf99756
2020-10-29 11:01:32 -07:00
Rupert Shuttleworth
680387bf1d Add code to enable USE_BAZEL=1 m functionality in AOSP.
Test: Manually, but builds currently fail due to a recent change to bazel_handler.go.
Change-Id: I9a45a2c73d1755032b11f6b913c03f83a28f63c5
2020-10-26 09:23:24 +00:00
Treehugger Robot
78386129c0 Merge "Add stats from ninja subprocesses to build.trace.gz" 2020-10-21 22:52:24 +00:00
Treehugger Robot
0aedb1efe1 Merge changes I65a78260,I4b3cbbc3
* changes:
  Rename time to event in Soong metrics system.
  Add resource usage metrics in Soong metrics.proto.
2020-10-21 20:03:04 +00:00
Patrice Arruda
457c5d3426 Rename time to event in Soong metrics system.
Several structs and files are named time which records the total
execution of a traceable event. Soon, resource information of an
executed process is collected during a build event so a more generic
name is applied.

Bug: b/169453825
Test: go test and m nothing. Checked the soong_metrics protobuf.
Change-Id: I65a782603530d51018d6cc1192c18cfeef7566a0
2020-10-21 08:54:56 -07:00
Patrice Arruda
fec3bf2e2c Add resource usage metrics in Soong metrics.proto.
We would like to collect the resource usage of processes such as
kati, soong_build and ninja on the resource usage such as memory
and context switching. This changelist contains the defined fields
in the protobuf file of the resource information to be collected
from interested processes.

Bug: b/169453825
Test: N/A
Change-Id: I4b3cbbc3e7b78900875c10d34d574425f8b11730
2020-10-21 08:54:42 -07:00
Jingwen Chen
17958198a6 Merge "Add symlink_outputs support to Soong." 2020-10-21 08:59:16 +00:00
Treehugger Robot
d9052d177c Merge "Deprecate both USE_GOMA and FORCE_USE_GOMA flags" 2020-10-20 03:21:59 +00:00
Kousik Kumar
b328f6dc85 Deprecate both USE_GOMA and FORCE_USE_GOMA flags
Test:
m USE_GOMA=true GOMA_DIR=$(goma_ctl goma_dir) toybox
m FORCE_USE_GOMA=true GOMA_DIR=$(goma_ctl goma_dir) toybox
both result in error message being printed.

Change-Id: I94ccaf217dba71aca990d88d205bad669a49a2f5
2020-10-19 01:48:23 -04:00
Jingwen Chen
ce679d29ec Add symlink_outputs support to Soong.
This CL adds symlink_outputs to various locations in Soong that creates
actions that creates symlink outputs, and explicitly mark them as such.

Test: m
Bug: 160568334
Change-Id: I322751bada52a9f49011c74731d84761586e03e7
2020-10-19 01:26:50 -04:00
Colin Cross
d888b6b4fc Add stats from ninja subprocesses to build.trace.gz
Propagate the subprocess stats from ninja to build.trace.gz.

There is too much data here to put into separate counters for each
statistic, so put them into args on each duration event for now.

We would like to track max RSS for each subprocess, but the Linux
kernel inherits the max RSS of the ninja process in each subprocess,
which sets a lower bound on the measurable max RSS to the size of
the ninja process.  The ninja process is large due to the multi-GB
build.ninja files.

Bug: 170701554
Test: examine build.trace.gz
Change-Id: I8aaaafe627a57f1a500af098c097c6381c583ba5
2020-10-15 13:46:32 -07:00
Treehugger Robot
a9a427615b Merge "Add odm_dlkm and vendor_dlkm to the installclean list" 2020-10-14 21:37:19 +00:00
Colin Cross
ce4c7cd55d Add odm_dlkm and vendor_dlkm to the installclean list
Clean the odm_dlkm and vendor_dlkm staging directories in installclean
to get consistent results in incremental builds on the build servers.

Test: treehugger
Change-Id: Id431d7457d85e0be68437a2034fd544d74cc3709
2020-10-14 11:32:23 -07:00
Christopher Parsons
17e97d97e2 Merge "find bazel-related files and add them to bazel.list and ninja deps" 2020-10-14 16:27:25 +00:00
Patrice Arruda
3edfd48ef4 Collect total number of CPU cores and available RAM for each build.
Collect the total number of CPU cores and available RAM for each build
as part of the system resource info. This is to know what kind of
build machines that the developers are using.

Bug: b/169453825
Test: m nothing and ran printproto on soong_metrics to validate the
      data.
Change-Id: I8617bdb9490b37d7689abd27d349af1a651533db
2020-10-13 23:58:41 +00:00
Chris Parsons
a798d96076 find bazel-related files and add them to bazel.list and ninja deps
This retriggers soong_build whenever a new bzl, WORKSPACE, or
BUILD.bazel file is changed or added.

Test: Manually verified on bionic/libc genrules with manual changes to
related BUILD/bzl/WORKSPACE files -- these all retrigger builds.
Test: Updated finder_test.go

Change-Id: I634384f88781a6b6db32f5d6bf9c07e179e14c39
2020-10-13 16:18:59 -04:00
Treehugger Robot
585d7d4c2e Merge "Collect the hostname of the machine as a metric." 2020-10-13 18:07:51 +00:00
Patrice Arruda
1e2cad95c8 Add additional documentation in metrics proto regen.sh script.
Added additional instruction in the regen.sh script to build the
blueprint_tools and aprotoc in case the regen.sh script fails.

Bug: b/169395325
Test: ./regen.sh
Change-Id: Icb38c907fb47febc17eef1067d06d0588dd0b7ba
2020-10-12 22:58:27 +00:00
Patrice Arruda
4fb8adcc4c Collect the hostname of the machine as a metric.
The hostname is collected during a build to determine where the user
is build from (from office workstation, cloudtop, etc...). This is a
useful metrics for RBE related builds.

Bug: b/169395325
Test: m nothing, ran printproto to verify that soong_metrics has the
      hostname.
Change-Id: I3e5d64f948ae43c5dda60de1d4a52b187e36dff8
2020-10-12 22:44:27 +00:00
Treehugger Robot
79bb3d4784 Merge "Remove out/host/common/obj/PACKAGING during installclean" 2020-10-12 20:48:09 +00:00