To improve build efficiency, the metrics for critical path and
parallelism ratio is necessary. That information has been included in
soong.log, so added it into metrics as well.
Bug: 271526845
Test: build and check if metrics pb has critical path info
Change-Id: I14e1a78c13d400b792d3b05df18604da48759ade
During a m nothing call; GoogleProdCredsExist check is called 3 times.
Each call is ~400ms so caching during the run will save ~800ms.
Test: time m nothing
Change-Id: I8a92c8fa48b22c7fb56be0f3c9cb5bf8787da6a9
Timeval has two fields: Sec and Usec, but in previous implementation, it
only uses Usec, so Sec data is abandoned.
Bug: 271526845
Test: check metric, and if seconds data is reserved.
Change-Id: I911467f77b41995f6c833099648fe62fbc9909eb
This feature is toggled on with USE_PERSISTENT_BAZEL, which is off by
default. Those that opt-in will have a bazel server running between
builds (with a 3hr default TTL) which will greatly improve analysis on
subsequent builds. (As Bazel maintains a cache of analysis results).
Bug: 266983462
Test: Manual `m nothing` runs (timing with and without the feature)
Test: New integration test
Test: Presubmits
Change-Id: I3af4948baa0c490e9b87c48ffdbe9f67732586c7
This contains the environment variables set by soong_ui during the ninja
execution. This file will be unused in single-tree builds, but will be
useful for multi-tree. The orchestrator will use this file to set the
correct environment for each inner tree build in the combined ninja
execution.
Test: m nothing compiles
Change-Id: I0570e34f51f426448464fb80030d4bea1cd52acb
This will be used to skip tests when related files (or nothing) has changed.
Also minor refactoring of evaluateWhatToRun to put the logic all in one place.
Change-Id: Ia56b251716f6b6640bc5526a597cf7c066231e99
Test: go test, m (with soong tests), manually verify
This provides an escape hatch to undo the effects of
aosp/2417672. It's an enviornment variable instead of
a product config variable because python is often used
during product config.
Bug: 203436762
Test: m nothing and get_build_var with aosp/2458935
Change-Id: I0dd0f7c221427ea487fd7993aef68ce803eaff21
Some linux environments export JAVAC for legacy compatibility and this
variable must be unset to ensure Soong and Make JAVAC values match.
Test: manual
Change-Id: Iae19fcb91b0a7651cbe00fe50f6daed54b4d7879
RBE adds a lot of time to m nothing builds,
so add status messages for it so that it's not misattributed
to some other part of the build.
Bug: 269644490
Test: m nothing
Change-Id: Ifff11bfc88f43b559526f3e3d3022c1388e42156
in a timely manner.
There should not be harm in bypassing fetchEnvConfig for this case
as the metrics uploader should not be present for invalid cases.
Bug: b/264905338
Test: b build libcore:all
Test: printfs to verify that upload.go has the variable set.
Change-Id: Ia7d03f25e74d4ec2d6cb83793b793a23b47f26de
Test: Run `m --bazel-mode-dev nothing` and query the database to make sure
soong_build_metrics will only update to its standalone column
Run `bp2build` and `b build` to make sure soong_build_metrics and
soong_metrics.soong_build_metrics will be null.
Bug: 262280865
Change-Id: Ice5115c468bda350b742c5a1d03fff66ad346cd6
This involved refactoring much of the main method in soong_ui/main.
Test: b build libcore:all
Test: use the build-time started flag and verify via printf that
it's the same across upload.go and metrics.SetBuildDateTimestamp()
Change-Id: Id7fe256337e8ee6c40542eba662c0eadb38e9674
This is to marshal Bazel metrics for the sake of uploading to the
Android metrics pipeline.
Test: m nothing
Test: run the regen script
Change-Id: Ia4eca879cff07425c389e30a385418f9865159d6
Test: m nothing
Test: m --bazel-mode-dev
Test: Verified soong_build_metrics is available in local metrics tables from builds that include this CL
Bug: 257537925
Change-Id: Ic5419ecb203c9b62457e1c553d592ba593a9bfff
Users can use this feature by
1. Setting PRODUCT_INCLUDE_TAGS += <val> in their product mk files
2. Set
```
blueprint_packge_includes {
match_al: ["<val>"],
}
other_module_type {name: foo}
other_module_type {name: bar}
```
bar and foo will be included if and only if <val> is set
Test: Unit tests in blueprint
Test: TH
Change-Id: I32eed4e3b5ac47fb565c62d13d8881fa984c86f4
When `SOONG_DELVE_STEPS` enviromnment variable is set in addition
to `SOONG_DELVE`, only given soong_build invocations ('steps') are
run in the debugger.
Also, make bootstrapBlueprint code table-driven.
Test: treehugger
Change-Id: Ia4016240ca9e88c2a85c6d06851c5bba30e7b2b5
This is a duplicate of aosp/2313558 - this failed due to
a double-commit occurring somewhere in the chain.
Test: m nothing
Test: b build libcore:all
Change-Id: Ie5f1029429fa31170d1051ca3e7fc038ef637702
The link here named a heading that has been changed, and so no longer works.
Instead use a dedicated go link for this purpose.
Test: none
Change-Id: Icea2fe330d8c777593802d561afd5aa0f76c9ed0
Bug: b/258870895
Test: run `m --bazel-mode nothing && touch bionic/docs/BUILD.bazel && m --bazel-mode nothing` Then verify symlink_forest reran and `out/soong/workspace/bionic/docs/BUILD.bazel` does NOT exist
Change-Id: I49797fe52b3e0fb6ffe17ed57b8da0b69628fd7e
Add a new argument in soong_ui that will be used to gate this behavior.
This approach is expected to solve incrementality issues in multi-tree.
As part of soong's bootstrap process, all source dirs are added to deps
of out/soong/build.ninja (via globs). Since multitree_build writes to the
"source" api_surfaces directory, it changes its mtime and causes a
recompilation of out/soong/build.ninja in the subsequent invocation.
Test: TH (for single-tree)
Test: Inspected ninja files (for multi-tree)
(Run a full build)
touch out/api_surfaces/vendorapi/libc/.../math.h
orchestrator/prebuilts/build-tools/linux-x86/bin/nsjail --config
out/trees/vendor_aosp_cf_arm64_phone/nsjail.cfg --
prebuilts/build-tools/linux-x86/bin/ninja -f out/soong/bootstrap.ninja
-d explain -n out/soong/build.ninja
(ninja: no work to do)
Change-Id: Ib823163ec1153344a2f593daa8d7156c24ff5bc3
This ensures that soong_ui is successful in setting up its own nsjail in
workflows that externally make the source tree ReadOnly (e.g. a nested
nsjail in multitree).
Test: TH
Change-Id: I6d0ec4a9fffda1d4e5996f475da611e1deb0888d
Bazel is expected to generate some files and symlinks that will not be
created by aquery, we explicitly ignore files that are in bazel output
paths but are not in a generated file directory.
Test: $ m --bazel-mode-staging checkbuild and verify it gets past
dangling rule test
Fixes: 258396112
Change-Id: I6dc45ea2613c9e1488ad3eda2313033c717217ff
The following environment variables are no longer used when generating
sdk snapshots:
* SOONG_SDK_SNAPSHOT_PREFER - we can control the modules that are
preferred at build time now.
* SOONG_SDK_SNAPSHOT_USE_SOURCE_CONFIG_VAR - this is done as a
post-processing step by the mainline_module_sdks.sh script to avoid
having to regenerate the ninja files for every module.
* SOONG_SDK_SNAPSHOT_VERSION - support for this was removed a long time
ago but was still referenced from dumpvars.go.
Bug: 259095197
Test: m nothing
# Searched for uses of these variables but could not find any
# outside the build.
Change-Id: Id2b32b29ff6f09faffea43292f549ba13acd956d
This turns on Bazel-assisted builds for all Soong users.
If this CL breaks your build or your workflow, you may temporarily
disable Bazel mode by adding BUILD_BROKEN_DISABLE_BAZEL=1 to your
environment.
Test: TH
Test: Various off-band post-submit verification with "bazel staging
mode", which is an opt-in version of this feature.
Change-Id: Ifa44a79437ce76ea739ed661d4e2d567e0f4a4d5
This will make it easy to change a "false" boolean to "true" to push
`--bazel-mode` by default for all users.
Users may disable bazel-by-default with BUILD_BROKEN_DISABLE_BAZEL, and
bazel is disabled by default on Darwin hosts (due to lack of test
coverage).
Bug: 254628592
Bug: 254084584
Test: Presubmits
Test: Presubmits for aosp/2263623
Change-Id: Iec712119e06ca8ec93028207d88277f879184cc2
Bug: b/256037411
Test: run mixed build twice and ensure soong_build_metric.pb file is absent on second run.
Change-Id: Ia11d850e1ad318e6383d8b392f20420259bc2f4d
Bug: b/256212479
Test: Prior to thi CL bp2build.symlink_forest event was missing in bp2build_metrics.pb after a clean mixed build
Change-Id: I53bfc4114a383c0d1f9c4c7945e7d4c69bc50b0c
This helps with incrementality a lot: the symlink forest must depend on
almost every directory in the source tree so that if a new file is added
or removed from *anywhere*, it is regenerated.
Previously, we couldn't do this without invoking bp2build, which is
quite wasteful because bp2build takes way more time than the symlink
forest creation, even though we do the latter in a very suboptimal way
at the moment.
This means that if a source file is added or removed (which does not
affect globs), we don't pay the cost of bp2build anymore.
Also refactored symlink_forest.go on the side. Too much state was being
passed around in arguments.
This change reimplements aosp/2263423 ; the semantics of not touching an
output file is the exact same as order-only inputs and the latter is a
bit fewer lines of code.
Test: Presubmits.
Change-Id: I565c580df8a01bacf175d56747c3f50743d4a4d4
Improves some error messages that would have given little/no information
Bug: 254650145
Test: relevant unit tests
Test: Induce errors and check metrics proto
Change-Id: Ife6116af74af6e62c2f8ae8774e53c28178fb8d0
OUT_DIR may not be in TOP (where the source tree is).
Test: presubmits
Test: set OUT_DIR=$HOME/out1; m --bazel-mode nothing
Fixes: 254022328
Change-Id: I8cf9fe2da3cdc0ba5489dfbe41d9d32f06ace83d
This is to use bazel to build targets that are being prepared for an
incipient release to the prod mode allowlist.
Bug: 254265047
Test: m nothing
Test: m nothing --bazel-mode-dev
Test: m nothing --bazel-mode-staging
Change-Id: Ic78a59cf51dba83ef1ac26483586560ea9b24aaf
The build currently waits for bootstrap to return an error before
failing. This means if the user does not have LOAS credentials, they
will need to wait for boostrap to attempt to start reproxy (~10s) and
the gcert timeout time (5-10s), which will take ~20s to return an error and fail the build.
Test: - Ran m with no gcert and build failed in 2s
- Ran RBE_use_google_prod_creds=false RBE_use_external_auth_token=false RBE_use_application_default_credentials=true m with no gcert and reproxy started
Bug: b/251425073
Change-Id: Id7fe3d6095f083643aaf0ab8f32a34b7961c61e8
The generated Bazel workspace will only contain api specific targets.
This is feasible since these targets do not have any cross dependencies
with the targets in the bp2build workspace
The advantages of a new mode are
1. Does not pollute bp2build workspace with api targets
2. Does not block api targets with the current allowlist conversion
mechansims in bp2build
(In the future we might want to combine these two workspaces)
A Soong module type will generate a Bazel target if it implements
ApiProvider interface
Test: m apigen
Test: m nothing
Change-Id: I69c57ca6539f932e0ad554ce84a87fb7936fdba0
Revert submission 2164342-use-jdk17
Reason for revert: DroidMonitor-triggered revert due to breakage b/250426490
Reverted Changes:
Ib1a24e7ea:Update path for libjli.so
I3375bd4e4:Use the toolchain from JDK 17
I9183e5511:Use the toolchain from JDK 17
Change-Id: I28fc32290dd337b7d44bb98bc52956ee84f01aaa
Bazel at HEAD has a bug which causes Bazel to crash when HOME is set to
a relative path. We circumvent this bug by specifying an absolute path.
Also added some documentation on the significance of setting this HOME
value.
Bug: 248104019
Test: Presubmits
Test: Verified `m --bazel-mode-dev nothing` continues to pass with Bazel@HEAD
Change-Id: Id05c8dc322c8cca04f3d1caf44f5b04ffa96fd3b
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
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
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
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
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
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
This allows us to reuse existing infra to export to internal.
Test: b build //build/bazel/scripts/bp2build-progress:bp2build-progress
Change-Id: If4888f8f59d56ddf4e98bdb8456ca69ff7f78a49
Make sure the staging directory doesn't have stale file after
installclean.
Test: m installclean && ls $ANDROID_PRODUCT_OUT
Change-Id: Idcd7a883a6cba4b7eb1eb99751f5d03cba365a12
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
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
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
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
This log is not super useful to be honest, so avoid printing it to
stdout of the build.
Bug: b/236709761
Change-Id: Ic96130a285160b386df3afc269dd5ef97c7965bf
We had been doing this for actions, but not messages.
Test: m nothing && TERM=dumb m nothing
Bug: 235414673
Change-Id: I5c6c009490abe1d02a4ae2272bd1831bd7ca9f7f
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
This reverts commit b018b83664.
Reason for revert: Builds will start failing now since the gcert change is about to go in.
Change-Id: I81d36ce6bf4f7a9bc120b34d411f2cb4ec64e5eb
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
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
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
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
This allows us to track how much time is spent in Clang.
Test: TOOLCHAIN_RUSAGE_OUTPUT=/tmp/rusage.txt m
Change-Id: Ib2961904f363bc59bd9d928bb055a96740cb9f17
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
[ 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
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
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
The bpglob changes in build/blueprint submitted together with this
change make it necessary.
Test: Presubmits.
Change-Id: I3d19761ec1a199c2f77693a882f8744ce404c6de
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
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
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
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
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
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
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
Make smart status output automatically disable table mode when the
window size is not available.
Bug: 147310922
Test: status_test.go
Change-Id: Ic57e1efd742e869bb84b6a86b3014335f5a65d39
`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
- 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
--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