Merge pull request #322 from jin/symlink_outputs

Add support for symlink_outputs to Blueprint
This commit is contained in:
Liz Kammer 2020-10-19 08:52:08 -07:00 committed by GitHub
commit ed35255eca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56,15 +56,16 @@ type PoolParams struct {
// definition. // definition.
type RuleParams struct { type RuleParams struct {
// These fields correspond to a Ninja variable of the same name. // These fields correspond to a Ninja variable of the same name.
Command string // The command that Ninja will run for the rule. Command string // The command that Ninja will run for the rule.
Depfile string // The dependency file name. Depfile string // The dependency file name.
Deps Deps // The format of the dependency file. Deps Deps // The format of the dependency file.
Description string // The description that Ninja will print for the rule. Description string // The description that Ninja will print for the rule.
Generator bool // Whether the rule generates the Ninja manifest file. Generator bool // Whether the rule generates the Ninja manifest file.
Pool Pool // The Ninja pool to which the rule belongs. Pool Pool // The Ninja pool to which the rule belongs.
Restat bool // Whether Ninja should re-stat the rule's outputs. Restat bool // Whether Ninja should re-stat the rule's outputs.
Rspfile string // The response file. Rspfile string // The response file.
RspfileContent string // The response file content. RspfileContent string // The response file content.
SymlinkOutputs []string // The list of Outputs or ImplicitOutputs that are symlinks.
// These fields are used internally in Blueprint // These fields are used internally in Blueprint
CommandDeps []string // Command-specific implicit dependencies to prepend to builds CommandDeps []string // Command-specific implicit dependencies to prepend to builds
@ -84,6 +85,7 @@ type BuildParams struct {
Rule Rule // The rule to invoke. Rule Rule // The rule to invoke.
Outputs []string // The list of explicit output targets. Outputs []string // The list of explicit output targets.
ImplicitOutputs []string // The list of implicit output targets. ImplicitOutputs []string // The list of implicit output targets.
SymlinkOutputs []string // The list of Outputs or ImplicitOutputs that are symlinks.
Inputs []string // The list of explicit input dependencies. Inputs []string // The list of explicit input dependencies.
Implicits []string // The list of implicit input dependencies. Implicits []string // The list of implicit input dependencies.
OrderOnly []string // The list of order-only dependencies. OrderOnly []string // The list of order-only dependencies.
@ -205,6 +207,15 @@ func parseRuleParams(scope scope, params *RuleParams) (*ruleDef,
r.Variables["rspfile_content"] = value r.Variables["rspfile_content"] = value
} }
if len(params.SymlinkOutputs) > 0 {
value, err = parseNinjaString(scope, strings.Join(params.SymlinkOutputs, " "))
if err != nil {
return nil, fmt.Errorf("error parsing SymlinkOutputs param: %s",
err)
}
r.Variables["symlink_outputs"] = value
}
r.CommandDeps, err = parseNinjaStrings(scope, params.CommandDeps) r.CommandDeps, err = parseNinjaStrings(scope, params.CommandDeps)
if err != nil { if err != nil {
return nil, fmt.Errorf("error parsing CommandDeps param: %s", err) return nil, fmt.Errorf("error parsing CommandDeps param: %s", err)
@ -343,6 +354,12 @@ func parseBuildParams(scope scope, params *BuildParams) (*buildDef,
setVariable("description", value) setVariable("description", value)
} }
if len(params.SymlinkOutputs) > 0 {
setVariable(
"symlink_outputs",
simpleNinjaString(strings.Join(params.SymlinkOutputs, " ")))
}
argNameScope := rule.scope() argNameScope := rule.scope()
if len(params.Args) > 0 { if len(params.Args) > 0 {