Add export_generated_headers
Similar to export_shared_library_headers, this will export headers imported from a gensrcs or genrule. Bug: 31742855 Test: Add export_generated_headers, ensure it's in out/soong/Android-*.mk Change-Id: Ieadefd007ece8b249f011a258a9c5b27f5d3f594
This commit is contained in:
parent
9c8681f4f9
commit
b3454ab24d
27
cc/cc.go
27
cc/cc.go
|
@ -64,6 +64,8 @@ type Deps struct {
|
|||
GeneratedSources []string
|
||||
GeneratedHeaders []string
|
||||
|
||||
ReexportGeneratedHeaders []string
|
||||
|
||||
CrtBegin, CrtEnd string
|
||||
}
|
||||
|
||||
|
@ -202,6 +204,7 @@ var (
|
|||
wholeStaticDepTag = dependencyTag{name: "whole static", library: true, reexportFlags: true}
|
||||
genSourceDepTag = dependencyTag{name: "gen source"}
|
||||
genHeaderDepTag = dependencyTag{name: "gen header"}
|
||||
genHeaderExportDepTag = dependencyTag{name: "gen header", reexportFlags: true}
|
||||
objDepTag = dependencyTag{name: "obj"}
|
||||
crtBeginDepTag = dependencyTag{name: "crtbegin"}
|
||||
crtEndDepTag = dependencyTag{name: "crtend"}
|
||||
|
@ -503,6 +506,12 @@ func (c *Module) deps(ctx BaseModuleContext) Deps {
|
|||
}
|
||||
}
|
||||
|
||||
for _, gen := range deps.ReexportGeneratedHeaders {
|
||||
if !inList(gen, deps.GeneratedHeaders) {
|
||||
ctx.PropertyErrorf("export_generated_headers", "Generated header module not in generated_headers: '%s'", gen)
|
||||
}
|
||||
}
|
||||
|
||||
return deps
|
||||
}
|
||||
|
||||
|
@ -594,7 +603,14 @@ func (c *Module) depsMutator(actx android.BottomUpMutatorContext) {
|
|||
deps.LateSharedLibs...)
|
||||
|
||||
actx.AddDependency(c, genSourceDepTag, deps.GeneratedSources...)
|
||||
actx.AddDependency(c, genHeaderDepTag, deps.GeneratedHeaders...)
|
||||
|
||||
for _, gen := range deps.GeneratedHeaders {
|
||||
depTag := genHeaderDepTag
|
||||
if inList(gen, deps.ReexportGeneratedHeaders) {
|
||||
depTag = genHeaderExportDepTag
|
||||
}
|
||||
actx.AddDependency(c, depTag, gen)
|
||||
}
|
||||
|
||||
actx.AddDependency(c, objDepTag, deps.ObjFiles...)
|
||||
|
||||
|
@ -736,12 +752,15 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||
} else {
|
||||
ctx.ModuleErrorf("module %q is not a gensrcs or genrule", name)
|
||||
}
|
||||
case genHeaderDepTag:
|
||||
case genHeaderDepTag, genHeaderExportDepTag:
|
||||
if genRule, ok := m.(genrule.SourceFileGenerator); ok {
|
||||
depPaths.GeneratedHeaders = append(depPaths.GeneratedHeaders,
|
||||
genRule.GeneratedSourceFiles()...)
|
||||
depPaths.Flags = append(depPaths.Flags,
|
||||
includeDirsToFlags(android.Paths{genRule.GeneratedHeaderDir()}))
|
||||
flags := includeDirsToFlags(android.Paths{genRule.GeneratedHeaderDir()})
|
||||
depPaths.Flags = append(depPaths.Flags, flags)
|
||||
if tag == genHeaderExportDepTag {
|
||||
depPaths.ReexportedFlags = append(depPaths.ReexportedFlags, flags)
|
||||
}
|
||||
} else {
|
||||
ctx.ModuleErrorf("module %q is not a genrule", name)
|
||||
}
|
||||
|
|
|
@ -67,6 +67,10 @@ type BaseLinkerProperties struct {
|
|||
// present in static_libs.
|
||||
Export_static_lib_headers []string `android:"arch_variant"`
|
||||
|
||||
// list of generated headers to re-export include directories from. Entries must be
|
||||
// present in generated_headers.
|
||||
Export_generated_headers []string `android:"arch_variant"`
|
||||
|
||||
// don't link in crt_begin and crt_end. This flag should only be necessary for
|
||||
// compiling crt or libc.
|
||||
Nocrt *bool `android:"arch_variant"`
|
||||
|
@ -107,6 +111,7 @@ func (linker *baseLinker) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
|
|||
|
||||
deps.ReexportStaticLibHeaders = append(deps.ReexportStaticLibHeaders, linker.Properties.Export_static_lib_headers...)
|
||||
deps.ReexportSharedLibHeaders = append(deps.ReexportSharedLibHeaders, linker.Properties.Export_shared_lib_headers...)
|
||||
deps.ReexportGeneratedHeaders = append(deps.ReexportGeneratedHeaders, linker.Properties.Export_generated_headers...)
|
||||
|
||||
if ctx.ModuleName() != "libcompiler_rt-extras" {
|
||||
deps.LateStaticLibs = append(deps.LateStaticLibs, "libcompiler_rt-extras")
|
||||
|
|
Loading…
Reference in New Issue