Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd88414b authored by Cole Faust's avatar Cole Faust
Browse files

Fix incrementality bug with merged BUILD files

The merged build files should be added as ninja dependencies,
so we rerun when they're changed.

Fixes: 246552590
Test: m bp2build, m bp2build again and observe it didn't rerun. Then add a comment in external/protobuf/BUILD.bazel, run m bp2build again, and observe it reruns
Change-Id: I26ed035cc0a894500a192f9aa3371fb46519689b
parent 3a56f5e0
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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",