Commit Graph

1096 Commits

Author SHA1 Message Date
Colin Cross
de7d7bcab2 Possible fix for stat error during globbing
Globs can fail when a directory is replaced with a file:
Error checking globs: stat foo: not a directory

Manually check for syscall.ENOTDIR, which is not covered by
fs.ErrNotExist.


Ignore-AOSP-First: "Landing internal first for critical ap4a move"
Bug: 369548825
Test: manual
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:c3cd8e3f3c93773f0051608b94a0358554a95c98)
Merged-In: I35f65725b70fc0abb22aff46298d053d98d03b00
Change-Id: I35f65725b70fc0abb22aff46298d053d98d03b00
2024-09-25 20:05:15 +00:00
Treehugger Robot
d4771aa267 Merge "Allow multiple ninja implementations" into main 2024-09-12 22:09:58 +00:00
LaMont Jones
ece626ccac Allow multiple ninja implementations
This permits easier testing and comparison between different ninja
implementations.

Bug: 362926979
Bug: 318434287
Test: manual
Change-Id: Ic058338d0a2fd8c988794a0781dcc93c0f4c03e3
2024-09-12 12:45:27 -07:00
Yaowen Mei
d9108d2d34 Fix a bug in the log directory cleanup logic.
This CL fix the bug that shouldCleanupRBELogsDir() never return true.

The way how shouldCleanupRBELogsDir() use to work is it will return true only if `RBE_proxy_log_dir` flag is not set.

But CI build always got this flag from gcl file, and developer build always got this flag set from ui/build/rbe.go (http://shortn/_K604iWNYkd). So there is never a case this shouldCleanupRBELogsDir() return true. That is to say, we never clean up
RBELogsDir by ourselves.

The reason why this is not a concern is that soong will automatically delete the out/soong/.temp folder every time when user run `m` or `lunch`, and the default RBELogsDir use to be `out/soong/.temp/rbe`. So soong is helping us to clean the logs before.


Previously, I merged this CL: https://r.android.com/3192211 to support running `lunch` in two terminals. In that CL, I moved the auto created RBELogsDir one level up to `out/soong/rbe`. This is causing a problem because RBELogsDir never get cleaned.

This CL will fix the shouldCleanupRBELogsDir() method, after this merged in, 1) if a user didn't set the `RBE_proxy_log_dir` flag, the logs in `out/soong/rbe` will be cleaned each time when running `m`, but `lunch` will not touch `out/soong/rbe`, so we still support running `lunch` in different terminals. 2) If user set `RBE_proxy_log_dir` flag to anything rather than `out/song/rbe`, the directory will not be cleaned by running `m`; 3) we have updated our doc everywhere that `out/soong/rbe` is re-client's default log dir, so I think it should be expected if user set `RBE_proxy_log_dir=out/soong/rbe`, then the logs will be deleted when next time `m` invoked, same as if they set `RBE_proxy_log_dir=out/soong/.temp/rbe` before.


Test: abtd run is green: http://shortn/_KqTvQelstP, local build with multiply lunch is not affected, and running m after a build can clean the out/soong/rbe directory.
Bug: 362798954
Change-Id: I38a7ad650fc59ad06716c5be7de6ecc61ead8eef
2024-09-12 18:08:06 +00:00
Treehugger Robot
ba841f8155 Merge "Add directories below to Android.mk denylist:" into main 2024-09-11 20:36:53 +00:00
Wei Li
7df32b1f69 Add directories below to Android.mk denylist:
device/common/
device/google_car/
vendor/google_contexthub/
vendor/google_data/
vendor/google_elmyra/
vendor/google_mhl/
vendor/google_pdk/
vendor/google_testing/
vendor/partner_testing/
vendor/partner_tools/
vendor/pdk/

Bug: 318428689
Test: CIs
Change-Id: I2242c84aaea844ed19bafd20a68c506c99859fea
2024-09-11 19:36:41 +00:00
Cole Faust
69c78e9b6e Rerun globs when a dependency is missing
If you remove a folder that's part of a glob, soong will error out
currently. Instead treat it like an out-of-date dependency.

Bug: 364749114
Test: m nothing, rm glob folder, m nothing
Change-Id: I86ee755a0815b79192133223f8ef3ecd90669db1
2024-09-10 16:46:06 -07:00
Cole Faust
8ca2a80d27 Merge "Make globs compatible with hash-based ninja semantics" into main 2024-09-10 23:20:10 +00:00
Cole Faust
527dc30f42 Revert "Add BUILD_BROKEN_PYTHON_IS_PYTHON2"
This reverts commit b1fbc79206.

Removing the build broken flag to progress the python3 migration. It's been here for over a year and I haven't heard of any users.

