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:
@@ -34,16 +34,18 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ModuleBuildParams struct {
|
type ModuleBuildParams struct {
|
||||||
Rule blueprint.Rule
|
Rule blueprint.Rule
|
||||||
Output WritablePath
|
Output WritablePath
|
||||||
Outputs WritablePaths
|
Outputs WritablePaths
|
||||||
Input Path
|
ImplicitOutput WritablePath
|
||||||
Inputs Paths
|
ImplicitOutputs WritablePaths
|
||||||
Implicit Path
|
Input Path
|
||||||
Implicits Paths
|
Inputs Paths
|
||||||
OrderOnly Paths
|
Implicit Path
|
||||||
Default bool
|
Implicits Paths
|
||||||
Args map[string]string
|
OrderOnly Paths
|
||||||
|
Default bool
|
||||||
|
Args map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
type androidBaseContext interface {
|
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) {
|
func (a *androidModuleContext) ModuleBuild(pctx blueprint.PackageContext, params ModuleBuildParams) {
|
||||||
bparams := blueprint.BuildParams{
|
bparams := blueprint.BuildParams{
|
||||||
Rule: params.Rule,
|
Rule: params.Rule,
|
||||||
Outputs: params.Outputs.Strings(),
|
Outputs: params.Outputs.Strings(),
|
||||||
Inputs: params.Inputs.Strings(),
|
ImplicitOutputs: params.ImplicitOutputs.Strings(),
|
||||||
Implicits: params.Implicits.Strings(),
|
Inputs: params.Inputs.Strings(),
|
||||||
OrderOnly: params.OrderOnly.Strings(),
|
Implicits: params.Implicits.Strings(),
|
||||||
Args: params.Args,
|
OrderOnly: params.OrderOnly.Strings(),
|
||||||
Optional: !params.Default,
|
Args: params.Args,
|
||||||
|
Optional: !params.Default,
|
||||||
}
|
}
|
||||||
|
|
||||||
if params.Output != nil {
|
if params.Output != nil {
|
||||||
bparams.Outputs = append(bparams.Outputs, params.Output.String())
|
bparams.Outputs = append(bparams.Outputs, params.Output.String())
|
||||||
}
|
}
|
||||||
|
if params.ImplicitOutput != nil {
|
||||||
|
bparams.ImplicitOutputs = append(bparams.ImplicitOutputs, params.ImplicitOutput.String())
|
||||||
|
}
|
||||||
if params.Input != nil {
|
if params.Input != nil {
|
||||||
bparams.Inputs = append(bparams.Inputs, params.Input.String())
|
bparams.Inputs = append(bparams.Inputs, params.Input.String())
|
||||||
}
|
}
|
||||||
|
12
cc/gen.go
12
cc/gen.go
@@ -33,11 +33,11 @@ func init() {
|
|||||||
var (
|
var (
|
||||||
yacc = pctx.AndroidStaticRule("yacc",
|
yacc = pctx.AndroidStaticRule("yacc",
|
||||||
blueprint.RuleParams{
|
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"},
|
CommandDeps: []string{"$yaccCmd"},
|
||||||
Description: "yacc $out",
|
Description: "yacc $out",
|
||||||
},
|
},
|
||||||
"yaccFlags", "cFile", "hFile")
|
"yaccFlags", "hFile")
|
||||||
|
|
||||||
lex = pctx.AndroidStaticRule("lex",
|
lex = pctx.AndroidStaticRule("lex",
|
||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
@@ -51,12 +51,12 @@ func genYacc(ctx android.ModuleContext, yaccFile android.Path, outFile android.M
|
|||||||
headerFile = android.GenPathWithExt(ctx, "yacc", yaccFile, "h")
|
headerFile = android.GenPathWithExt(ctx, "yacc", yaccFile, "h")
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
||||||
Rule: yacc,
|
Rule: yacc,
|
||||||
Outputs: android.WritablePaths{outFile, headerFile},
|
Output: outFile,
|
||||||
Input: yaccFile,
|
ImplicitOutput: headerFile,
|
||||||
|
Input: yaccFile,
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"yaccFlags": yaccFlags,
|
"yaccFlags": yaccFlags,
|
||||||
"cFile": outFile.String(),
|
|
||||||
"hFile": headerFile.String(),
|
"hFile": headerFile.String(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user