Support multiple outputs for genrule am: 9c8681f4f9
am: 6966d7071f
Change-Id: Iab1dc0b7e789eac9f1e5a7c7e8e45a7d52d337d1
This commit is contained in:
@@ -85,7 +85,7 @@ type taskFunc func(ctx android.ModuleContext) []generateTask
|
|||||||
|
|
||||||
type generateTask struct {
|
type generateTask struct {
|
||||||
in android.Paths
|
in android.Paths
|
||||||
out android.ModuleGenPath
|
out android.WritablePaths
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *generator) GeneratedSourceFiles() android.Paths {
|
func (g *generator) GeneratedSourceFiles() android.Paths {
|
||||||
@@ -167,7 +167,7 @@ func (g *generator) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
func (g *generator) generateSourceFile(ctx android.ModuleContext, task generateTask, tool string) {
|
func (g *generator) generateSourceFile(ctx android.ModuleContext, task generateTask, tool string) {
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
||||||
Rule: g.rule,
|
Rule: g.rule,
|
||||||
Output: task.out,
|
Outputs: task.out,
|
||||||
Inputs: task.in,
|
Inputs: task.in,
|
||||||
Implicits: g.deps,
|
Implicits: g.deps,
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
@@ -175,7 +175,9 @@ func (g *generator) generateSourceFile(ctx android.ModuleContext, task generateT
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
g.outputFiles = append(g.outputFiles, task.out)
|
for _, outputFile := range task.out {
|
||||||
|
g.outputFiles = append(g.outputFiles, outputFile)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func generatorFactory(tasks taskFunc, props ...interface{}) (blueprint.Module, []interface{}) {
|
func generatorFactory(tasks taskFunc, props ...interface{}) (blueprint.Module, []interface{}) {
|
||||||
@@ -197,7 +199,7 @@ func GenSrcsFactory() (blueprint.Module, []interface{}) {
|
|||||||
for _, in := range srcFiles {
|
for _, in := range srcFiles {
|
||||||
tasks = append(tasks, generateTask{
|
tasks = append(tasks, generateTask{
|
||||||
in: android.Paths{in},
|
in: android.Paths{in},
|
||||||
out: android.GenPathWithExt(ctx, in, properties.Output_extension),
|
out: android.WritablePaths{android.GenPathWithExt(ctx, in, properties.Output_extension)},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return tasks
|
return tasks
|
||||||
@@ -218,10 +220,14 @@ func GenRuleFactory() (blueprint.Module, []interface{}) {
|
|||||||
properties := &genRuleProperties{}
|
properties := &genRuleProperties{}
|
||||||
|
|
||||||
tasks := func(ctx android.ModuleContext) []generateTask {
|
tasks := func(ctx android.ModuleContext) []generateTask {
|
||||||
|
outs := make(android.WritablePaths, len(properties.Out))
|
||||||
|
for i, out := range properties.Out {
|
||||||
|
outs[i] = android.PathForModuleGen(ctx, out)
|
||||||
|
}
|
||||||
return []generateTask{
|
return []generateTask{
|
||||||
{
|
{
|
||||||
in: ctx.ExpandSources(properties.Srcs, nil),
|
in: ctx.ExpandSources(properties.Srcs, nil),
|
||||||
out: android.PathForModuleGen(ctx, properties.Out),
|
out: outs,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -233,6 +239,6 @@ type genRuleProperties struct {
|
|||||||
// list of input files
|
// list of input files
|
||||||
Srcs []string
|
Srcs []string
|
||||||
|
|
||||||
// name of the output file that will be generated
|
// names of the output files that will be generated
|
||||||
Out string
|
Out []string
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user