Commit graph

1029 commits

Author SHA1 Message Date
Saagar Jha
204beb184a Merge "Replace prodcertstatus with gcertstatus" 2023-05-30 11:12:43 +00:00
Kiyoung Kim
5500fc89c1 Merge "Rename build.ninja with product name" 2023-05-30 07:17:08 +00:00
Saagar Jha
f513b23ac4 Replace prodcertstatus with gcertstatus
Prodaccess is apparently deprecated now.

Test: Build with/without credentials and check that it works

Change-Id: Iaadaebe84fe9531b2d7d5f0d265751462bb827d8
2023-05-26 00:23:50 +00:00
Treehugger Robot
0cf043fd48 Merge "Open metrics visibility to script subpackages" 2023-05-25 18:58:37 +00:00
Kousik Kumar
6324647bcc Remove env config fetcher code
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
2023-05-25 15:23:29 +00:00
Kiyoung Kim
a37d9baa96 Rename build.ninja with product name
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
2023-05-25 10:09:45 +09:00
Chris Parsons
24e9eec800 Open metrics visibility to script subpackages
Test: N/A
Change-Id: Iee750369efa9138d0a3ada74549dde239f87396f
2023-05-24 18:07:18 +00:00
Usta Shrestha
6e1aa7830c simplify m clean
`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
2023-05-23 17:34:15 -04:00
Jeongik Cha
f2af38d2cc Unset BUILD_NUMBER/HOSTNAME in kati.go
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
2023-05-23 10:35:23 +09:00
Jeongik Cha
4e49bbde93 BUILD_NUMBER and BUILD_HOSTNAME doesn't affect kati regeneration
* 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
2023-05-22 12:22:18 +09:00
Jeongik Cha
d55347133f NINJA_LOG option uses usesninjalogasweightlist
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
2023-05-20 00:49:39 +09:00
Jeongik Cha
f2ecf7659e Enable NINJA_LOG as weight list source
Bug: 273947040
Test: m
Change-Id: I1a803f5c1da75235395fc594e4f9d17f48c55db8
2023-05-19 14:03:45 +09:00
Chris Parsons
fddeaff4a6 Revert "Turn on HINT_FROM_SOONG by default"
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
2023-05-17 22:30:34 +00:00
Treehugger Robot
abc2b2adb3 Merge "Turn on HINT_FROM_SOONG by default" 2023-05-15 14:36:05 +00:00
Joe Onorato
8ef13dbb0c Merge "TARGET_RELEASE is unavailable here, so don't print it." 2023-05-12 01:44:46 +00:00
Mark Dacek
923a40777b Merge "Refactor upload-only to process bazel metrics outside of upload.go" 2023-05-10 17:52:40 +00:00
Treehugger Robot
f47760461c Merge "Change bp2build converter of module "package"." 2023-05-10 17:38:19 +00:00
Joe Onorato
98e986542b TARGET_RELEASE is unavailable here, so don't print it.
Test: m
Change-Id: Iacb00db54882ed2578ca1aa1d8e71d5732fbe247
2023-05-10 05:56:57 -07:00
Wei Li
2c9e8d6128 Change bp2build converter of module "package".
1) Use attribute name "default_package_metadata" instead of
   "default_applicable_licenses" in packages to better describe its use.
2) Add a filegroup "default_metadata_file" in packages to search for
   METADATA file in each package.
3) Include "default_metadata_file" in each package's
   "default_package_metadata" attribute.

Bug: 275472038
Test: CIs
Change-Id: I645c013c39e3190fd96c4a549d39a331aced16bd
2023-05-09 17:37:04 -07:00
MarkDacek
733b77c2de Refactor upload-only to process bazel metrics outside of upload.go
Bug: 279987768
Test: m nothing
Test: b build libcore:all (with prints to verify similiar data)
Change-Id: I01d960a7215be30728c9e90f52c2455fd21cf1b8
2023-05-09 20:19:20 +00:00
Mark Dacek
3e63067b11 Merge "Add --bazel-exit-code parameter to soong_ui." 2023-05-09 16:26:46 +00:00
Jeff Hamilton
d27fedf8e9 Add TARGET_RELEASE to the banner printout
Test: run lunch with and without a release and confirmed it's printed
Change-Id: I67e86aa1328ae464a1bb10dfdcd8e024e72d77a8
2023-05-08 03:17:06 +00:00
MarkDacek
d33c2fd5a2 Add --bazel-exit-code parameter to soong_ui.
This is for use in tracking bazel exit codes from b invocations.

Bug: 279754118
Test: b build libcore:all (with prints to verify)
Change-Id: If36b5b73ff93cd15647e5c1c1f676e95137210ff
2023-05-04 21:27:34 +00:00
Cole Faust
0428f71b30 Remove "dumping rbe metrics" message
The issue where RBE was taking a long time has been fixed, so this
message isn't that important anymore, and it was overriding the last
ephemeral status message that soong output.

Test: Presubmits
Change-Id: I019f351a3307176ec7b4786d4387fde9061ba08b
2023-05-03 18:21:05 -07:00
MarkDacek
ed2253e8df Process bazel metrics prior to potentially exiting upload.go
This is a necessary step for running b on CI with metrics collection.

Bug: 280491043
Test: b build libcore:all
Change-Id: I37d621c38e3f891dd63e5977befa6ce6604487ea
2023-05-02 21:35:39 +00:00
Mark Dacek
4188a899dc Merge "Add bazel exit code to bazel metrics proto." 2023-04-28 19:40:52 +00:00
MarkDacek
18ed8a912b Add bazel exit code to bazel metrics proto.
Bug: 279754118
Test: N/A
Change-Id: I52558843f40bf54b75a4255b0a9d96e9dcaa81bc
2023-04-28 14:50:32 +00:00
Anton Hansson
c8cea365f3 Merge "Remove --skip-kati" 2023-04-27 11:26:50 +00:00
Anton Hansson
50151a7489 Remove --skip-kati
Not used anymore.

Test: No
Change-Id: Ide0d29b773583d6a8faff5b41a82d650cc2f9bcb
2023-04-26 18:09:02 +00:00
MarkDacek
f47e142ffd Refactor MixedBuildsEnabled and add --ensure-allowlist-integrity.
Currently, there is little verification around allowlisted modules
actually being mixed-built. This flag would allow us to verify
that a module allowlisted is mixed-built for at least one variant.

Bug: 278910100
Test: m nothing --bazel-mode-staging --ensure-allowlist-integrity
Test: m nothing --bazel-mode-staging --ensure-allowlist-integrity
--bazel-force-enabled-modules=com.google.android.neuralnetworks (This
fails, as expected)
Test: build/soong/test/mixed_mode_test.sh

Change-Id: Icd5976f4f44f1a8caca1e5247d986642f7995f97
2023-04-25 20:55:07 +00:00
Jeongik Cha
f5c872f36b Turn on HINT_FROM_SOONG by default
In most case, turning on HINT_FROM_SOONG improves build performance even
though a model is not so accurate. At least, it doesn't cause
performance regression (very likely)

Bug: 275458825
Test: m
Change-Id: Ie4ff69e68a93f6f0db3d060980657ae623816b2b
2023-04-14 00:53:24 +09:00
Ramy Medhat
c8f6cc24f9 Enable reclient cache directory.
The cache directory stores files that should persist between builds.
Currently it will contain reproxy.creds, which caches the authentication
mechanism and token used to make subsequent builds faster.

Test: m nothing build takes 7s
Change-Id: Iaaa20b92630405918e5e91e09eca6c798b8fc872
2023-04-03 09:56:10 -04:00
Treehugger Robot
bc2906efef Merge "Modify Soong to utilize from-text android.jar in build" 2023-03-29 20:31:20 +00:00
Treehugger Robot
998fdd7e37 Merge "support PRODUCT_SOURCE_ROOT_DIRS product variable" 2023-03-29 17:04:37 +00:00
Jihoon Kang
1bff0349d4 Modify Soong to utilize from-text android.jar in build
Context
- from-text android.jar files are built using Metalava, and these can be
  utilized in `decodeSdkDep` so that any modules that depends on APIs
  can be compiled using from-text android.jars
- This change removes dependency on source java files when compiling
  stub android.jar files

Implementation
- Modify java_api_library module to create system modules using the
  generated android.jar
- Replace modules in decodeSdkDep to link against java_api_library
  modules
- Add --build-from-text-stub flag to hide the feature behind a flag

Test: m --build-from-text-stub
Bug: 271154441
Change-Id: I104df595edc65c0006820d5ae5b15f1fb167e190
2023-03-28 21:53:45 +00:00
Jeongik Cha
56df091391 Merge changes from topic "b/273282046"
* changes:
  Add HINT_FROM_SOONG option for ninja weight list
  Add EXTERNAL_FILE option for ninja weight list
2023-03-28 03:51:20 +00:00
Sam Delmerico
98a7329d59 support PRODUCT_SOURCE_ROOT_DIRS product variable
Soong analyzes the entire source tree even though not every lunch target
needs to know about every module. For example, OEM sources can be
ignored for cuttlefish products. This functionality allows blueprint to
ignore a list of undesired directories.

Bug: 269457150
Change-Id: I1eec5d7b6a268cae4c633d8d89ed485598ebca45
2023-03-27 14:42:36 -04:00
Jeongik Cha
e114e60615 Add HINT_FROM_SOONG option for ninja weight list
If this option is set, Soong generates ninja weight list including
modules in HugeModulesList in allowlists.go

Test: m --ninja_weight_source=soong
Bug: 273282046
Change-Id: Id92b7f9f9e8152c1c46ae071c5821a479cf47bce
2023-03-23 01:45:27 +09:00
Jeongik Cha
518f3ea184 Add EXTERNAL_FILE option for ninja weight list
Test: m --ninja_weight_source=file,<file path>
Bug: 271527305
Change-Id: Ibeae4c757dff281be69486a9758dbee3584d9dec
2023-03-22 21:45:49 +09:00
LaMont Jones
80f7035dac ui: fix logic sense for multitree build
Bug: b/266730267
Test: treehugger, manual
Change-Id: I059a9b90ecb70de5965cb2fe3f8a1e16de46c116
2023-03-20 19:58:25 +00:00
Treehugger Robot
f4f034356e Merge "Resolve metrics_proto warning" 2023-03-17 21:46:55 +00:00
Usta (Tsering) Shrestha
9741785c4c Merge "python aprotoc instead of jq and textproto" 2023-03-17 14:13:18 +00:00
Usta Shrestha
47541bb1cf python aprotoc instead of jq and textproto
Bug: 273996308
Test: incremental_build.sh -c clean
Change-Id: I5b6c32667003010ccac5d3a46ac888f26788b3c5
2023-03-16 21:28:21 +00:00
Jeongik Cha
8d63d56ac6 Resolve metrics_proto warning
Bug: 271526845
Test: manually invoke internal protobuf presubmit
Change-Id: I79d1cc027e422fa1ca6106f5b45ef11045f6d486
2023-03-17 03:52:13 +09:00
Jeongik Cha
96d6227999 minor refactor ui/build/ninja.go
1. extract .ninja_log as const
2. log an error during reading .ninja_log

Test: m nothing
Bug: 271527305
Change-Id: I395dd8419620bfa9fad3af23c96e5a22ca44e2fb
2023-03-17 01:53:11 +09:00
Jeongik Cha
0cf44d5e8d Add --ninja_weight_source option
It has 3 options for now.
* ninja_log: uses ninja log file for data source
* evenly_distributed: pass empty list for ninja to consider every work as the same
* not_used: do not use critical path logic in ninja

In addition, I added the option in the metrics to track

Bug: 271527305
Test: m --ninja_weight_source=ninja_log|empty|not_used
Change-Id: Ib4c812c20606a34b17d3f0edb71057b477c4f90e
2023-03-16 19:52:27 +09:00
Jeongik Cha
767ce714bb Add time unit for CriticalPathInfo's fields' name
Bug: 271526845
Test: check metrics
Change-Id: Ie7e133033371906b29caad16d0b6bcd238b9f8db
2023-03-16 18:29:55 +09:00
Treehugger Robot
da4a78bf40 Merge "Add --multitree-build flag" 2023-03-16 02:34:22 +00:00
LaMont Jones
52a7243387 Add --multitree-build flag
Add a flag that enables logic specific to multitree-build builds.

Bug: b/266730267
Test: treehugger, manual
Change-Id: Ia6f392525faa9d66bb6e0692b2a2e9c3b8493b0d
2023-03-15 23:08:34 +00:00
Kevin Dagostino
24de5f2485 Merge "Cache GoogleProdCredsExist() to save ~800ms during builds." 2023-03-15 21:44:26 +00:00
Treehugger Robot
cd7db25738 Merge changes I7ec5a9f7,I76807f9b
* changes:
  Add docstrings for CriticalPathInfo
  Add long running jobs info
2023-03-15 07:26:40 +00:00
Jeongik Cha
cf833776a4 Add docstrings for CriticalPathInfo
Bug: 271526845
Test: n/a
Change-Id: I7ec5a9f7b39fd7441f1aac6556a77046a8210ae8
2023-03-15 12:54:14 +09:00
Jeongik Cha
4199d4796c Add long running jobs info
For the data to prioritize long running tasks in ninja, I added the
information about that.

Bug: 271526845
Test: build and check metrics
Change-Id: I76807f9b0d6a50d940b5f35dd6a9ef3cf693eec5
2023-03-15 12:46:58 +09:00
Jeongik Cha
58fa5a3f36 Merge "Add critical path infomation into metrics" 2023-03-15 03:40:11 +00:00
Jeongik Cha
28c1fe5bc8 Add critical path infomation into metrics
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
2023-03-14 17:59:22 +09:00
Kevin Dagostino
096ab2f5af Cache GoogleProdCredsExist() to save ~800ms during builds.
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
2023-03-13 05:58:04 +00:00
Treehugger Robot
bb7c61ff61 Merge "Use Sec as well as Usec in ProcResInfo" 2023-03-10 22:19:33 +00:00
MarkDacek
a18ba22ba9 Add branch and manifest info to soong_metrics.
Bug: 259303480
Test: N/A
Change-Id: I434e24250ff640fddfca93ecb91fdfa49710e2f2
2023-03-07 21:55:26 +00:00
Jeongik Cha
bd465cca8a Use Sec as well as Usec in ProcResInfo
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
2023-03-06 11:44:45 +09:00
Treehugger Robot
91108ad92a Merge "Add a post-build step for dist builds that records what changed in the build." 2023-03-02 18:53:38 +00:00
Christopher Parsons
7720f5704c Merge "Add a persistent bazel server between builds" 2023-03-02 14:22:34 +00:00
Chris Parsons
9402ca881c Add a persistent bazel server between builds
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
2023-03-01 23:30:19 -05:00
Treehugger Robot
732592c151 Merge "Create a ninja.environment file" 2023-03-01 03:22:31 +00:00
Spandan Das
2db59da973 Create a ninja.environment file
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
2023-02-28 23:49:22 +00:00
Joe Onorato
7f29a66586 Add a post-build step for dist builds that records what changed in the build.
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
2023-02-28 15:02:22 -08:00
Cole Faust
b1fbc79206 Add BUILD_BROKEN_PYTHON_IS_PYTHON2
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
2023-02-27 13:02:02 -08:00
Nathan Egge
7b067fb753 Add JAVAC to the list of env variables to unset.
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
2023-02-17 18:07:04 +00:00
Cole Faust
64955b32bf Add status messages for RBE and product config
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
2023-02-16 21:06:19 +00:00
MarkDacek
00e3152aca Write bazel metrics file from soong.
Test: b build libcore:all
Change-Id: I372d48a9c7132bc57ecc1a8ba06eb098d28cbad7
2023-01-25 22:43:14 +00:00
Liz Kammer
7c7409d57d Merge "Change visibility of bp2build proto for dir rename" 2023-01-25 14:26:19 +00:00
Treehugger Robot
a413e4d28a Merge "Fix config file fetching" 2023-01-17 19:29:03 +00:00
Kousik Kumar
c881833bda Fix config file fetching
1. Make config file fetching run in background again if a file already
   exists - this behavior was changed in
   https://android-review.git.corp.google.com/c/platform/build/soong/+/2059887
   by accident.
2. Always try to load a config file even if fetching a config file fails
   - this behavior was changed in
     https://android-review.git.corp.google.com/c/platform/build/soong/+/2380792
     iiuc.

Bug: b/207551843
Test: Ran builds with no config file present, with config file present
and confirmed that config file fetching happens in the background now.

Change-Id: I6321684a0e17df3371f3f415602e7fa33cfba454
2023-01-16 17:20:19 +00:00
Usta Shrestha
da15c61add metrics: count symlink/mkdir in symlink forest
Bug: 260029212
Test: inspect out/bp2build_metrics.pb
Change-Id: Ia84c095a8d7b129cca629256b6c626c726cbfab1
2023-01-12 14:52:56 -05:00
MarkDacek
7901e585bd Fix upload-only to retrieve the METRICS_UPLOADER variable
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
2023-01-10 20:17:22 +00:00
Jason Wu
205d1489fb Merge "Stop embedding soong_build_metrics in soong_metrics" 2023-01-10 02:53:16 +00:00
Jason Wu
41886f27aa Stop embedding soong_build_metrics in soong_metrics
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
2023-01-09 17:48:48 -05:00
MarkDacek
a3a62a37b4 Rename proto field.
Test: N/A
Change-Id: I97dd3bc26afcbef4ad69cb7a3cbad73bf34b5fe6
2023-01-04 22:04:44 +00:00
MarkDacek
6614d9cba3 Add upload-only mode and manual build-started-time flag.
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
2022-12-22 20:13:56 +00:00
MarkDacek
2ee2db3bf4 Add bazel metrics proto.
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
2022-12-20 18:34:22 +00:00
Paul Crowley
e7e9e09128 Merge "Fix go link given when stubby is absent." 2022-12-15 18:42:59 +00:00
Jason Wu
f0ec631046 Upload soong_build_metrics
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
2022-12-09 11:48:26 -05:00
MarkDacek
d0e7cd3d96 Add skip-metrics-upload flag to soong_ui.
Bug: b/261203925
Test: m libcore --skip-metrics-upload
Change-Id: I0b10027a0f359e682116c2ebb884808c65430dd0
2022-12-07 19:12:02 +00:00
Liz Kammer
798e96cc2c Change visibility of bp2build proto for dir rename
Test: CI
Change-Id: I3ba505c2e9fd23590531735ba6ae3aa003423cef
2022-12-06 09:51:17 -05:00
Spandan Das
c576383336 Create a new product variable to gate blueprint files
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
2022-12-05 19:15:06 +00:00
MarkDacek
d06db5dd5b Add command line flag for extra bazel-built modules
Test: m libcore --bazel-mode-staging --bazel-force-enabled-modules=libcore and find out/bazel/ -name libcore*

Change-Id: I065696d06ce07e05300a41e133867a6e7a891b5e
2022-12-02 21:16:11 +00:00
Mark Dacek
ea80b16cd9 Merge "Add build-command arg to soong_ui." 2022-12-02 19:16:02 +00:00
Sasha Smundak
4cbe83ad5e Allow choosing which soong_build invocations to run in the debugger
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
2022-12-01 21:12:11 -08:00
MarkDacek
b96561eed1 Add build-command arg to soong_ui.
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
2022-12-02 04:34:43 +00:00
Paul Crowley
4965dc0cc3 Fix go link given when stubby is absent.
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
2022-11-29 13:08:06 -08:00
Alexander Smundak
2f213d0946 Merge "Allow profiling Soong from the full build" 2022-11-22 18:52:25 +00:00
Paul Duffin
032734ca9f Merge "Remove support for unused env vars from sdk snapshot generation" 2022-11-22 15:56:04 +00:00
Sasha Smundak
faa97b7eb9 Allow profiling Soong from the full build
Test: treehugger
Change-Id: I5112364fff635b856a55744457f547d3eba91391
2022-11-21 10:56:51 -08:00
Treehugger Robot
bd12239355 Merge "remove dead Bazel code from soong_ui" 2022-11-16 15:27:42 +00:00
Sam Delmerico
d9a34353cf remove dead Bazel code from soong_ui
Test: CI
Change-Id: Ie9b56c59440ab63d421d19b382cf4f669a5ea215
2022-11-15 17:29:27 -05:00
Spandan Das
ed9729727c Merge changes from topics "nested-nsjail", "ro-api-surfaces-dir"
* changes:
  Special-case Soong finder to look in out/api_surfaces
  nsjail support verification should respect BUILD_BROKEN* flag for SrcDir
2022-11-15 19:56:23 +00:00
Usta (Tsering) Shrestha
4b67bb3013 Merge "re-trigger symlink-forest if bazel.list changes" 2022-11-15 16:09:56 +00:00
usta
40a8159a06 re-trigger symlink-forest if bazel.list changes
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
2022-11-14 17:50:08 -05:00
Spandan Das
394aa32e8b Special-case Soong finder to look in out/api_surfaces
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
2022-11-14 21:10:38 +00:00
Spandan Das
2d997046ba nsjail support verification should respect BUILD_BROKEN* flag for SrcDir
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
2022-11-14 19:50:40 +00:00
Liz Kammer
2af5ea85b0 Ignore bazel-generated paths in dangling rule test
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
2022-11-14 13:41:02 -05:00
Paul Duffin
82d75ade2a Remove support for unused env vars from sdk snapshot generation
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
2022-11-14 17:45:07 +00:00
Chris Parsons
035e03affe Flip on Bazel mixed builds by default
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
2022-11-01 19:27:50 +00:00
Treehugger Robot
8238ae869e Merge "Add groundwork to easily all-enable bazel-mode" 2022-11-01 18:24:40 +00:00
Chris Parsons
b6e9690776 Add groundwork to easily all-enable bazel-mode
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
2022-11-01 09:53:46 -04:00
usta
7f56eaa748 Fix collection of stale soong build metrics
Bug: b/256037411
Test: run mixed build twice and ensure soong_build_metric.pb file is absent on second run.
Change-Id: Ia11d850e1ad318e6383d8b392f20420259bc2f4d
2022-10-31 14:10:59 -04:00
usta
4f5d2c1e97 include symlink metrics in bp2build_metrics.pb
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
2022-10-31 11:38:10 -04:00
Lukács T. Berki
4bb30b59a9 Merge changes from topic "separate-symlink-forest-invocation"
* changes:
  Build the symlink tree on multiple threads.
  Create Bazel symlink forest in a separate process.
2022-10-28 07:05:00 +00:00
Lukacs T. Berki
c541cd27fa Create Bazel symlink forest in a separate process.
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
2022-10-27 08:08:45 +00:00
Romain Jobredeaux
0a7529b02c Log whether user explicitly disabled mixed builds in Soong metrics.
Test: unit tests
Bug: 254649740
Change-Id: I2d4080955e10fe4b50e335c97c79dddbdd22c170
2022-10-26 15:06:33 -04:00
Joe Onorato
934977cbbe Merge "Move bazel from being a shell function to being a script at build/bazel/bin/bazel" 2022-10-25 17:56:58 +00:00
Liz Kammer
f2a80c6396 Add non-zero exit + error message to soong metrics
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
2022-10-24 10:51:56 -04:00
Joe Onorato
ba29f380d3 Move bazel from being a shell function to being a script at build/bazel/bin/bazel
Bug: 254713799
Test: b build //packages/modules/adb/apex:com.android.adbd
Change-Id: I6a0a89438a46d8252c3e0c24319038b0cf2dbd59
2022-10-24 06:38:11 -07:00
Romain Jobredeaux
7c4ef0718c Merge "Add Soong metric variable to indicate whether bazel mixed build was force-disabled." 2022-10-21 18:22:02 +00:00
Mark Dacek
99db041a14 Merge "Add bazel staging mode to soong build." 2022-10-21 17:38:43 +00:00
Romain Jobredeaux
ea098efcd8 Add Soong metric variable to indicate whether bazel mixed build was force-disabled.
Test: unit tests
Change-Id: I17b96edd28ace5a29a6889d6f003b6a38dbeb68e
Bug: 254649740
2022-10-21 15:50:01 +00:00
Jingwen Chen
3b13b61d9d Don't rely on TOP+OUT_DIR as the location for OUT_DIR.
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
2022-10-21 09:39:12 +00:00
MarkDacek
b78465de1d Add bazel staging mode to soong build.
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
2022-10-19 15:57:18 +00:00
Steven Moreland
28d35a1f1e Revert "ninja error on missing files"
This reverts commit 10ea6214a1.

Reason for revert: b/254136231

Change-Id: I68884b0540557b9abc9e6661c1ff5dbeb7e9816d
2022-10-18 00:13:59 +00:00
Steven Moreland
10ea6214a1 ninja error on missing files
Bug: 253517226
Bug: 253694455
Change-Id: I24da473198958a0e82a5a6e10c3f3180bf5dcc41
Test: N/A
2022-10-17 21:28:53 +00:00
andusyu
838086f57a Fail the build before calling bootstrap if LOAS credentials are missing.
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
2022-10-13 23:19:50 +00:00
MarkDacek
0d5bca51b6 Add bazel paths to ninja deps.
Test: m nothing
Test: m nothing --bazel-mode-dev
Change-Id: I120e62ac3f2aa066aedaecf2a5d16c79f7097c76
2022-10-12 16:30:20 +00:00
Sorin Basca
538911b686 Merge "Revert^2 "Use the toolchain from JDK 17"" 2022-10-07 05:10:30 +00:00
Sorin Basca
7e094b33b7 Revert^2 "Use the toolchain from JDK 17"
This reverts commit be3a561aac.

Reason for revert: Reland switch to JDK 17
Bug: 233029164
Test: TH

Change-Id: Ifa69e3fd50b853153a9c23756269ff12e72d7e9f
2022-10-05 08:23:17 +00:00
Spandan Das
ee08eb3c81 Merge "Create a new mode in soong_ui to generate API only BUILD files" 2022-10-05 01:37:28 +00:00
Spandan Das
5af0bd3e48 Create a new mode in soong_ui to generate API only BUILD files
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
2022-10-04 17:32:56 +00:00
Treehugger Robot
02c1b12b1f Merge "Remove build failure with USE_BAZEL_ANALYSIS usage" 2022-10-04 15:20:21 +00:00
Ken Sun
44022c867d Merge "Revert "Use the toolchain from JDK 17"" 2022-10-03 03:17:13 +00:00
Ken Sun
be3a561aac Revert "Use the toolchain from JDK 17"
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
2022-10-03 03:12:41 +00:00
Sorin Basca
1ea00ebb3e Merge "Use the toolchain from JDK 17" 2022-10-02 19:36:17 +00:00
Sorin Basca
8eac0005c6 Use the toolchain from JDK 17
Bug: 233029164
Test: m
Change-Id: I3375bd4e4186c0049490ee3ddc0f85552d25b579
2022-09-29 11:34:52 +01:00
Chris Parsons
a9bef14e8d Set bazel's HOME to an absolute path.
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
2022-09-28 21:12:12 +00:00
usta
6fffdd5fa8 cosmetic: mark the determination of ui build steps
Test: m libc
Bug: N/A
Change-Id: I0e7ba9cfccfe1ecf005b55a5912d1b748c294926
2022-09-26 18:58:42 +00:00
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