Add support for Implicit Outputs

Test: mmma -j system/tools/hidl
Test: Inspect out/soong/build.ninja before/after
Change-Id: I8e91a033342a12302d51358c5be244e32ad689d7
This commit is contained in:
Dan Willemsen 2016-11-03 14:28:31 -07:00
parent d8f2014d3b
commit 9f3c574a39
2 changed files with 29 additions and 23 deletions

View file

@ -34,16 +34,18 @@ var (
)
type ModuleBuildParams struct {
Rule blueprint.Rule
Output WritablePath
Outputs WritablePaths
Input Path
Inputs Paths
Implicit Path
Implicits Paths
OrderOnly Paths
Default bool
Args map[string]string
Rule blueprint.Rule
Output WritablePath
Outputs WritablePaths
ImplicitOutput WritablePath
ImplicitOutputs WritablePaths
Input Path
Inputs Paths
Implicit Path
Implicits Paths
OrderOnly Paths
Default bool
Args map[string]string
}
type androidBaseContext interface {
@ -519,18 +521,22 @@ func (a *androidModuleContext) Build(pctx blueprint.PackageContext, params bluep
func (a *androidModuleContext) ModuleBuild(pctx blueprint.PackageContext, params ModuleBuildParams) {
bparams := blueprint.BuildParams{
Rule: params.Rule,
Outputs: params.Outputs.Strings(),
Inputs: params.Inputs.Strings(),
Implicits: params.Implicits.Strings(),
OrderOnly: params.OrderOnly.Strings(),
Args: params.Args,
Optional: !params.Default,
Rule: params.Rule,
Outputs: params.Outputs.Strings(),
ImplicitOutputs: params.ImplicitOutputs.Strings(),
Inputs: params.Inputs.Strings(),
Implicits: params.Implicits.Strings(),
OrderOnly: params.OrderOnly.Strings(),
Args: params.Args,
Optional: !params.Default,
}
if params.Output != nil {
bparams.Outputs = append(bparams.Outputs, params.Output.String())
}
if params.ImplicitOutput != nil {
bparams.ImplicitOutputs = append(bparams.ImplicitOutputs, params.ImplicitOutput.String())
}
if params.Input != nil {
bparams.Inputs = append(bparams.Inputs, params.Input.String())
}

View file

@ -33,11 +33,11 @@ func init() {
var (
yacc = pctx.AndroidStaticRule("yacc",
blueprint.RuleParams{
Command: "BISON_PKGDATADIR=$yaccDataDir $yaccCmd -d $yaccFlags --defines=$hFile -o $cFile $in",
Command: "BISON_PKGDATADIR=$yaccDataDir $yaccCmd -d $yaccFlags --defines=$hFile -o $out $in",
CommandDeps: []string{"$yaccCmd"},
Description: "yacc $out",
},
"yaccFlags", "cFile", "hFile")
"yaccFlags", "hFile")
lex = pctx.AndroidStaticRule("lex",
blueprint.RuleParams{
@ -51,12 +51,12 @@ func genYacc(ctx android.ModuleContext, yaccFile android.Path, outFile android.M
headerFile = android.GenPathWithExt(ctx, "yacc", yaccFile, "h")
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
Rule: yacc,
Outputs: android.WritablePaths{outFile, headerFile},
Input: yaccFile,
Rule: yacc,
Output: outFile,
ImplicitOutput: headerFile,
Input: yaccFile,
Args: map[string]string{
"yaccFlags": yaccFlags,
"cFile": outFile.String(),
"hFile": headerFile.String(),
},
})