Call rm -rf in mixed build build statement preamble.
https://android-review.git.corp.google.com/q/topic:bazel_using_txt added a tree artifact output for an action. This CL adds "-r" to the rm calls to support deleting the old tree artifact outputs. Test: presubmits Fixes: 257956807 Change-Id: Ia44b1bef4f8031fe75a239fb162972e8827e3c19
This commit is contained in:
parent
b43191c90c
commit
f3b1ec39eb
2 changed files with 5 additions and 4 deletions
|
@ -1082,7 +1082,7 @@ func createCommand(cmd *RuleBuilderCommand, buildStatement bazel.BuildStatement,
|
|||
|
||||
// Remove old outputs, as some actions might not rerun if the outputs are detected.
|
||||
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 {
|
||||
cmd.Text(fmt.Sprintf("'%s'", outputPath))
|
||||
}
|
||||
|
|
|
@ -9,8 +9,9 @@ import (
|
|||
"testing"
|
||||
|
||||
"android/soong/bazel/cquery"
|
||||
"google.golang.org/protobuf/proto"
|
||||
analysis_v2_proto "prebuilts/bazel/common/proto/analysis_v2"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
var testConfig = TestConfig("out", nil, "", nil)
|
||||
|
@ -86,7 +87,7 @@ func TestInvokeBazelPopulatesBuildStatements(t *testing.T) {
|
|||
{ "id": 1, "label": "one" },
|
||||
{ "id": 2, "label": "two" }]
|
||||
}`,
|
||||
"cd 'test/exec_root' && rm -f 'one' && touch foo",
|
||||
"cd 'test/exec_root' && rm -rf 'one' && touch foo",
|
||||
}, {`
|
||||
{
|
||||
"artifacts": [
|
||||
|
@ -105,7 +106,7 @@ func TestInvokeBazelPopulatesBuildStatements(t *testing.T) {
|
|||
{ "id": 20, "label": "one.d", "parent_id": 30 },
|
||||
{ "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'`,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue