Start a background goroutine at the beginning of soong_build that
captures the CPU usage, heap size, and total system memory every
second. Propagate the values through soong_build_metrics.pb back
to soong_ui, and then into build.trace.gz.
Test: m nothing, examine build.trace.gz
Change-Id: Iad99f8f1f088f4f7f7d5f76566a38c0c4f4d0daa
Make soong_ui read soong_build_metrics.bp to extract the event timings
and propagate them to Tracer, which will put them in build.trace.gz.
This provides much better visibility into what parts of the build are
contributing to the overly large analysis time.
Test: m nothing and examine build.trace.gz
Change-Id: I473727f1ec044b0d973f2cb4e3eaca96bfca94f6
Disable running the Soong tests when building on Linux. The tests
are still enabled when running on Darwin to ensure we have test on
Darwin in CI. Checkbuilds still depend on the tests, which will
provide test coverage in CI on Linux.
Bug: 269296618
Test: aninja -t path checkbuild out/host/linux-x86/bin/go/soong-java/test/test.passed
Test: m nothing
Change-Id: Ib8359ff6d2a92eeb2ac9a9e95ecd65abc4e40061
This reverts commit 182b56b870.
Reason for revert: prime suspect for breaking boot tests b/307495247, b/307411752
Bug:307495247
Change-Id: Iea05703b767d2699ca3cf69377eb44b1d21697ad
This change defaults Java stubs to be generated from API text files
during build. Using the `--build-from-source-stubs` flag, users can
toggle between the feature.
Test: m nothing && verify ninja path exists between android_stubs_current and android_stubs_current.from-text, and does not exist between android_stubs_current.from-source, m nothing --build-from-source-stub && verify the opposite
Bug: 274805756
Change-Id: I28834f92c1b1311e3fe0a71a6ea9e8ec2e278d7e
With https://team-review.git.corp.google.com/c/foundry-x/re-client/+/2045536, reclient is starting to use gcertstatus instead of prodcertstatus to check for validity of google prod creds.
I'll remove the allowlist for prodcertstatus in a subsequent CL after new reclient is released.
Bug: b/169675226
Change-Id: I0e760c863d534b7a5744daf5f89f530be3d296ff
This change removes the UNSAFE_DISABLE_HIDDENAPI_FLAGS env var setting
during from-text stub build, and enables hiddenapi list during from-text
stub build.
Test: ENABLE_HIDDENAPI_FLAGS=true m --build-from-text-stub
Bug: 275570206
Change-Id: Ic8cd60e376b978ccc658ff43a44d082eb2759fa5
This directory is where outputs are download first before being moved
to their final destination to ensure atomicity.
Change-Id: Ic224bf21c07566de00d292d02f1c0f7f727dcb08
When TOP dir changes and we reuse the same output between the old and new checkouts, we need to rewrite all the symlinks used by Bazel and other tools in the out-directory to point to the new top directory. Otherwise, if the old source dir is deleted, the build will fail.
I used the OUT_DIR/soong/soong.environment.available file to find out the previous PWD.
Tested:
1. Create source dir 1, run build, create source dir 2, remote source dir 1, reuse out dir and rerun build => build succeeded with this change.
2. m libc after moving build TOP. Only the analysis phase was rerun, the actual build was not rerun.
Bug: b/300498226
Change-Id: I196625baa1f4efe7a4734accfa1f0be7c98a7920
build_number.txt was generated in runKati, and runKati is run multiple
times throughout the build. If a build number is not set, then one will
be generated using the current timestamp, meaning that multiple
different build numbers will be used in different phases of the build.
Instead, generate build_number.txt during SetupOutDir(), so that we
only have 1 build number.
This is a resubmission with a change to ensure out/soong is created
before writing the build number file.
Bug: 297269187
Test: edit a bzl file to force bazel to rerun, change the code so that use_fixed_timestamp=true during partition builds, m installclean, m bazel_sandwich, and observe that the bazel/make partitions are byte-for-byte identical
Change-Id: I47abcca166c701bb66a6a7731aecad5818279244
build_number.txt was generated in runKati, and runKati is run multiple
times throughout the build. If a build number is not set, then one will
be generated using the current timestamp, meaning that multiple
different build numbers will be used in different phases of the build.
Instead, generate build_number.txt during SetupOutDir(), so that we
only have 1 build number.
Bug: 297269187
Test: edit a bzl file to force bazel to rerun, change the code so that use_fixed_timestamp=true during partition builds, m installclean, m bazel_sandwich, and observe that the bazel/make partitions are byte-for-byte identical
Change-Id: I5bf3bb6c78e7529749ca9275f67db3f2f9e66af2
To maintain good backwards compatibility with the legacy partition
building behavior, allow actions to read
BUILD_BROKEN_INCORRECT_PARTITION_IMAGES so that we don't have to rerun
analysis.
Bug: 205632228
Test: Presubmits
Change-Id: I2b55c0143cbdaf010e6b5fd0c3d51d6930a94eff
To maintain good backwards compatibility with the legacy partition
building behavior, allow actions to read
BUILD_BROKEN_INCORRECT_PARTITION_IMAGES so that we don't have to rerun
analysis.
Bug: 205632228
Test: Presubmits
Change-Id: I8b25a62f24bc6d628fb055239b084f6ea535e38b
This feature is obsolete.
This makes a large number of codepaths "dead code" (such as
module-specific implementations of ApiBp2build functionality). These
will be deleted in a followup CL.
Bug: 284029211
Test: Presubmits
Change-Id: Ib53b99f1fe8c24380d219caf44e9bb3b96724fa0
If NinjsReader keeps sending tool status messages after Close has been
called it can cause a concurrent map access when
CriticalPath.WriteToMetrics is called concurrently with
CriticalPath.FinishAction. Try harder to stop the NinjaReader goroutine
when NinjaReader.Close is called, even if the external ninja process has
not closed its FIFO or NinjaReader has not finished processing all the
messages after 5 seconds.
Bug: 286382228
Test: m nothing
Change-Id: I3e3dce601510e2dfb5ed82ca55bd11723fac7e70
Starting from Android V, vendor seapp_contexts files can't assign
coredomain to vendor apps, as it's Treble violation. This build broken
variable is to suppress the enforcement for devices launching with U or
prior.
Bug: 280547417
Test: set BUILD_BROKEN_VENDOR_SEAPP_USES_COREDOMAIN := true and build
Change-Id: Ic4b5309f0d9bab9b93e88988d1a5a942b2de220a
glob pattern could vary, depending on device configuration, but it uses
the same glob output path for now. It makes unnecessary soong
reevaluation due to the previous result is always overwritten whenever
the target is changed.
So make it product specific to avoid this.
And also let bootstrap.ninja use 'new' ninja file for globbing
Bug: 294378814
Bug: 294058160
Test: lunch a && m nothing && lunch b && m nothing && lunch a && m
nothing and then check if there is no glob work. (a and b has different
glob pattern due to RRO configuration or something)
Test: check if bootstreap.ninja include 'new' ninja file for globbing
Test: declare `cc_library { ... srcs: ["*.c"] }` && \
touch a.c && m nothing && touch b.c && m nothing && \
rm b.c && m nothing && mv a.c c.c && m nothing
and then check if m includes 'regenerate glob..' log.
Change-Id: I9337ae3b33cc2c0689f9731bbae5caae67612e3e
This reverts commit d93c67f64c.
Reason for revert: USE_RBE has again been made the default now, so we should no longer need this code.
Change-Id: I4163c61eed90163e763c29e07dd6edfc9c41b9b9
glob pattern could vary, depending on device configuration, but it uses
the same glob output path for now. It makes unnecessary soong
reevaluation due to the previous result is always overwritten whenever
the target is changed.
So make it product specific to avoid this.
Bug: 294058160
Test: lunch a && m nothing && lunch b && m nothing && lunch a && m
nothing and then check if there is no glob work. (a and b has different
glob pattern due to RRO configuration or something)
Change-Id: I7b6b7a326de681b046a55dbdb34d812cace510e6
Some versions of Fedora include patches to unzip to enable zipbomb
detection that incorrectly handle zip64 and data descriptors and fail
on large zip files produced by soong_zip. Disable zipbomb detection
inside the build.
Reported upstream in https://bugzilla.redhat.com/show_bug.cgi?id=2227130.
Bug: 286885495
Test: builds
Change-Id: I8e4438720bbb17a073ff3b5535f01c2827485838
Enabling the RBE variable can cause issues around pool parallelism when
we set the env variable, but don' run the build with RBE due to auth issues.
So, I am explicitly unsetting the variables in those cases.
Bug: b/292224253
Tested: https://b.corp.google.com/issues/292224253#comment26
Change-Id: I19718b4ee6c058ba1b11d3df260421bbf8c9567e
A heuristics is implemented in the build/bazel/scripts/bp2build_progress/bp2build_progress.py script to determine the reason for why a module is not converted.
Test: b build //build/bazel/scripts/bp2build_progress:bp2build_progress
Change-Id: I9d4eaf309dbf26bbb6de18e1af0d9cdc8fe09e94
even with USE_RBE=true.
These are alternate modes of soong_build that don't use rbe/reclient.
This lets us to remove USE_RBE=false from the bp2build run.
Test: presubmits
Change-Id: I439f9cf7e92ec85ca56baec5f62a83ee49b510d4
Often the slow commands (errorprone happens to be particularly bad)
print a lot, so this should make it easier to find the error without
lots of scrolling.
This doesn't attempt to parse the output and re-display errors, so
if a command prints a thousand warnings with one error in the middle,
it'll still be hard to find the error.
Bug: 277114612
Test: cd build/soong/ui/terminal ; go test
Change-Id: I6c8285fc2c6e4fc345de57b2c15bc5e7d46b1d1f
When there's no stubby and we are asked to use google prod creds, that's invalid configuration, so don't use RBE
Bug: b/283828386
Change-Id: I1564b4f70e46fb90c87a0432c46616caa1614aac
Use Go's generics for DepSets so they don't require a type-specific
wrapper and reflection.
Test: depsets_test.go
Change-Id: I22ba0b7d680d37d2cd05230b0f560d166c4dd20b
reproxy only requires LOAS credentials for authentication. Append the
-nocheck_ssh option to gcertstatus so we don't check ssh credentials.
Test: RBE successfully started after running gcertdestroy --nodestroy_loas2
Bug: b/287297140
Change-Id: I413931b10d8e8d9ae2f8acd7ebfe37d8b3bba455
The tags item in the trace data is arbitrary metadata added to `build`
steps by Soong (and my Kati via `.KATI_TAGS` target-specific
variables). Include this in the perfetto trace so we can analyze it.
Bug: http://b/259130368
Test: End to end test tracing cp time in dist targets
Change-Id: I85d33f579dc40dbae616b24cd4cb150d86262470
This is for integration with BES for bazel test metrics.
Bug: 287102416
Test: b build libcore:all --invocation_id=`uuidgen`
Test: build/bazel/scripts/analyze_build (to verify it's set)
Change-Id: I541b2d65bfa85718fc916582e0540384ae3810d9
This also changes the expectation of ConvertWithBp2build. Each
implementation must either create one or more Bazel target modules, or
mark the module as unconvertible (with a specific reason).
Manually verified no runtime hit in AOSP
In AOSP, the metrics file size increases from 252K to 1.6M
This changes some effective module counts in bp2build metrics:
- Removes "package" modules from the module count list in
metrics, as these will not be converted like regular modules.
- Counts Handcrafted modules as being "unconverted", as bp2build is not
responsible for them.
Bug: 285631638
Test: Verified generated BUILD.bazel files are bit-for-bit identical
with this change
Test: Manually verified one case of each implemented reasonType
Change-Id: I308dd451d8f28379b15671dae9f931bd0446f5c1
From the previous work on renaming build.ninja, it was found that there
are extra dependencies from build.ninja which can be varied by
TARGET_PRODUCT : which is soong.environment.used.<tag>. This change
renames soong.environment.used to have target product between 'used' and
'<tag>' if available.
Bug: 277029044
Test: Test confirmed that build.ninja is not being re-generated
Change-Id: I987b6bd1a8b4f06dac52537e4178d8556251d254
Test: Tested by following steps
1.m nothing: field is empty
2.USE_RBE=false m nothing: field log cc_wrapper and rbe_wrapper
3.USE_RBE=false m nothing: field is empty
Bug: 281922291
Change-Id: I1bbb324752b9a2dea1ff2c9df5817559d4cec3a6
In-order to automatically detect which type of authentication to use for
RBE, we need to be able to run these binaries in bootstrap. Hence
allowlisting them.
Bug: 283828386
Change-Id: I1e0e021acc8283ec3e66c96f6676c6095bf0892b
In non-incremental build, there is no ninja_log. For this case, use
HINT_FROM_SOONG as an alternative solution.
Bug: 273947040
Test: 1.m after removing out/.ninja_log
2.check if non-incremental CI build uses HINT_FROM_SOOONG
3.check if incremental CI build uses NINJA_LOG
4.check if there is no regression in CUJ
Change-Id: I00cd216df096cb2288eeab233729acefb0d1b73c
This allows USE_BAZEL_VERSION to be set for m builds, which will use
Bazelisk for any Bazel invocations during those builds.
This should be used only for manual debugging, typically to either test
new Bazel features, verify Bazel compatibility with Android, or culprit
find new Bazel breakages.
Test: Manually run builds with USE_BAZEL_VERSION, toggled off and on to
ensure the build was rerun. Tested with a broken commit, a working
commit, and 'last_green' special term
Change-Id: I8b475dca5c8d4bd849ee3724a8c3aca9b631bcb8
This reverts commit 6324647bcc.
Reason for revert: This change negatively impacts users running builds on gLinux laptops. Reverting to limit impact and reland with appropriate fix.
Bug: b/284985772
Change-Id: I04a3d0107bb3ea680ba6641240620736a2ef5f17
Prodaccess is apparently deprecated now.
Test: Build with/without credentials and check that it works
Change-Id: Iaadaebe84fe9531b2d7d5f0d265751462bb827d8
This code is no longer needed since we are now setting USE_RBE to true
for 100% of users (except two users, who I'll reach out to over email).
So fetching the configuration is no longer needed since sometimes this
can result in RBE config flipping between on and off (depending on
whether you have gcert or not).
Tested: Ran the build with latest sync and ensured RBE was used for the
build.
Bug: b/283828386
Change-Id: I3cda78607b46a0e161b7841560dc587a44d91f27
Current build.ninja does not contain any product name, while other ninja
files (such as combined ninja) do. This change adds product name to the
build.ninja so it can be separated over multiple lunch targets
Bug: 277029044
Test: build succeeded and checked if out/soong/build.ninja has been
renamed
Change-Id: I16dc71f829fd76f01b98da0d509a8e0ef6f62fa9
`rm -rf out` used to fail because bazel would not set write permission on some files. Now it's been fixed and thus there is little reason to prefer `m clean` (also users are accustomed to `rm -rf out`)
Bug: NA
Test: verified `m clean` works;interestingly soong_metrics file is created at the end
Change-Id: I000d16508613045811fc7792e5798f7c150dcc05
BUILD_NUMBER/HOSTNAME is passed by a file, not env variable.
To avoid kati recreation, unset BUILD_NUMBER/HOSTNAME after
writing it into a file
Bug: 278060169
Test: BUILD_NUMBER=1 m && BUILD_NUMBER=2 m (check there is no kati
re-run)
Change-Id: I5a31461dcf1e4b0634974bcb48a0d7482d42852a
* Extract BUILD_NUMBER, BUILD_HOSTNAME to file to avoid kati change
* Handle FILE_NAME_TAG_PLACEHOLDER string in dist in build/make/packaging/distdir.mk
Test: check if kati isn't invoked even though BUILD_NUMBER, BUILD_HOSTNAME
is changed
Test: m && m, and check if the second m is no-op
Bug: 278060169
Change-Id: I65eefc6bb86d4076098a1bf8b317b4cb88201499
As-is: Even with NINJA_LOG option, ninja weight list is copied from
ninja log
To-be: uses usesninjalogasweightlist to uses ninja log file directly
If weight list is large(more than 100,000 lines), reading the whole list
spends a few seconds(1-3s). It is ignorable in full build, but it might
be considerable in small build or m nothing scenario.
If weight list comes from ninja log, we can just directly read ninja log
data instead of writing weight list from ninja log outside, and read the
weight list. It doesn't spend additional time because ninja log is
loaded by default.
Bug: 271527305
Test: build with NINJA_LOG
Change-Id: Id7a4cca95898ce439d0a682f9bfd954b462f1849
This reverts commit f5c872f36b.
Revert reason: The original commit seems to have a performance regression for a number of benchmarked performance CUJs.
Bug: 283143307
Test: Benchmarking results. See attached bug.
Change-Id: Ib9463c8d30a5ba61640993424696a84e2e03040a