Fix generated sources and headers

Add two cc properties: `generated_sources` and `generated_headers`,
instead of just adding genrule modules to `deps`. Label these with the
dep tagging mechanism, add the generated_headers paths to the include
paths, and add dependencies to generated headers for each compile.

Add dependencies so that regular sources can include generated yacc
headers, not just other generated lex/yacc files. Static/shared specific
sources still don't have dependencies to or from regular sources though.

Switch from an implicit dependency on generated files to an orderonly
dependency, since the depfile will take care of the necessary implicit
dependencies for incremental builds.

Change-Id: I436675acb1f57329d98b81c56dcb4384201a68ea
This commit is contained in:
Dan Willemsen
2016-04-20 14:21:14 -07:00
parent 21b481b757
commit b40aab6955
3 changed files with 74 additions and 26 deletions

View File

@@ -39,6 +39,7 @@ func init() {
type SourceFileGenerator interface {
GeneratedSourceFiles() common.Paths
GeneratedHeaderDir() common.Path
}
type HostToolProvider interface {
@@ -68,6 +69,8 @@ type generator struct {
deps common.Paths
rule blueprint.Rule
genPath common.Path
outputFiles common.Paths
}
@@ -82,6 +85,10 @@ func (g *generator) GeneratedSourceFiles() common.Paths {
return g.outputFiles
}
func (g *generator) GeneratedHeaderDir() common.Path {
return g.genPath
}
func genruleDepsMutator(ctx common.AndroidBottomUpMutatorContext) {
if g, ok := ctx.Module().(*generator); ok {
if g.properties.Tool != "" {
@@ -111,6 +118,8 @@ func (g *generator) GenerateAndroidBuildActions(ctx common.AndroidModuleContext)
}
})
g.genPath = common.PathForModuleGen(ctx, "")
for _, task := range g.tasks(ctx) {
g.generateSourceFile(ctx, task)
}