null build upon repeated mixed build
no implicit deps on bazel-tools
Test: USE_BAZEL_ANALYSIS=1 ../bazel/ci/incremental_mixed_build.sh
Bug: b/216194240
Change-Id: Ibbd87c6a6cc2fddf21fba37a6bb4e72adc209576
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index 27255d1..609369a 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -879,12 +879,6 @@
}
rule := NewRuleBuilder(pctx, ctx)
createCommand(rule.Command(), buildStatement, executionRoot, bazelOutDir, ctx)
- // This is required to silence warnings pertaining to unexpected timestamps. Particularly,
- // some Bazel builtins (such as files in the bazel_tools directory) have far-future
- // timestamps. Without restat, Ninja would emit warnings that the input files of a
- // build statement have later timestamps than the outputs.
- rule.Restat()
-
desc := fmt.Sprintf("%s: %s", buildStatement.Mnemonic, buildStatement.OutputPaths)
rule.Build(fmt.Sprintf("bazel %d", index), desc)
}
@@ -899,7 +893,7 @@
if len(buildStatement.OutputPaths) > 0 {
cmd.Text("rm -f")
for _, outputPath := range buildStatement.OutputPaths {
- cmd.Text(outputPath)
+ cmd.Text(fmt.Sprintf("'%s'", outputPath))
}
cmd.Text("&&")
}
diff --git a/android/bazel_handler_test.go b/android/bazel_handler_test.go
index 935ce4e..1c9aca0 100644
--- a/android/bazel_handler_test.go
+++ b/android/bazel_handler_test.go
@@ -93,7 +93,7 @@
"label": "two"
}]
}`,
- "cd 'er' && rm -f one && touch foo",
+ "cd 'test/exec_root' && rm -f 'one' && touch foo",
}, {`
{
"artifacts": [{
@@ -124,17 +124,17 @@
"label": "parent"
}]
}`,
- `cd 'er' && rm -f parent/one && bogus command && sed -i'' -E 's@(^|\s|")bazel-out/@\1bo/@g' 'parent/one.d'`,
+ `cd 'test/exec_root' && rm -f 'parent/one' && bogus command && sed -i'' -E 's@(^|\s|")bazel-out/@\1test/bazel_out/@g' 'parent/one.d'`,
},
}
- for _, testCase := range testCases {
+ for i, testCase := range testCases {
bazelContext, _ := testBazelContext(t, map[bazelCommand]string{
bazelCommand{command: "aquery", expression: "deps(@soong_injection//mixed_builds:buildroot)"}: testCase.input})
err := bazelContext.InvokeBazel(testConfig)
if err != nil {
- t.Fatalf("Did not expect error invoking Bazel, but got %s", err)
+ t.Fatalf("testCase #%d: did not expect error invoking Bazel, but got %s", i+1, err)
}
got := bazelContext.BuildStatementsToRegister()
@@ -143,9 +143,9 @@
}
cmd := RuleBuilderCommand{}
- createCommand(&cmd, got[0], "er", "bo", PathContextForTesting(TestConfig("out", nil, "", nil)))
- if actual := cmd.buf.String(); testCase.command != actual {
- t.Errorf("expected: [%s], actual: [%s]", testCase.command, actual)
+ createCommand(&cmd, got[0], "test/exec_root", "test/bazel_out", PathContextForTesting(TestConfig("out", nil, "", nil)))
+ if actual, expected := cmd.buf.String(), testCase.command; expected != actual {
+ t.Errorf("expected: [%s], actual: [%s]", expected, actual)
}
}
}