Merge "Call rm -rf in mixed build build statement preamble."
This commit is contained in:
@@ -1083,7 +1083,7 @@ func createCommand(cmd *RuleBuilderCommand, buildStatement bazel.BuildStatement,
|
|||||||
|
|
||||||
// Remove old outputs, as some actions might not rerun if the outputs are detected.
|
// Remove old outputs, as some actions might not rerun if the outputs are detected.
|
||||||
if len(buildStatement.OutputPaths) > 0 {
|
if len(buildStatement.OutputPaths) > 0 {
|
||||||
cmd.Text("rm -f")
|
cmd.Text("rm -rf") // -r because outputs can be Bazel dir/tree artifacts.
|
||||||
for _, outputPath := range buildStatement.OutputPaths {
|
for _, outputPath := range buildStatement.OutputPaths {
|
||||||
cmd.Text(fmt.Sprintf("'%s'", outputPath))
|
cmd.Text(fmt.Sprintf("'%s'", outputPath))
|
||||||
}
|
}
|
||||||
|
@@ -9,8 +9,9 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"android/soong/bazel/cquery"
|
"android/soong/bazel/cquery"
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
analysis_v2_proto "prebuilts/bazel/common/proto/analysis_v2"
|
analysis_v2_proto "prebuilts/bazel/common/proto/analysis_v2"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var testConfig = TestConfig("out", nil, "", nil)
|
var testConfig = TestConfig("out", nil, "", nil)
|
||||||
@@ -86,7 +87,7 @@ func TestInvokeBazelPopulatesBuildStatements(t *testing.T) {
|
|||||||
{ "id": 1, "label": "one" },
|
{ "id": 1, "label": "one" },
|
||||||
{ "id": 2, "label": "two" }]
|
{ "id": 2, "label": "two" }]
|
||||||
}`,
|
}`,
|
||||||
"cd 'test/exec_root' && rm -f 'one' && touch foo",
|
"cd 'test/exec_root' && rm -rf 'one' && touch foo",
|
||||||
}, {`
|
}, {`
|
||||||
{
|
{
|
||||||
"artifacts": [
|
"artifacts": [
|
||||||
@@ -105,7 +106,7 @@ func TestInvokeBazelPopulatesBuildStatements(t *testing.T) {
|
|||||||
{ "id": 20, "label": "one.d", "parent_id": 30 },
|
{ "id": 20, "label": "one.d", "parent_id": 30 },
|
||||||
{ "id": 30, "label": "parent" }]
|
{ "id": 30, "label": "parent" }]
|
||||||
}`,
|
}`,
|
||||||
`cd 'test/exec_root' && rm -f 'parent/one' && bogus command && sed -i'' -E 's@(^|\s|")bazel-out/@\1test/bazel_out/@g' 'parent/one.d'`,
|
`cd 'test/exec_root' && rm -rf 'parent/one' && bogus command && sed -i'' -E 's@(^|\s|")bazel-out/@\1test/bazel_out/@g' 'parent/one.d'`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user