Merge "Fix incrementality bug with merged BUILD files"

This commit is contained in:
Treehugger Robot
2022-10-07 22:21:26 +00:00
committed by Gerrit Code Review

View File

@@ -285,6 +285,17 @@ 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)
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",