Add support for Optional parameter to build definitions

Build definitions can now specify Optional.  If Optional is not
specified the build definition will be followed by a default definition
for all outputs.

Change-Id: Iada83b2ef32bfb599b3cc580263f12bc002e1cdb
This commit is contained in:
Colin Cross 2014-11-06 14:26:38 -08:00
parent 701fbad02b
commit aa847f2893

View file

@ -227,6 +227,7 @@ type buildDef struct {
Implicits []*ninjaString Implicits []*ninjaString
OrderOnly []*ninjaString OrderOnly []*ninjaString
Args map[Variable]*ninjaString Args map[Variable]*ninjaString
Optional bool
} }
func parseBuildParams(scope scope, params *BuildParams) (*buildDef, func parseBuildParams(scope scope, params *BuildParams) (*buildDef,
@ -327,6 +328,10 @@ func (b *buildDef) WriteTo(nw *ninjaWriter, pkgNames map[*PackageContext]string)
} }
} }
if !b.Optional {
nw.Default(outputs...)
}
return nil return nil
} }