Commit graph

1029 commits

Author SHA1 Message Date
Jeongik Cha
ccf37005ec Reland "Make glob output include product name"
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
2023-08-17 08:04:58 +00:00
Treehugger Robot
3537d8028a Merge "Disable zipbomb detection inside the build" into main 2023-08-09 22:04:03 +00:00
Kousik Kumar
97e9b0cb8e Merge "Revert "Revert "Remove env config fetcher code""" into main 2023-08-08 15:59:56 +00:00
Kousik Kumar
8036b163ef Revert "Revert "Remove env config fetcher code""
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
2023-08-04 19:46:16 +00:00
Paul Duffin
ff3fcd1f64 Merge "Revert "Make glob output include product name"" into main 2023-08-03 16:40:47 +00:00
Paul Duffin
d0e8180ea8 Revert "Make glob output include product name"
This reverts commit 03e50cb4d7.

Reason for revert: I think it broke globbing, see b/294378814

Change-Id: I7e81e8e591278bc2d6b6203b93f128351ca6a241
2023-08-03 15:50:16 +00:00
Treehugger Robot
4d730a8f14 Merge "Make glob output include product name" into main 2023-08-03 00:47:32 +00:00
Jeongik Cha
03e50cb4d7 Make glob output include product name
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
2023-08-02 11:00:01 +09:00
Colin Cross
fe5ed4d6e2 Disable zipbomb detection inside the build
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
2023-07-28 09:31:03 -07:00
Kousik Kumar
6d1e348cc3 Disable RBE env variable when we cannot support RBE
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
2023-07-24 17:06:42 +00:00
Treehugger Robot
4d9dbdab7a Merge "Add unconverted_reasons_from_heuristics fields to the Module message" into main 2023-07-13 22:45:17 +00:00
Ayush Budhwani
62efa1d650 Add unconverted_reasons_from_heuristics fields to the Module message
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
2023-07-13 13:31:09 +00:00
Jingwen Chen
d7ccde11d6 Don't use RBE for bp2build/queryview/api_bp2build/json_module_graph,
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
2023-06-30 09:32:32 +00:00
Treehugger Robot
10fb90c339 Merge "Ignore USE_RBE when on glinux laptops" 2023-06-26 15:19:58 +00:00
Lukács T. Berki
aa923b94ad Merge "Update tests for a changed status message." 2023-06-26 12:08:18 +00:00
Lukacs T. Berki
c14a86d1cf Update tests for a changed status message.
Test: Presubmit.
Change-Id: I55d82442ba80d4954b0d2e091ad98d27622a9eb4
2023-06-26 07:05:07 +00:00
Joe Onorato
eadb0fbee0 After a build action fails, stop printing more output.
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
2023-06-24 15:13:49 -07:00
Kousik Kumar
67ad434ffc Ignore USE_RBE when on glinux laptops
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
2023-06-23 18:43:54 +00:00
Usta (Tsering) Shrestha
a78884edf7 Merge "cosmetic" 2023-06-23 17:39:17 +00:00
Colin Cross
313d32f730 Merge "Use generics for DepSets" 2023-06-22 20:57:01 +00:00
Andus Yu
f3da8ee95b Merge "Do not check ssh credentials when running gcertstatus" 2023-06-22 19:38:33 +00:00
Dan Albert
2c59e46034 Merge "Include tags in trace data." 2023-06-22 16:37:36 +00:00
Colin Cross
c85750bfe3 Use generics for DepSets
Use Go's generics for DepSets so they don't require a type-specific
wrapper and reflection.

Test: depsets_test.go
Change-Id: I22ba0b7d680d37d2cd05230b0f560d166c4dd20b
2023-06-22 08:18:33 -07:00
andusyu
0b3dc03f9d Do not check ssh credentials when running gcertstatus
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
2023-06-21 17:30:21 -04:00
Dan Albert
e82234ed50 Include tags in trace data.
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
2023-06-21 20:17:57 +00:00
MarkDacek
396491eee4 Add bes-id to soong. Also renames the proto field.
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
2023-06-21 14:48:17 +00:00
Lukacs T. Berki
c357c81f48 Handle errors from RunBlueprint().
Bug: 244730498
Test: Presubmits.
Change-Id: I264f1e4bd989b1c219800eec3be007c3f114c6d1
2023-06-21 07:59:52 +00:00
usta
49012eeacb cosmetic
ninja() is only called for soong bootstrap now

