Remove a self-dependency of bp2build

bp2build (i.e. bootstrap.ninja#bp2build_workspace_marker) generate $OUT/soong/bp2build/**/BUILD.bazel files
Having them as a dependency would thus make bp2build_workspace_marker stale upon incremental builds (because we don't re-touch the marker file if it already exists)

See Also: https://android-review.googlesource.com/c/platform/build/soong/+/2263423

Bug: b/253450880
Test: NINJA_ARGS='-d explain' m --bazel-mode adbd
      repeat and see if bp2build is rerun
prior to this CL, one would see the input /usr/local/google/home/usta/aosp/out/soong/bp2build/build/make/tools/BUILD.bazel trigger bp2build over and over again

Change-Id: I904cd333a5d6ef506fc4019eda7623ef96a1daa3
This commit is contained in:
Usta Shrestha
2022-10-25 01:22:36 -04:00
committed by Usta (Tsering) Shrestha
parent 39f17ad8b8
commit 783ec5c72c

View File

@@ -278,17 +278,9 @@ func plantSymlinkForestRecursive(cfg android.Config, topdir string, forestDir st
// Neither is a directory. Merge them.
srcBuildFile := shared.JoinPath(topdir, srcChild)
generatedBuildFile := shared.JoinPath(topdir, buildFilesChild)
// Add the src and generated build files as dependencies so that bp2build
// is rerun when they change. Currently, this is only really necessary
// for srcBuildFile, because if we regenerate the generated build files
// we will always rerun the symlink forest generation as well. If that
// is later split up into separate, fully dependency-tracing steps, then
// we'll need srcBuildFile as well. Adding srcBuildFile here today
// technically makes it a dependency of bp2build_workspace_marker, which
// also implicitly outputs that file, but since bp2build_workspace_marker
// will always have a newer timestamp than the generatedBuildFile it
// shouldn't be a problem.
*acc = append(*acc, srcBuildFile, generatedBuildFile)
// The Android.bp file that codegen used to produce `buildFilesChild` is
// already a dependency, we can ignore `buildFilesChild`.
*acc = append(*acc, srcChild)
err = mergeBuildFiles(shared.JoinPath(topdir, forestChild), srcBuildFile, generatedBuildFile, cfg.IsEnvTrue("BP2BUILD_VERBOSE"))
if err != nil {
fmt.Fprintf(os.Stderr, "Error merging %s and %s: %s",