summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Usta (Tsering) Shrestha <usta@google.com> 2022-10-20 20:27:56 +0000
committer Usta (Tsering) Shrestha <usta@google.com> 2022-10-25 13:40:34 +0000
commit5689aa36f6f04666e6e9b9ec42425bd9d30159a6 (patch)
treea560ccdf3c7391af3720d7b4338e8b1cf047b92c
parenta0e575c7dcd0f0469dc84ef3dc2b5b5bb8a3559d (diff)
don't touch `bp2build_workspace_marker` file if it exists
- the generating rule has `restat=true`, so its output need not have a newer timestamp to prevent it from rerunning on subsequent ninja invocations - its dependents (so far only bootstrap.ninja's "build build.ninja") already have proper dependencies in the depfile, namely 1. Android.bp.list, 2. entries in Android.bp.list, 3. bazel.list and 4. entries in bazel.list This change prevents symlink related changes from spuriously retriggering build.ninja Change-Id: I93f1fea7054dfbfc7c13ece34d2d1f07a81bbe07 Test: manually verifying bazel analysis is triggered only under the right set of CUJs using build/bazel/ci/incremental_build.py Bug: b/239044236
-rw-r--r--cmd/soong_build/main.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go
index c1a66dbcf..517b80f52 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -519,6 +519,12 @@ func touch(path string) {
}
}
+func touchIfDoesNotExist(path string) {
+ if _, err := os.Stat(path); os.IsNotExist(err) {
+ touch(path)
+ }
+}
+
// Find BUILD files in the srcDir which are not in the allowlist
// (android.Bp2BuildConversionAllowlist#ShouldKeepExistingBuildFileForDir)
// and return their paths so they can be left out of the Bazel workspace dir (i.e. ignored)
@@ -684,8 +690,9 @@ func runBp2Build(configuration android.Config, extraNinjaDeps []string) {
writeDepFile(bp2buildMarker, eventHandler, ninjaDeps)
- // Create an empty bp2build marker file.
- touch(shared.JoinPath(topDir, bp2buildMarker))
+ // Create an empty bp2build marker file, if it does not already exist.
+ // Note the relevant rule has `restat = true`
+ touchIfDoesNotExist(shared.JoinPath(topDir, bp2buildMarker))
})
// Only report metrics when in bp2build mode. The metrics aren't relevant