Merge "Support phony_output as a BuildParam Arg in RuleBuilder" into main
This commit is contained in:
@@ -58,6 +58,7 @@ type RuleBuilder struct {
|
|||||||
sboxInputs bool
|
sboxInputs bool
|
||||||
sboxManifestPath WritablePath
|
sboxManifestPath WritablePath
|
||||||
missingDeps []string
|
missingDeps []string
|
||||||
|
args map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRuleBuilder returns a newly created RuleBuilder.
|
// NewRuleBuilder returns a newly created RuleBuilder.
|
||||||
@@ -78,6 +79,17 @@ func (rb *RuleBuilder) SetSboxOutDirDirAsEmpty() *RuleBuilder {
|
|||||||
return rb
|
return rb
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the phony_output argument.
|
||||||
|
// This causes the output files to be ignored.
|
||||||
|
// If the output isn't created, it's not treated as an error.
|
||||||
|
// The build rule is run every time whether or not the output is created.
|
||||||
|
func (rb *RuleBuilder) SetPhonyOutput() {
|
||||||
|
if rb.args == nil {
|
||||||
|
rb.args = make(map[string]string)
|
||||||
|
}
|
||||||
|
rb.args["phony_output"] = "true"
|
||||||
|
}
|
||||||
|
|
||||||
// RuleBuilderInstall is a tuple of install from and to locations.
|
// RuleBuilderInstall is a tuple of install from and to locations.
|
||||||
type RuleBuilderInstall struct {
|
type RuleBuilderInstall struct {
|
||||||
From Path
|
From Path
|
||||||
@@ -726,6 +738,12 @@ func (r *RuleBuilder) build(name string, desc string, ninjaEscapeCommandString b
|
|||||||
commandString = proptools.NinjaEscape(commandString)
|
commandString = proptools.NinjaEscape(commandString)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
args_vars := make([]string, len(r.args))
|
||||||
|
i := 0
|
||||||
|
for k, _ := range r.args {
|
||||||
|
args_vars[i] = k
|
||||||
|
i++
|
||||||
|
}
|
||||||
r.ctx.Build(r.pctx, BuildParams{
|
r.ctx.Build(r.pctx, BuildParams{
|
||||||
Rule: r.ctx.Rule(r.pctx, name, blueprint.RuleParams{
|
Rule: r.ctx.Rule(r.pctx, name, blueprint.RuleParams{
|
||||||
Command: commandString,
|
Command: commandString,
|
||||||
@@ -734,7 +752,7 @@ func (r *RuleBuilder) build(name string, desc string, ninjaEscapeCommandString b
|
|||||||
Rspfile: proptools.NinjaEscape(rspFile),
|
Rspfile: proptools.NinjaEscape(rspFile),
|
||||||
RspfileContent: rspFileContent,
|
RspfileContent: rspFileContent,
|
||||||
Pool: pool,
|
Pool: pool,
|
||||||
}),
|
}, args_vars...),
|
||||||
Inputs: rspFileInputs,
|
Inputs: rspFileInputs,
|
||||||
Implicits: inputs,
|
Implicits: inputs,
|
||||||
OrderOnly: r.OrderOnlys(),
|
OrderOnly: r.OrderOnlys(),
|
||||||
@@ -744,6 +762,7 @@ func (r *RuleBuilder) build(name string, desc string, ninjaEscapeCommandString b
|
|||||||
Depfile: depFile,
|
Depfile: depFile,
|
||||||
Deps: depFormat,
|
Deps: depFormat,
|
||||||
Description: desc,
|
Description: desc,
|
||||||
|
Args: r.args,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user