Fix RuleBuilder.Restat

RuleBuilder.Restat wasn't being propagated to the rule.

Test: rule_builder_test.go
Change-Id: Ie64c8076692ea10a0c47ed5a8832e3f553bea0fc
This commit is contained in:
Colin Cross 2019-02-25 14:56:01 -08:00
parent 4c83e5ccd4
commit baa676f671
2 changed files with 7 additions and 0 deletions

View file

@ -242,6 +242,7 @@ func (r *RuleBuilder) Build(pctx PackageContext, ctx BuilderContext, name string
Rule: ctx.Rule(pctx, name, blueprint.RuleParams{
Command: strings.Join(proptools.NinjaEscapeList(r.Commands()), " && "),
CommandDeps: r.Tools().Strings(),
Restat: r.restat,
}),
Implicits: r.Inputs(),
Outputs: r.Outputs(),

View file

@ -331,6 +331,8 @@ func testRuleBuilder_Build(ctx BuilderContext, in Path, out WritablePath) {
rule.Command().Tool(PathForSource(ctx, "cp")).Input(in).Output(out)
rule.Restat()
rule.Build(pctx, ctx, "rule", "desc")
}
@ -376,6 +378,10 @@ func TestRuleBuilder_Build(t *testing.T) {
if len(params.Outputs) != 1 || params.Outputs[0].String() != wantOutput {
t.Errorf("want Outputs = [%q], got %q", wantOutput, params.Outputs.Strings())
}
if !params.RuleParams.Restat {
t.Errorf("want RuleParams.Restat = true, got %v", params.RuleParams.Restat)
}
}
t.Run("module", func(t *testing.T) {