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

Commit 39097a3f authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "For mixed build bazel actions, remove old outputs" am: e1bb74e7 am: d17a3ad9

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1834860

Change-Id: Idac0af306c269fe143fe68919c9ff285d9e733c0
parents d3e4641b d17a3ad9
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -811,6 +811,15 @@ func (c *bazelSingleton) GenerateBuildActions(ctx SingletonContext) {
		// cd into Bazel's execution root, which is the action cwd.
		cmd.Text(fmt.Sprintf("cd %s/execroot/__main__ &&", ctx.Config().BazelContext.OutputBase()))

		// Remove old outputs, as some actions might not rerun if the outputs are detected.
		if len(buildStatement.OutputPaths) > 0 {
			cmd.Text("rm -f")
			for _, outputPath := range buildStatement.OutputPaths {
				cmd.Text(PathForBazelOut(ctx, outputPath).String())
			}
			cmd.Text("&&")
		}

		for _, pair := range buildStatement.Env {
			// Set per-action env variables, if any.
			cmd.Flag(pair.Key + "=" + pair.Value)