Test: NA
Bug: NA
Change-Id: Iededf601dc3bb92d8681b1e008bf20b4da406f4c
2023-06-20 14:00:44 -04:00
Chris Parsons
39a169721c Provide reason for unconverted bp2build modules
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
2023-06-16 13:45:17 +00:00
Treehugger Robot
d34e4c72f3 Merge "Increase config fetcher timeout to 20s" 2023-06-15 18:37:53 +00:00
Chris Parsons
21f80277c3 Remove bazel dev mode
This mode is no longer in use, and is dead code.

Fixes: 282809863
Test: Presubmits
Change-Id: I45ab7d7c9dee153f1cbc66262c2cf9f1e9487a28
2023-06-15 14:14:19 +00:00
MarkDacek
c00b8bfad2 Add sponge id field to bazel metrics proto
Bug: 287102416
Test: N/A
Change-Id: I3aa88569f7a3514a5668331b19976c310354051e
2023-06-13 20:44:50 +00:00
Kiyoung Kim
eaa55a8ce1 Rename soong.environment.used with product name
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
2023-06-08 01:07:47 +00:00
Jason Wu
e2df3b5f8f Merge "Add re_analysis environment varibles fields to soong_metrics" 2023-06-07 00:31:46 +00:00
Kousik Kumar
a3a2af6b64 Increase config fetcher timeout to 20s
This is to make sure timeout doesn't show up for users from APAC / EMEA regions

Bug: b/283828386
Change-Id: Ie04352553494634070e4c5e83a68b3004fbdf88c
2023-06-06 17:29:11 -04:00
Kousik Kumar
ac985b9c59 Merge "Revert "Remove env config fetcher code"" 2023-06-06 21:26:36 +00:00
Jason Wu
2520f5e36b Add re_analysis environment varibles fields to soong_metrics
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
2023-06-06 16:11:39 -04:00
Treehugger Robot
2a97e1dc90 Merge "Use HINT_FROM_SOONG if ninja_log doesn't exist" 2023-06-06 02:17:11 +00:00
Treehugger Robot
331c7d77c4 Merge "Clean $OUT/ramdisk_16k dir during installclean" 2023-06-05 23:30:13 +00:00
Mark Dacek
e01e7bc574 Merge "Add bazel_metrics to py proto export." 2023-06-05 23:00:21 +00:00
Kelvin Zhang
dc14fbba1d Clean $OUT/ramdisk_16k dir during installclean
This dir is added during aosp/2595672 for building a 16K page sized
ramdisk.
Bug: 253827893

Change-Id: I0f4b1adff12d2b140aa73fd1b8ee1c606d917a47
2023-06-05 10:20:50 -07:00
Kousik Kumar
5c5c57d039 Allowlist gcert and prodcertstatus binaries
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
2023-06-05 11:00:57 -04:00
Jeongik Cha
a87506f5e8 Use HINT_FROM_SOONG if ninja_log doesn't exist
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
2023-06-02 15:50:02 +01:00
Treehugger Robot
9cae81483a Merge "implement USE_BAZEL_VERSION for m" 2023-06-01 22:06:17 +00:00
Chris Parsons
c83398ffb4 implement USE_BAZEL_VERSION for m
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
2023-06-01 17:42:18 +00:00
Jeongik Cha
ef17be26a8 Merge "NINJA_LOG option uses usesninjalogasweightlist" 2023-06-01 00:40:42 +00:00
Jeongik Cha
c018d84a00 Merge "Enable NINJA_LOG as weight list source" 2023-06-01 00:40:42 +00:00
MarkDacek
de53314d0d Add bazel_metrics to py proto export.
Test: build/bazel/scripts/analyze_build
Change-Id: Ied3e6d5a1d65ec31d704ac3cef6e7c74397333bf
2023-05-31 22:09:09 +00:00
Kousik Kumar
d93c67f64c Revert "Remove env config fetcher code"
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
2023-05-30 20:32:08 +00:00
Kousik Kumar
678e680a75 Merge "Remove env config fetcher code" 2023-05-30 17:28:10 +00:00
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