Support implicit outputs
Added in Ninja 1.7, for outputs that will not show up in $out.
diff --git a/ninja_defs.go b/ninja_defs.go
index 3233d41..cda2559 100644
--- a/ninja_defs.go
+++ b/ninja_defs.go
@@ -76,14 +76,15 @@
// Ninja build statement. The Args field contains variable names and values
// that are set within the build statement's scope in the Ninja file.
type BuildParams struct {
- Comment string // The comment that will appear above the definition.
- Rule Rule // The rule to invoke.
- Outputs []string // The list of output targets.
- Inputs []string // The list of explicit input dependencies.
- Implicits []string // The list of implicit dependencies.
- OrderOnly []string // The list of order-only dependencies.
- Args map[string]string // The variable/value pairs to set.
- Optional bool // Skip outputting a default statement
+ Comment string // The comment that will appear above the definition.
+ Rule Rule // The rule to invoke.
+ Outputs []string // The list of explicit output targets.
+ ImplicitOutputs []string // The list of implicit output targets.
+ Inputs []string // The list of explicit input dependencies.
+ Implicits []string // The list of implicit input dependencies.
+ OrderOnly []string // The list of order-only dependencies.
+ Args map[string]string // The variable/value pairs to set.
+ Optional bool // Skip outputting a default statement
}
// A poolDef describes a pool definition. It does not include the name of the
@@ -246,15 +247,16 @@
// A buildDef describes a build target definition.
type buildDef struct {
- Comment string
- Rule Rule
- RuleDef *ruleDef
- Outputs []*ninjaString
- Inputs []*ninjaString
- Implicits []*ninjaString
- OrderOnly []*ninjaString
- Args map[Variable]*ninjaString
- Optional bool
+ Comment string
+ Rule Rule
+ RuleDef *ruleDef
+ Outputs []*ninjaString
+ ImplicitOutputs []*ninjaString
+ Inputs []*ninjaString
+ Implicits []*ninjaString
+ OrderOnly []*ninjaString
+ Args map[Variable]*ninjaString
+ Optional bool
}
func parseBuildParams(scope scope, params *BuildParams) (*buildDef,
@@ -282,6 +284,11 @@
return nil, fmt.Errorf("error parsing Outputs param: %s", err)
}
+ b.ImplicitOutputs, err = parseNinjaStrings(scope, params.ImplicitOutputs)
+ if err != nil {
+ return nil, fmt.Errorf("error parsing ImplicitOutputs param: %s", err)
+ }
+
b.Inputs, err = parseNinjaStrings(scope, params.Inputs)
if err != nil {
return nil, fmt.Errorf("error parsing Inputs param: %s", err)
@@ -332,6 +339,7 @@
comment = b.Comment
rule = b.Rule.fullName(pkgNames)
outputs = valueList(b.Outputs, pkgNames, outputEscaper)
+ implicitOuts = valueList(b.ImplicitOutputs, pkgNames, outputEscaper)
explicitDeps = valueList(b.Inputs, pkgNames, inputEscaper)
implicitDeps = valueList(b.Implicits, pkgNames, inputEscaper)
orderOnlyDeps = valueList(b.OrderOnly, pkgNames, inputEscaper)
@@ -341,7 +349,7 @@
implicitDeps = append(valueList(b.RuleDef.CommandDeps, pkgNames, inputEscaper), implicitDeps...)
}
- err := nw.Build(comment, rule, outputs, explicitDeps, implicitDeps, orderOnlyDeps)
+ err := nw.Build(comment, rule, outputs, implicitOuts, explicitDeps, implicitDeps, orderOnlyDeps)
if err != nil {
return err
}