From 8a43c1bb1ed5d04dafb2b97d2fc940766e259df3 Mon Sep 17 00:00:00 2001 From: Jingwen Chen Date: Wed, 7 Oct 2020 11:57:54 +0800 Subject: [PATCH 1/2] Add CODEOWNERS: @google/blueprint --- CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..8cf6944 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @google/blueprint From fd8af0b082427e47f3b1f2dcd79a0cbb48967fea Mon Sep 17 00:00:00 2001 From: Jingwen Chen Date: Tue, 6 Oct 2020 08:52:27 +0800 Subject: [PATCH 2/2] Add support for symlink_outputs to Blueprint --- ninja_defs.go | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/ninja_defs.go b/ninja_defs.go index 8c5db57..33fbc47 100644 --- a/ninja_defs.go +++ b/ninja_defs.go @@ -56,15 +56,16 @@ type PoolParams struct { // definition. type RuleParams struct { // These fields correspond to a Ninja variable of the same name. - Command string // The command that Ninja will run for the rule. - Depfile string // The dependency file name. - Deps Deps // The format of the dependency file. - Description string // The description that Ninja will print for the rule. - Generator bool // Whether the rule generates the Ninja manifest file. - Pool Pool // The Ninja pool to which the rule belongs. - Restat bool // Whether Ninja should re-stat the rule's outputs. - Rspfile string // The response file. - RspfileContent string // The response file content. + Command string // The command that Ninja will run for the rule. + Depfile string // The dependency file name. + Deps Deps // The format of the dependency file. + Description string // The description that Ninja will print for the rule. + Generator bool // Whether the rule generates the Ninja manifest file. + Pool Pool // The Ninja pool to which the rule belongs. + Restat bool // Whether Ninja should re-stat the rule's outputs. + Rspfile string // The response file. + RspfileContent string // The response file content. + SymlinkOutputs []string // The list of Outputs or ImplicitOutputs that are symlinks. // These fields are used internally in Blueprint CommandDeps []string // Command-specific implicit dependencies to prepend to builds @@ -84,6 +85,7 @@ type BuildParams struct { Rule Rule // The rule to invoke. Outputs []string // The list of explicit 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. Implicits []string // The list of implicit input 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 } + 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) if err != nil { return nil, fmt.Errorf("error parsing CommandDeps param: %s", err) @@ -343,6 +354,12 @@ func parseBuildParams(scope scope, params *BuildParams) (*buildDef, setVariable("description", value) } + if len(params.SymlinkOutputs) > 0 { + setVariable( + "symlink_outputs", + simpleNinjaString(strings.Join(params.SymlinkOutputs, " "))) + } + argNameScope := rule.scope() if len(params.Args) > 0 {