diff options
author | Colin Cross <ccross@android.com> | 2016-11-22 12:55:55 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2016-11-22 15:41:09 -0800 |
commit | 5ed99c64729f7d1cf3eaa2197277a1d6665f6f9d (patch) | |
tree | 6ec04ecb170651cc06efb052f90736793801e828 | |
parent | 33bfb0a36a80fe50510539066d607f9395c8454d (diff) | |
download | build_soong-5ed99c64729f7d1cf3eaa2197277a1d6665f6f9d.tar.gz build_soong-5ed99c64729f7d1cf3eaa2197277a1d6665f6f9d.tar.bz2 build_soong-5ed99c64729f7d1cf3eaa2197277a1d6665f6f9d.zip |
genrule: let Android.bp file specify exported header dirs
Instead of exporting the generated sources dir as headers, let
the Android.bp file specify subdirectories as exported.
Test: m -j checkbuild
Change-Id: I18dd900d63ce7485c8fbfcc39dc77abad6f733d7
-rw-r--r-- | cc/cc.go | 2 | ||||
-rw-r--r-- | genrule/genrule.go | 22 |
2 files changed, 17 insertions, 7 deletions
@@ -786,7 +786,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps { if genRule, ok := m.(genrule.SourceFileGenerator); ok { depPaths.GeneratedHeaders = append(depPaths.GeneratedHeaders, genRule.GeneratedSourceFiles()...) - flags := includeDirsToFlags(android.Paths{genRule.GeneratedHeaderDir()}) + flags := includeDirsToFlags(genRule.GeneratedHeaderDirs()) depPaths.Flags = append(depPaths.Flags, flags) if tag == genHeaderExportDepTag { depPaths.ReexportedFlags = append(depPaths.ReexportedFlags, flags) diff --git a/genrule/genrule.go b/genrule/genrule.go index b1ce8046..bb78b1f8 100644 --- a/genrule/genrule.go +++ b/genrule/genrule.go @@ -34,7 +34,7 @@ var ( type SourceFileGenerator interface { GeneratedSourceFiles() android.Paths - GeneratedHeaderDir() android.Path + GeneratedHeaderDirs() android.Paths } type HostToolProvider interface { @@ -65,6 +65,9 @@ type generatorProperties struct { // Local file that is used as the tool Tool_files []string + + // List of directories to export generated headers from + Export_include_dirs []string } type generator struct { @@ -77,7 +80,7 @@ type generator struct { deps android.Paths rule blueprint.Rule - genPath android.Path + exportedIncludeDirs android.Paths outputFiles android.Paths } @@ -93,8 +96,8 @@ func (g *generator) GeneratedSourceFiles() android.Paths { return g.outputFiles } -func (g *generator) GeneratedHeaderDir() android.Path { - return g.genPath +func (g *generator) GeneratedHeaderDirs() android.Paths { + return g.exportedIncludeDirs } func (g *generator) DepsMutator(ctx android.BottomUpMutatorContext) { @@ -113,7 +116,14 @@ func (g *generator) GenerateAndroidBuildActions(ctx android.ModuleContext) { return } - g.genPath = android.PathForModuleGen(ctx, "") + if len(g.properties.Export_include_dirs) > 0 { + for _, dir := range g.properties.Export_include_dirs { + g.exportedIncludeDirs = append(g.exportedIncludeDirs, + android.PathForModuleGen(ctx, ctx.ModuleDir(), dir)) + } + } else { + g.exportedIncludeDirs = append(g.exportedIncludeDirs, android.PathForModuleGen(ctx, "")) + } tools := map[string]android.Path{} @@ -166,7 +176,7 @@ func (g *generator) GenerateAndroidBuildActions(ctx android.ModuleContext) { } return "${depfile}", nil case "genDir": - return g.genPath.String(), nil + return android.PathForModuleGen(ctx, "").String(), nil default: if strings.HasPrefix(name, "location ") { label := strings.TrimSpace(strings.TrimPrefix(name, "location ")) |