Add an order-only dependency on the build number file

Remote execution and other tools can be confused by references to
build_number.txt without a dependency.  Add an order-only dependency,
which maintains the current behavior.

Test: BUILD_NUMBER=1 && m aapt && aapt version # shows 1
      BUILD_NUMBER=2 && m aapt && aapt version # shows 1
      rm out/soong/.intermediates/frameworks/base/tools/aapt/aapt/linux_glibc_x86_64/aapt
      BUILD_NUMBER=2 && m aapt && aapt version # shows 2
Change-Id: Icfa98d6840b1dc2e273ba29c33011635d1cf93b1
Bug: 153071808
Merged-In: I1609a790dd4d0a03c8308b6e552622fe33fa2499
This commit is contained in:
Automerger Merge Worker
2020-02-28 21:26:54 +00:00
committed by Julien Desprez
parent 3978d03fb7
commit c372774b1a
2 changed files with 72 additions and 14 deletions

View File

@@ -265,14 +265,16 @@ func ExampleRuleBuilderCommand_NinjaEscapedString() {
func TestRuleBuilder(t *testing.T) {
fs := map[string][]byte{
"dep_fixer": nil,
"input": nil,
"Implicit": nil,
"Input": nil,
"Tool": nil,
"input2": nil,
"tool2": nil,
"input3": nil,
"dep_fixer": nil,
"input": nil,
"Implicit": nil,
"Input": nil,
"OrderOnly": nil,
"OrderOnlys": nil,
"Tool": nil,
"input2": nil,
"tool2": nil,
"input3": nil,
}
ctx := PathContextForTesting(TestConfig("out", nil, "", fs))
@@ -290,6 +292,7 @@ func TestRuleBuilder(t *testing.T) {
ImplicitOutput(PathForOutput(ctx, "ImplicitOutput")).
Input(PathForSource(ctx, "Input")).
Output(PathForOutput(ctx, "Output")).
OrderOnly(PathForSource(ctx, "OrderOnly")).
Text("Text").
Tool(PathForSource(ctx, "Tool"))
@@ -298,6 +301,7 @@ func TestRuleBuilder(t *testing.T) {
DepFile(PathForOutput(ctx, "depfile2")).
Input(PathForSource(ctx, "input2")).
Output(PathForOutput(ctx, "output2")).
OrderOnlys(PathsForSource(ctx, []string{"OrderOnlys"})).
Tool(PathForSource(ctx, "tool2"))
// Test updates to the first command after the second command has been started
@@ -317,6 +321,7 @@ func TestRuleBuilder(t *testing.T) {
wantOutputs := PathsForOutput(ctx, []string{"ImplicitOutput", "Output", "output", "output2", "output3"})
wantDepFiles := PathsForOutput(ctx, []string{"DepFile", "depfile", "ImplicitDepFile", "depfile2"})
wantTools := PathsForSource(ctx, []string{"Tool", "tool2"})
wantOrderOnlys := PathsForSource(ctx, []string{"OrderOnly", "OrderOnlys"})
t.Run("normal", func(t *testing.T) {
rule := NewRuleBuilder()
@@ -346,6 +351,9 @@ func TestRuleBuilder(t *testing.T) {
if g, w := rule.Tools(), wantTools; !reflect.DeepEqual(w, g) {
t.Errorf("\nwant rule.Tools() = %#v\n got %#v", w, g)
}
if g, w := rule.OrderOnlys(), wantOrderOnlys; !reflect.DeepEqual(w, g) {
t.Errorf("\nwant rule.OrderOnlys() = %#v\n got %#v", w, g)
}
if g, w := rule.depFileMergerCmd(ctx, rule.DepFiles()).String(), wantDepMergerCommand; g != w {
t.Errorf("\nwant rule.depFileMergerCmd() = %#v\n got %#v", w, g)
@@ -380,6 +388,9 @@ func TestRuleBuilder(t *testing.T) {
if g, w := rule.Tools(), wantTools; !reflect.DeepEqual(w, g) {
t.Errorf("\nwant rule.Tools() = %#v\n got %#v", w, g)
}
if g, w := rule.OrderOnlys(), wantOrderOnlys; !reflect.DeepEqual(w, g) {
t.Errorf("\nwant rule.OrderOnlys() = %#v\n got %#v", w, g)
}
if g, w := rule.depFileMergerCmd(ctx, rule.DepFiles()).String(), wantDepMergerCommand; g != w {
t.Errorf("\nwant rule.depFileMergerCmd() = %#v\n got %#v", w, g)