Bug: 203436762
Test: Presubmits
Change-Id: Icfd2d25986abda934c60fd868ed5525dc384fbf3
2024-09-10 10:04:19 -07:00
Cole Faust
2fec4128e0 Make globs compatible with hash-based ninja semantics
Previously, globs worked by having soong_build rewrite a ninja file
that ran the globs, and then dependended on the results of that ninja
file. soong_build also pre-filled their outputs so that it wouldn't
be immediately rerun on the 2nd build.

However, the pre-filling of outputs worked for ninja, because although
it updated their timestamps, the soong ninja file was then touched
by soong_build after that, so the soong_build ninja file was newer
and ninja wouldn't rerun soong. But N2 reruns actions if their inputs'
mtimes change in any way, not just if they're newer. Similarly,
hashed-based ninja implementations could not enforce an order on
file contents, so they would have the same problem.

To fix this, lift the glob checking out of ninja and into soong_ui.
Soong_build will output a globs report file every time it's run, and
every time soong_ui is run it will check the globs file, and if any
globs change, update an input to soong_build. soong_ui is essentially
doing what was done in ninja with bpglob actions before.

Bug: 364749114
Test: m nothing, m nothing again doesn't reanalyze, create a new file under a glob directory, m nothing again reanalyzes
Change-Id: I0dbc5ec58c89b869b59cd0602b82215c4972d799
2024-09-09 17:42:49 -07:00
Cole Faust
3ae36f42dc Remove zeros from build number
The zeros were kept in place of the timestamp in case people were
parsing it. Let's try to remove the zeros now and see what breaks.

Test: Presubmits
Change-Id: Ic52168f6be05a74323d8e47935de5c6a5cf15516
2024-09-09 16:54:16 -07:00
Treehugger Robot
b32516985d Merge "Remove Android.bp file input to primaryBuilders" into main 2024-09-05 23:26:59 +00:00
Cole Faust
eda96ba50f Remove Android.bp file input to primaryBuilders
The soong primary builder action lists all the Android.bp files
as dependencies via a depfile. The top-level one doesn't need to be
listed as an input explicitly. I think it was there from the early
days of soong when soong started at the top-level Android.bp file and
traversed downwards through references via the subdirs or
optional_subdirs variables.

Bug: 364749114
Test: Presubmits
Change-Id: I72eabe4d4179696bfa258c8c4c56351a132e0870
2024-09-05 15:26:32 -07:00
Taylor Santiago
c162dfac78 Undo filtering of HOME environment variable.
It an cause 'nonexistent' user errors in the sandbox.

Bug: 363037195
Change-Id: I5e17fa62029ba9bcd2422fa9aebef95223c68c0d
2024-09-05 19:43:27 +00:00
Taylor Santiago
8b0bed7187 Reapply "Clean environment variables to account for sandbox work directory."
with minor edits.

This reverts commit 9543d19b4b.

Bug: 363037195
Change-Id: I4cb10b312b7f468185bfad12a16f9b4b64e7a58a
2024-09-04 22:55:02 +00:00
PODISHETTY KUMAR (xWF)
cdd70d268a Merge "Revert "Clean environment variables to account for sandbox work directory."" into main 2024-09-02 06:57:34 +00:00
PODISHETTY KUMAR (xWF)
9543d19b4b Revert "Clean environment variables to account for sandbox work directory."
This reverts commit 0af8ea14fc.

Reason for revert: <Droidmonitor created revert due to b/363848580. Will be verifying through ABTD before submission.>

Change-Id: Iafba28897ad27df67ef8ae8904454196c482216d
2024-09-02 03:54:36 +00:00
Taylor Santiago
3cd732bcd1 Merge "Clean environment variables to account for sandbox work directory." into main 2024-08-31 04:04:22 +00:00
Taylor Santiago
0af8ea14fc Clean environment variables to account for sandbox work directory.
Unset HOME to prevent username leak.

Bug: 363037195

Change-Id: I7a8694f746d58de8f6e41adb6ad52abbaf955ef4
2024-08-29 20:12:35 +00:00
Wei Li
91a1e9f894 Merge "Add "packages/" to Android.mk denylist." into main 2024-08-26 21:24:56 +00:00
Wei Li
ffb99497a7 Add "packages/" to Android.mk denylist.
Bug: 318428689
Change-Id: I229fb645cdf03881ed709216dd6743d456440403
Test: CIs
2024-08-23 22:54:40 +00:00
Qing Shen
713c54289c Revert "Revert "Add a coverage suffix to avoid Ninja file regene..."
Revert submission 3235973-revert-3207217-emma-flip-time-saver-BYWASVIMTD

Reason for revert: Rolling forward with a fix

Adding a coverage suffix for product_config.go too:

FAILED: ninja: 'out/soong/soong.sdv_core_cf.extra.variables', needed by 'out/soong/.intermediates/build/soong/product_config/product_config.json', missing and no known rule to make it
03:42:23 ninja failed with: exit status 1

Reverted changes: /q/submissionid:3235973-revert-3207217-emma-flip-time-saver-BYWASVIMTD

Change-Id: I74d0e3fda09b1367f3dbb939d4f47c4d09b3d51f
2024-08-23 21:41:52 +00:00
Cole Faust
4e58bba1fc Use musl build of n2
We're seeing bugs on the build server only, and previous similar bugs
were caused by issues in the older version of glibc the build server
uses, so try using the musl build of n2 to see if it resolves the
issues.

Bug: 318434287
Test: Presubmits
Change-Id: I416cd77f4dfb4ca04f6dd5b36fa73585a2904b55
2024-08-22 14:27:03 -07:00
Hugo Drumond Jacob
079871cd55 Merge "Revert "Add a coverage suffix to avoid Ninja file regeneration."" into main 2024-08-21 17:20:34 +00:00
Hugo Drumond Jacob
134fa5df00 Revert "Add a coverage suffix to avoid Ninja file regeneration."
Revert submission 3207217-emma-flip-time-saver

Reason for revert: b/361236607

Reverted changes: /q/submissionid:3207217-emma-flip-time-saver

Change-Id: I7b4dcd3f6e73e302a2c3ef7ed5c02f6345619463
2024-08-21 13:07:06 +00:00
Qing Shen
ff545caecd Merge "Add a coverage suffix to avoid Ninja file regeneration." into main 2024-08-20 01:16:53 +00:00
LaMont Jones
b2ab527798 Pass through RUST_LOG
If the user has RUST_LOG set in the environment, pass that through.

Bug: 352600283
Test: manual
Change-Id: Ia6bfa4be791a8e72591fc729de4e4270df150a1c
2024-08-14 10:08:50 -07:00
Qing Shen
9e05d1c5cd Add a coverage suffix to avoid Ninja file regeneration.
This CL uses the environment variable, EMMA_INSTRUMENT to determine whether or not coverage is enabled. If coverage is enabled, it adds a bunch of suffixes to the files generated in out/soong/ folders.

This change reduces the build time by avoiding ninja regeneration when users simply switches from atest to atest --experimental-coverage, or vice versa, and no Android.bp changes are made.

Bug: 331444846
Test: Locally run m libc, and then EMMA_INSTRUMENT m libc twice, no ninja regenerations required. Compared the hash of out/target/product/vsoc_x86_64/ between the before-change repo and after-change repo. Only diff is the after-change directory contains an extra file `out/target/product/vsoc_x86_64/.installable_files` while the original directory has only `out/target/product/vsoc_x86_64/.installable_files.previous`, both files have the same hash.
Change-Id: I972aec20a9d97b223cc833ee245016ac4b0f09a2
2024-08-13 02:04:53 +00:00
Taylor Santiago
2611851112 Individually mount children of root with ABFS enabled and respect
OUT_DIR configuration.

Mounting '/' directly as read-only results in failed bindmounts at /src
if that directory does not already exist due to failure to mkdir.

Change-Id: I7f11c45e82374d142a86fcb2f03e53ddacffffb8
2024-08-12 12:06:29 -07:00
Taylor Santiago
60fa202bb5 Merge "Use consistent directory for source and output inside the build sandbox for ABFS." into main 2024-07-31 17:55:41 +00:00
Taylor Santiago
ca30e08b9d Use consistent directory for source and output inside the build sandbox
for ABFS.

A consistent source directory addresses problematic full path inputs and
outputs, which can manifest as cache misses or build failures after an ABFS
patch application.

Bug: 347704053
Change-Id: Ib2297bb0b904b1b490e83c22fd468eee928e53fe
2024-07-30 13:52:31 -07:00
Yaowen Mei
d4da266b35 Fix RBE tmp dir
The RBE tmp dir holds all the re-client logs and socket files.

Currently, it is being created as the `out/soong/.temp/` dir, which is auto deleted by Soong. This is causing problems because while a build is running, user cannot open a second terminal and run `lunch`.

This CL fixes the issue by creating the RBE tmp dir in the `out/soong/rbe/` directory. The next RBE build will clean this folder.


Bug: 349664018
Change-Id: Ib238e48f5b19755b016263b45f02b1be3e8efb35
2024-07-30 14:21:04 +00:00
Christopher Ferris
cdd872a5be Merge "Update tests to expect RBE not supported on linux." into main 2024-07-26 17:58:26 +00:00
Wei Li
9f13555225 Merge "Generate SBOM of products in Soong." into main 2024-07-26 00:45:43 +00:00
Christopher Ferris
1db36e3888 Update tests to expect RBE not supported on linux.
Bug: 354280127

