Add support for Implicit Outputs

am: 9f3c574a39

Change-Id: I6958429c73a4c6e656241b75d444506a2832acc1
This commit is contained in:
Dan Willemsen 2016-11-04 00:53:59 +00:00 committed by android-build-merger
commit 610c494886
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(),
},
})