Test: Passes on linux
Test: Treehugger for the rest.
Change-Id: Ic1546a153e7e761a2132409743650cbf0a0b1ba6
2024-07-25 16:52:31 -07:00
Taylor Santiago
dd65d3e672 Merge "Add ABFS (Android Build Filesystem) configuration option to Soong" into main 2024-07-25 21:04:06 +00:00
Wei Li
b85a178b07 Generate SBOM of products in Soong.
Bug: 324465531
Test: CIs
Test: m soong-sbom
Change-Id: If76776851d49282829a79bfb1c33f05b8f57de31
2024-07-24 18:23:13 -07:00
Treehugger Robot
c7eb3bdae7 Merge "Highlight build failures in soong output" into main 2024-07-18 20:13:15 +00:00
Colin Cross
ea1b3b78b8 Merge changes from topic "elide_empty_variants" into main
* changes:
  Convert sdk mutator to TransitionMutator
  Convert link mutator to TransitionMutator
  Convert version mutator to TransitionMutator
  Convert python_version mutator to TransitionMutator
  Convert rust_libraries and rust_stdlinkage mutators to TransitionMutators
2024-07-18 17:37:38 +00:00
Treehugger Robot
865b877027 Merge "Generate .build-id directory tree after every build." into main 2024-07-17 23:13:24 +00:00
Colin Cross
8a49a3dd76 Convert rust_libraries and rust_stdlinkage mutators to TransitionMutators
Replace rust.LibraryMutator and rust.LibstdMutator with
TransitionMutators.

Bug: 319288033
Flag: EXEMPT refactor
Test: all soong tests pass
Test: no change to build.ninja
Change-Id: Ia24a582119d39889279d7b93bac9259685153619
2024-07-17 15:50:36 -07:00
Taylor Santiago
3c16e61c57 Add ABFS (Android Build Filesystem) configuration option to Soong
Change-Id: Ibbe81004adc67b1212d7e619a35f7425bfee0d72
2024-07-17 14:50:25 -07:00
cherokeeMeta
f7119b57ac Highlight build failures in soong output
Summary: When build failures occur, it can be hard to find where the error message begins. We now highlight "FAILURE" in red to make it easier to see what exactly has failed in the output.

Test: execute automated tests with m nothing --no-skip-soong-tests, can also manually test with a build failure and observe red text in the output

Change-Id: Iad3b94cc1c385f0afdebdf12c44843db04ff2bdc
Signed-off-by: Cherokee Toole <cherokee@meta.com>
2024-07-16 18:18:33 +00:00
Cole Faust
bee030d36b Allow n2 as a replacement for ninja in builds
If `SOONG_USE_N2=true` is set in the environment, then n2 is used in
place of ninja.  Some ninja features are not available in n2 at this
time, but this enables bringup efforts to happen in parallel.

Bug: 352368206
Test: manual
Change-Id: I8455cb24eb640a4651782ee76e48a7d3a9932b93
2024-07-10 12:35:32 -07:00
Nathan Egge
978c934dd9 Add LEX to the list of env variables to unset.
Some linux environments export LEX and this variable must be unset to
 ensure Soong and Make LEX values match.

Change-Id: I8ff2b62a49e0108575ff88b1a88a83d650fc3768
2024-07-08 20:53:46 +00:00
Spandan Das
dd274aba5f Merge "Revert^2 "Enforce that output files are created in primary ninja execution"" into main 2024-07-01 23:28:56 +00:00
Spandan Das
28a6f19866 Revert^2 "Enforce that output files are created in primary ninja execution"
This reverts commit fddc3dc8d3.

Reason for revert: https://r.android.com/3148741 makes this compatible with art gtests

Change-Id: Ia85c60fdcfa3142fc464a35476170c88c172989c
2024-07-01 21:00:25 +00:00
Treehugger Robot
38a97b2c47 Merge "Revert "Enforce that output files are created in primary ninja execution"" into main 2024-06-26 20:25:07 +00:00
Santiago Aboy Solanes
fddc3dc8d3 Revert "Enforce that output files are created in primary ninja execution"
This reverts commit 8d8253f525.

Reason for revert: Breaks ART gtests e.g. https://android-build.corp.google.com/build_explorer/build_details/12016159/art-gtest/

Change-Id: Ie8e1a28c7d0a21ee6727954127a6ab00ed00e781
2024-06-26 14:52:52 +00:00
Treehugger Robot
e8d5c8a5b2 Merge "Enforce that output files are created in primary ninja execution" into main 2024-06-26 02:18:55 +00:00