Merge "Separate exported includes out of flags"
This commit is contained in:
commit
b879fb6b4b
|
@ -156,12 +156,18 @@ func makeOverrideModuleNames(ctx AndroidMkContext, overrides []string) []string
|
||||||
|
|
||||||
func (library *libraryDecorator) androidMkWriteExportedFlags(w io.Writer) {
|
func (library *libraryDecorator) androidMkWriteExportedFlags(w io.Writer) {
|
||||||
exportedFlags := library.exportedFlags()
|
exportedFlags := library.exportedFlags()
|
||||||
|
for _, dir := range library.exportedDirs() {
|
||||||
|
exportedFlags = append(exportedFlags, "-I"+dir)
|
||||||
|
}
|
||||||
|
for _, dir := range library.exportedSystemDirs() {
|
||||||
|
exportedFlags = append(exportedFlags, "-isystem "+dir)
|
||||||
|
}
|
||||||
if len(exportedFlags) > 0 {
|
if len(exportedFlags) > 0 {
|
||||||
fmt.Fprintln(w, "LOCAL_EXPORT_CFLAGS :=", strings.Join(exportedFlags, " "))
|
fmt.Fprintln(w, "LOCAL_EXPORT_CFLAGS :=", strings.Join(exportedFlags, " "))
|
||||||
}
|
}
|
||||||
exportedFlagsDeps := library.exportedFlagsDeps()
|
exportedDeps := library.exportedDeps()
|
||||||
if len(exportedFlagsDeps) > 0 {
|
if len(exportedDeps) > 0 {
|
||||||
fmt.Fprintln(w, "LOCAL_EXPORT_C_INCLUDE_DEPS :=", strings.Join(exportedFlagsDeps.Strings(), " "))
|
fmt.Fprintln(w, "LOCAL_EXPORT_C_INCLUDE_DEPS :=", strings.Join(exportedDeps.Strings(), " "))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
64
cc/cc.go
64
cc/cc.go
|
@ -119,8 +119,13 @@ type PathDeps struct {
|
||||||
GeneratedSources android.Paths
|
GeneratedSources android.Paths
|
||||||
GeneratedHeaders android.Paths
|
GeneratedHeaders android.Paths
|
||||||
|
|
||||||
Flags, ReexportedFlags []string
|
Flags []string
|
||||||
ReexportedFlagsDeps android.Paths
|
IncludeDirs []string
|
||||||
|
SystemIncludeDirs []string
|
||||||
|
ReexportedDirs []string
|
||||||
|
ReexportedSystemDirs []string
|
||||||
|
ReexportedFlags []string
|
||||||
|
ReexportedDeps android.Paths
|
||||||
|
|
||||||
// Paths to crt*.o files
|
// Paths to crt*.o files
|
||||||
CrtBegin, CrtEnd android.OptionalPath
|
CrtBegin, CrtEnd android.OptionalPath
|
||||||
|
@ -988,6 +993,14 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
||||||
flags.ConlyFlags, _ = filterList(flags.ConlyFlags, config.IllegalFlags)
|
flags.ConlyFlags, _ = filterList(flags.ConlyFlags, config.IllegalFlags)
|
||||||
|
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags, deps.Flags...)
|
flags.GlobalFlags = append(flags.GlobalFlags, deps.Flags...)
|
||||||
|
|
||||||
|
for _, dir := range deps.IncludeDirs {
|
||||||
|
flags.GlobalFlags = append(flags.GlobalFlags, "-I"+dir)
|
||||||
|
}
|
||||||
|
for _, dir := range deps.SystemIncludeDirs {
|
||||||
|
flags.GlobalFlags = append(flags.GlobalFlags, "-isystem "+dir)
|
||||||
|
}
|
||||||
|
|
||||||
c.flags = flags
|
c.flags = flags
|
||||||
// We need access to all the flags seen by a source file.
|
// We need access to all the flags seen by a source file.
|
||||||
if c.sabi != nil {
|
if c.sabi != nil {
|
||||||
|
@ -1578,6 +1591,13 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
||||||
llndkLibraries := llndkLibraries(ctx.Config())
|
llndkLibraries := llndkLibraries(ctx.Config())
|
||||||
vendorPublicLibraries := vendorPublicLibraries(ctx.Config())
|
vendorPublicLibraries := vendorPublicLibraries(ctx.Config())
|
||||||
|
|
||||||
|
reexportExporter := func(exporter exportedFlagsProducer) {
|
||||||
|
depPaths.ReexportedDirs = append(depPaths.ReexportedDirs, exporter.exportedDirs()...)
|
||||||
|
depPaths.ReexportedSystemDirs = append(depPaths.ReexportedSystemDirs, exporter.exportedSystemDirs()...)
|
||||||
|
depPaths.ReexportedFlags = append(depPaths.ReexportedFlags, exporter.exportedFlags()...)
|
||||||
|
depPaths.ReexportedDeps = append(depPaths.ReexportedDeps, exporter.exportedDeps()...)
|
||||||
|
}
|
||||||
|
|
||||||
ctx.VisitDirectDeps(func(dep android.Module) {
|
ctx.VisitDirectDeps(func(dep android.Module) {
|
||||||
depName := ctx.OtherModuleName(dep)
|
depName := ctx.OtherModuleName(dep)
|
||||||
depTag := ctx.OtherModuleDependencyTag(dep)
|
depTag := ctx.OtherModuleDependencyTag(dep)
|
||||||
|
@ -1599,14 +1619,13 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
||||||
if genRule, ok := dep.(genrule.SourceFileGenerator); ok {
|
if genRule, ok := dep.(genrule.SourceFileGenerator); ok {
|
||||||
depPaths.GeneratedHeaders = append(depPaths.GeneratedHeaders,
|
depPaths.GeneratedHeaders = append(depPaths.GeneratedHeaders,
|
||||||
genRule.GeneratedDeps()...)
|
genRule.GeneratedDeps()...)
|
||||||
flags := includeDirsToFlags(genRule.GeneratedHeaderDirs())
|
dirs := genRule.GeneratedHeaderDirs().Strings()
|
||||||
depPaths.Flags = append(depPaths.Flags, flags)
|
depPaths.IncludeDirs = append(depPaths.IncludeDirs, dirs...)
|
||||||
if depTag == genHeaderExportDepTag {
|
if depTag == genHeaderExportDepTag {
|
||||||
depPaths.ReexportedFlags = append(depPaths.ReexportedFlags, flags)
|
depPaths.ReexportedDirs = append(depPaths.ReexportedDirs, dirs...)
|
||||||
depPaths.ReexportedFlagsDeps = append(depPaths.ReexportedFlagsDeps,
|
depPaths.ReexportedDeps = append(depPaths.ReexportedDeps, genRule.GeneratedDeps()...)
|
||||||
genRule.GeneratedDeps()...)
|
|
||||||
// Add these re-exported flags to help header-abi-dumper to infer the abi exported by a library.
|
// Add these re-exported flags to help header-abi-dumper to infer the abi exported by a library.
|
||||||
c.sabi.Properties.ReexportedIncludeFlags = append(c.sabi.Properties.ReexportedIncludeFlags, flags)
|
c.sabi.Properties.ReexportedIncludes = append(c.sabi.Properties.ReexportedIncludes, dirs...)
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1644,10 +1663,9 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
||||||
if depTag == reuseObjTag {
|
if depTag == reuseObjTag {
|
||||||
if l, ok := ccDep.compiler.(libraryInterface); ok {
|
if l, ok := ccDep.compiler.(libraryInterface); ok {
|
||||||
c.staticVariant = ccDep
|
c.staticVariant = ccDep
|
||||||
objs, flags, deps := l.reuseObjs()
|
objs, exporter := l.reuseObjs()
|
||||||
depPaths.Objs = depPaths.Objs.Append(objs)
|
depPaths.Objs = depPaths.Objs.Append(objs)
|
||||||
depPaths.ReexportedFlags = append(depPaths.ReexportedFlags, flags...)
|
reexportExporter(exporter)
|
||||||
depPaths.ReexportedFlagsDeps = append(depPaths.ReexportedFlagsDeps, deps...)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1710,18 +1728,20 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
||||||
}
|
}
|
||||||
|
|
||||||
if i, ok := ccDep.linker.(exportedFlagsProducer); ok {
|
if i, ok := ccDep.linker.(exportedFlagsProducer); ok {
|
||||||
flags := i.exportedFlags()
|
depPaths.IncludeDirs = append(depPaths.IncludeDirs, i.exportedDirs()...)
|
||||||
deps := i.exportedFlagsDeps()
|
depPaths.SystemIncludeDirs = append(depPaths.SystemIncludeDirs, i.exportedSystemDirs()...)
|
||||||
depPaths.Flags = append(depPaths.Flags, flags...)
|
depPaths.GeneratedHeaders = append(depPaths.GeneratedHeaders, i.exportedDeps()...)
|
||||||
depPaths.GeneratedHeaders = append(depPaths.GeneratedHeaders, deps...)
|
depPaths.Flags = append(depPaths.Flags, i.exportedFlags()...)
|
||||||
|
|
||||||
if t.reexportFlags {
|
if t.reexportFlags {
|
||||||
depPaths.ReexportedFlags = append(depPaths.ReexportedFlags, flags...)
|
reexportExporter(i)
|
||||||
depPaths.ReexportedFlagsDeps = append(depPaths.ReexportedFlagsDeps, deps...)
|
|
||||||
// Add these re-exported flags to help header-abi-dumper to infer the abi exported by a library.
|
// Add these re-exported flags to help header-abi-dumper to infer the abi exported by a library.
|
||||||
// Re-exported shared library headers must be included as well since they can help us with type information
|
// Re-exported shared library headers must be included as well since they can help us with type information
|
||||||
// about template instantiations (instantiated from their headers).
|
// about template instantiations (instantiated from their headers).
|
||||||
c.sabi.Properties.ReexportedIncludeFlags = append(c.sabi.Properties.ReexportedIncludeFlags, flags...)
|
// -isystem headers are not included since for bionic libraries, abi-filtering is taken care of by version
|
||||||
|
// scripts.
|
||||||
|
c.sabi.Properties.ReexportedIncludes = append(
|
||||||
|
c.sabi.Properties.ReexportedIncludes, i.exportedDirs()...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1883,12 +1903,16 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
||||||
|
|
||||||
// Dedup exported flags from dependencies
|
// Dedup exported flags from dependencies
|
||||||
depPaths.Flags = android.FirstUniqueStrings(depPaths.Flags)
|
depPaths.Flags = android.FirstUniqueStrings(depPaths.Flags)
|
||||||
|
depPaths.IncludeDirs = android.FirstUniqueStrings(depPaths.IncludeDirs)
|
||||||
|
depPaths.SystemIncludeDirs = android.FirstUniqueStrings(depPaths.SystemIncludeDirs)
|
||||||
depPaths.GeneratedHeaders = android.FirstUniquePaths(depPaths.GeneratedHeaders)
|
depPaths.GeneratedHeaders = android.FirstUniquePaths(depPaths.GeneratedHeaders)
|
||||||
|
depPaths.ReexportedDirs = android.FirstUniqueStrings(depPaths.ReexportedDirs)
|
||||||
|
depPaths.ReexportedSystemDirs = android.FirstUniqueStrings(depPaths.ReexportedSystemDirs)
|
||||||
depPaths.ReexportedFlags = android.FirstUniqueStrings(depPaths.ReexportedFlags)
|
depPaths.ReexportedFlags = android.FirstUniqueStrings(depPaths.ReexportedFlags)
|
||||||
depPaths.ReexportedFlagsDeps = android.FirstUniquePaths(depPaths.ReexportedFlagsDeps)
|
depPaths.ReexportedDeps = android.FirstUniquePaths(depPaths.ReexportedDeps)
|
||||||
|
|
||||||
if c.sabi != nil {
|
if c.sabi != nil {
|
||||||
c.sabi.Properties.ReexportedIncludeFlags = android.FirstUniqueStrings(c.sabi.Properties.ReexportedIncludeFlags)
|
c.sabi.Properties.ReexportedIncludes = android.FirstUniqueStrings(c.sabi.Properties.ReexportedIncludes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return depPaths
|
return depPaths
|
||||||
|
|
|
@ -25,9 +25,7 @@ type kernelHeadersDecorator struct {
|
||||||
func (stub *kernelHeadersDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
|
func (stub *kernelHeadersDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
|
||||||
if ctx.Device() {
|
if ctx.Device() {
|
||||||
f := &stub.libraryDecorator.flagExporter
|
f := &stub.libraryDecorator.flagExporter
|
||||||
for _, dir := range ctx.DeviceConfig().DeviceKernelHeaderDirs() {
|
f.reexportSystemDirs(ctx.DeviceConfig().DeviceKernelHeaderDirs()...)
|
||||||
f.flags = append(f.flags, "-isystem "+dir)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return stub.libraryDecorator.linkStatic(ctx, flags, deps, objs)
|
return stub.libraryDecorator.linkStatic(ctx, flags, deps, objs)
|
||||||
}
|
}
|
||||||
|
|
138
cc/library.go
138
cc/library.go
|
@ -15,6 +15,7 @@
|
||||||
package cc
|
package cc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
@ -207,8 +208,10 @@ func LibraryHeaderFactory() android.Module {
|
||||||
type flagExporter struct {
|
type flagExporter struct {
|
||||||
Properties FlagExporterProperties
|
Properties FlagExporterProperties
|
||||||
|
|
||||||
flags []string
|
dirs []string
|
||||||
flagsDeps android.Paths
|
systemDirs []string
|
||||||
|
flags []string
|
||||||
|
deps android.Paths
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *flagExporter) exportedIncludes(ctx ModuleContext) android.Paths {
|
func (f *flagExporter) exportedIncludes(ctx ModuleContext) android.Paths {
|
||||||
|
@ -219,32 +222,57 @@ func (f *flagExporter) exportedIncludes(ctx ModuleContext) android.Paths {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *flagExporter) exportIncludes(ctx ModuleContext, inc string) {
|
func (f *flagExporter) exportIncludes(ctx ModuleContext) {
|
||||||
includeDirs := f.exportedIncludes(ctx)
|
f.dirs = append(f.dirs, f.exportedIncludes(ctx).Strings()...)
|
||||||
for _, dir := range includeDirs.Strings() {
|
|
||||||
f.flags = append(f.flags, inc+dir)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *flagExporter) reexportFlags(flags []string) {
|
func (f *flagExporter) exportIncludesAsSystem(ctx ModuleContext) {
|
||||||
|
f.systemDirs = append(f.systemDirs, f.exportedIncludes(ctx).Strings()...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *flagExporter) reexportDirs(dirs ...string) {
|
||||||
|
f.dirs = append(f.dirs, dirs...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *flagExporter) reexportSystemDirs(dirs ...string) {
|
||||||
|
f.systemDirs = append(f.systemDirs, dirs...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *flagExporter) reexportFlags(flags ...string) {
|
||||||
|
for _, flag := range flags {
|
||||||
|
if strings.HasPrefix(flag, "-I") || strings.HasPrefix(flag, "-isystem") {
|
||||||
|
panic(fmt.Errorf("Exporting invalid flag %q: "+
|
||||||
|
"use reexportDirs or reexportSystemDirs to export directories", flag))
|
||||||
|
}
|
||||||
|
}
|
||||||
f.flags = append(f.flags, flags...)
|
f.flags = append(f.flags, flags...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *flagExporter) reexportDeps(deps android.Paths) {
|
func (f *flagExporter) reexportDeps(deps ...android.Path) {
|
||||||
f.flagsDeps = append(f.flagsDeps, deps...)
|
f.deps = append(f.deps, deps...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *flagExporter) exportedDirs() []string {
|
||||||
|
return f.dirs
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *flagExporter) exportedSystemDirs() []string {
|
||||||
|
return f.systemDirs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *flagExporter) exportedFlags() []string {
|
func (f *flagExporter) exportedFlags() []string {
|
||||||
return f.flags
|
return f.flags
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *flagExporter) exportedFlagsDeps() android.Paths {
|
func (f *flagExporter) exportedDeps() android.Paths {
|
||||||
return f.flagsDeps
|
return f.deps
|
||||||
}
|
}
|
||||||
|
|
||||||
type exportedFlagsProducer interface {
|
type exportedFlagsProducer interface {
|
||||||
|
exportedDirs() []string
|
||||||
|
exportedSystemDirs() []string
|
||||||
exportedFlags() []string
|
exportedFlags() []string
|
||||||
exportedFlagsDeps() android.Paths
|
exportedDeps() android.Paths
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ exportedFlagsProducer = (*flagExporter)(nil)
|
var _ exportedFlagsProducer = (*flagExporter)(nil)
|
||||||
|
@ -256,9 +284,7 @@ type libraryDecorator struct {
|
||||||
MutatedProperties LibraryMutatedProperties
|
MutatedProperties LibraryMutatedProperties
|
||||||
|
|
||||||
// For reusing static library objects for shared library
|
// For reusing static library objects for shared library
|
||||||
reuseObjects Objects
|
reuseObjects Objects
|
||||||
reuseExportedFlags []string
|
|
||||||
reuseExportedDeps android.Paths
|
|
||||||
|
|
||||||
// table-of-contents file to optimize out relinking when possible
|
// table-of-contents file to optimize out relinking when possible
|
||||||
tocFile android.OptionalPath
|
tocFile android.OptionalPath
|
||||||
|
@ -405,25 +431,6 @@ func (library *libraryDecorator) compilerFlags(ctx ModuleContext, flags Flags, d
|
||||||
return flags
|
return flags
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractExportIncludesFromFlags(flags []string) []string {
|
|
||||||
// This method is used in the generation of rules which produce
|
|
||||||
// abi-dumps for source files. Exported headers are needed to infer the
|
|
||||||
// abi exported by a library and filter out the rest of the abi dumped
|
|
||||||
// from a source. We extract the include flags exported by a library.
|
|
||||||
// This includes the flags exported which are re-exported from static
|
|
||||||
// library dependencies, exported header library dependencies and
|
|
||||||
// generated header dependencies. -isystem headers are not included
|
|
||||||
// since for bionic libraries, abi-filtering is taken care of by version
|
|
||||||
// scripts.
|
|
||||||
var exportedIncludes []string
|
|
||||||
for _, flag := range flags {
|
|
||||||
if strings.HasPrefix(flag, "-I") {
|
|
||||||
exportedIncludes = append(exportedIncludes, flag)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return exportedIncludes
|
|
||||||
}
|
|
||||||
|
|
||||||
func (library *libraryDecorator) shouldCreateVndkSourceAbiDump(ctx ModuleContext) bool {
|
func (library *libraryDecorator) shouldCreateVndkSourceAbiDump(ctx ModuleContext) bool {
|
||||||
if library.Properties.Header_abi_checker.Enabled != nil {
|
if library.Properties.Header_abi_checker.Enabled != nil {
|
||||||
return Bool(library.Properties.Header_abi_checker.Enabled)
|
return Bool(library.Properties.Header_abi_checker.Enabled)
|
||||||
|
@ -456,8 +463,8 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
|
||||||
for _, dir := range exportIncludeDirs.Strings() {
|
for _, dir := range exportIncludeDirs.Strings() {
|
||||||
SourceAbiFlags = append(SourceAbiFlags, "-I"+dir)
|
SourceAbiFlags = append(SourceAbiFlags, "-I"+dir)
|
||||||
}
|
}
|
||||||
for _, reexportedInclude := range extractExportIncludesFromFlags(library.sabi.Properties.ReexportedIncludeFlags) {
|
for _, reexportedInclude := range library.sabi.Properties.ReexportedIncludes {
|
||||||
SourceAbiFlags = append(SourceAbiFlags, reexportedInclude)
|
SourceAbiFlags = append(SourceAbiFlags, "-I"+reexportedInclude)
|
||||||
}
|
}
|
||||||
flags.SAbiFlags = SourceAbiFlags
|
flags.SAbiFlags = SourceAbiFlags
|
||||||
total_length := len(library.baseCompiler.Properties.Srcs) + len(deps.GeneratedSources) + len(library.Properties.Shared.Srcs) +
|
total_length := len(library.baseCompiler.Properties.Srcs) + len(deps.GeneratedSources) + len(library.Properties.Shared.Srcs) +
|
||||||
|
@ -487,7 +494,7 @@ type libraryInterface interface {
|
||||||
getWholeStaticMissingDeps() []string
|
getWholeStaticMissingDeps() []string
|
||||||
static() bool
|
static() bool
|
||||||
objs() Objects
|
objs() Objects
|
||||||
reuseObjs() (Objects, []string, android.Paths)
|
reuseObjs() (Objects, exportedFlagsProducer)
|
||||||
toc() android.OptionalPath
|
toc() android.OptionalPath
|
||||||
|
|
||||||
// Returns true if the build options for the module have selected a static or shared build
|
// Returns true if the build options for the module have selected a static or shared build
|
||||||
|
@ -814,8 +821,8 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec
|
||||||
for _, dir := range exportIncludeDirs.Strings() {
|
for _, dir := range exportIncludeDirs.Strings() {
|
||||||
SourceAbiFlags = append(SourceAbiFlags, "-I"+dir)
|
SourceAbiFlags = append(SourceAbiFlags, "-I"+dir)
|
||||||
}
|
}
|
||||||
for _, reexportedInclude := range extractExportIncludesFromFlags(library.sabi.Properties.ReexportedIncludeFlags) {
|
for _, reexportedInclude := range library.sabi.Properties.ReexportedIncludes {
|
||||||
SourceAbiFlags = append(SourceAbiFlags, reexportedInclude)
|
SourceAbiFlags = append(SourceAbiFlags, "-I"+reexportedInclude)
|
||||||
}
|
}
|
||||||
exportedHeaderFlags := strings.Join(SourceAbiFlags, " ")
|
exportedHeaderFlags := strings.Join(SourceAbiFlags, " ")
|
||||||
library.sAbiOutputFile = TransformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags,
|
library.sAbiOutputFile = TransformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, fileName, exportedHeaderFlags,
|
||||||
|
@ -842,19 +849,17 @@ func (library *libraryDecorator) link(ctx ModuleContext,
|
||||||
out = library.linkShared(ctx, flags, deps, objs)
|
out = library.linkShared(ctx, flags, deps, objs)
|
||||||
}
|
}
|
||||||
|
|
||||||
library.exportIncludes(ctx, "-I")
|
library.exportIncludes(ctx)
|
||||||
library.reexportFlags(deps.ReexportedFlags)
|
library.reexportDirs(deps.ReexportedDirs...)
|
||||||
library.reexportDeps(deps.ReexportedFlagsDeps)
|
library.reexportSystemDirs(deps.ReexportedSystemDirs...)
|
||||||
|
library.reexportFlags(deps.ReexportedFlags...)
|
||||||
|
library.reexportDeps(deps.ReexportedDeps...)
|
||||||
|
|
||||||
if Bool(library.Properties.Aidl.Export_aidl_headers) {
|
if Bool(library.Properties.Aidl.Export_aidl_headers) {
|
||||||
if library.baseCompiler.hasSrcExt(".aidl") {
|
if library.baseCompiler.hasSrcExt(".aidl") {
|
||||||
flags := []string{
|
dir := android.PathForModuleGen(ctx, "aidl").String()
|
||||||
"-I" + android.PathForModuleGen(ctx, "aidl").String(),
|
library.reexportDirs(dir)
|
||||||
}
|
library.reexportDeps(library.baseCompiler.pathDeps...) // TODO: restrict to aidl deps
|
||||||
library.reexportFlags(flags)
|
|
||||||
library.reuseExportedFlags = append(library.reuseExportedFlags, flags...)
|
|
||||||
library.reexportDeps(library.baseCompiler.pathDeps) // TODO: restrict to aidl deps
|
|
||||||
library.reuseExportedDeps = append(library.reuseExportedDeps, library.baseCompiler.pathDeps...)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -862,26 +867,16 @@ func (library *libraryDecorator) link(ctx ModuleContext,
|
||||||
if library.baseCompiler.hasSrcExt(".proto") {
|
if library.baseCompiler.hasSrcExt(".proto") {
|
||||||
includes := []string{}
|
includes := []string{}
|
||||||
if flags.proto.CanonicalPathFromRoot {
|
if flags.proto.CanonicalPathFromRoot {
|
||||||
includes = append(includes, "-I"+flags.proto.SubDir.String())
|
includes = append(includes, flags.proto.SubDir.String())
|
||||||
}
|
}
|
||||||
includes = append(includes, "-I"+flags.proto.Dir.String())
|
includes = append(includes, flags.proto.Dir.String())
|
||||||
library.reexportFlags(includes)
|
library.reexportDirs(includes...)
|
||||||
library.reuseExportedFlags = append(library.reuseExportedFlags, includes...)
|
library.reexportDeps(library.baseCompiler.pathDeps...) // TODO: restrict to proto deps
|
||||||
library.reexportDeps(library.baseCompiler.pathDeps) // TODO: restrict to proto deps
|
|
||||||
library.reuseExportedDeps = append(library.reuseExportedDeps, library.baseCompiler.pathDeps...)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if library.baseCompiler.hasSrcExt(".sysprop") {
|
if library.baseCompiler.hasSrcExt(".sysprop") {
|
||||||
internalFlags := []string{
|
dir := android.PathForModuleGen(ctx, "sysprop", "include").String()
|
||||||
"-I" + android.PathForModuleGen(ctx, "sysprop", "include").String(),
|
|
||||||
}
|
|
||||||
systemFlags := []string{
|
|
||||||
"-I" + android.PathForModuleGen(ctx, "sysprop/system", "include").String(),
|
|
||||||
}
|
|
||||||
|
|
||||||
flags := internalFlags
|
|
||||||
|
|
||||||
if library.Properties.Sysprop.Platform != nil {
|
if library.Properties.Sysprop.Platform != nil {
|
||||||
isProduct := ctx.ProductSpecific() && !ctx.useVndk()
|
isProduct := ctx.ProductSpecific() && !ctx.useVndk()
|
||||||
isVendor := ctx.useVndk()
|
isVendor := ctx.useVndk()
|
||||||
|
@ -890,17 +885,16 @@ func (library *libraryDecorator) link(ctx ModuleContext,
|
||||||
useSystem := isProduct || (isOwnerPlatform == isVendor)
|
useSystem := isProduct || (isOwnerPlatform == isVendor)
|
||||||
|
|
||||||
if useSystem {
|
if useSystem {
|
||||||
flags = systemFlags
|
dir = android.PathForModuleGen(ctx, "sysprop/system", "include").String()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
library.reexportFlags(flags)
|
library.reexportDirs(dir)
|
||||||
library.reexportDeps(library.baseCompiler.pathDeps)
|
library.reexportDeps(library.baseCompiler.pathDeps...)
|
||||||
library.reuseExportedFlags = append(library.reuseExportedFlags, flags...)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if library.buildStubs() {
|
if library.buildStubs() {
|
||||||
library.reexportFlags([]string{"-D" + versioningMacroName(ctx.ModuleName()) + "=" + library.stubsVersion()})
|
library.reexportFlags("-D" + versioningMacroName(ctx.ModuleName()) + "=" + library.stubsVersion())
|
||||||
}
|
}
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
@ -922,8 +916,8 @@ func (library *libraryDecorator) objs() Objects {
|
||||||
return library.objects
|
return library.objects
|
||||||
}
|
}
|
||||||
|
|
||||||
func (library *libraryDecorator) reuseObjs() (Objects, []string, android.Paths) {
|
func (library *libraryDecorator) reuseObjs() (Objects, exportedFlagsProducer) {
|
||||||
return library.reuseObjects, library.reuseExportedFlags, library.reuseExportedDeps
|
return library.reuseObjects, &library.flagExporter
|
||||||
}
|
}
|
||||||
|
|
||||||
func (library *libraryDecorator) toc() android.OptionalPath {
|
func (library *libraryDecorator) toc() android.OptionalPath {
|
||||||
|
|
|
@ -145,17 +145,17 @@ func (stub *llndkStubDecorator) link(ctx ModuleContext, flags Flags, deps PathDe
|
||||||
timestampFiles = append(timestampFiles, stub.processHeaders(ctx, dir, genHeaderOutDir))
|
timestampFiles = append(timestampFiles, stub.processHeaders(ctx, dir, genHeaderOutDir))
|
||||||
}
|
}
|
||||||
|
|
||||||
includePrefix := "-I"
|
|
||||||
if Bool(stub.Properties.Export_headers_as_system) {
|
if Bool(stub.Properties.Export_headers_as_system) {
|
||||||
includePrefix = "-isystem "
|
stub.reexportSystemDirs(genHeaderOutDir.String())
|
||||||
|
} else {
|
||||||
|
stub.reexportDirs(genHeaderOutDir.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
stub.reexportFlags([]string{includePrefix + genHeaderOutDir.String()})
|
stub.reexportDeps(timestampFiles...)
|
||||||
stub.reexportDeps(timestampFiles)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if Bool(stub.Properties.Export_headers_as_system) {
|
if Bool(stub.Properties.Export_headers_as_system) {
|
||||||
stub.exportIncludes(ctx, "-isystem ")
|
stub.exportIncludesAsSystem(ctx)
|
||||||
stub.libraryDecorator.flagExporter.Properties.Export_include_dirs = []string{}
|
stub.libraryDecorator.flagExporter.Properties.Export_include_dirs = []string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ func (ndk *ndkPrebuiltStlLinker) link(ctx ModuleContext, flags Flags,
|
||||||
ctx.ModuleErrorf("NDK prebuilt libraries must have an ndk_lib prefixed name")
|
ctx.ModuleErrorf("NDK prebuilt libraries must have an ndk_lib prefixed name")
|
||||||
}
|
}
|
||||||
|
|
||||||
ndk.exportIncludes(ctx, "-isystem ")
|
ndk.exportIncludesAsSystem(ctx)
|
||||||
|
|
||||||
libName := strings.TrimPrefix(ctx.ModuleName(), "ndk_")
|
libName := strings.TrimPrefix(ctx.ModuleName(), "ndk_")
|
||||||
libExt := flags.Toolchain.ShlibSuffix()
|
libExt := flags.Toolchain.ShlibSuffix()
|
||||||
|
|
|
@ -85,9 +85,11 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext,
|
||||||
flags Flags, deps PathDeps, objs Objects) android.Path {
|
flags Flags, deps PathDeps, objs Objects) android.Path {
|
||||||
// TODO(ccross): verify shared library dependencies
|
// TODO(ccross): verify shared library dependencies
|
||||||
if len(p.properties.Srcs) > 0 {
|
if len(p.properties.Srcs) > 0 {
|
||||||
p.libraryDecorator.exportIncludes(ctx, "-I")
|
p.libraryDecorator.exportIncludes(ctx)
|
||||||
p.libraryDecorator.reexportFlags(deps.ReexportedFlags)
|
p.libraryDecorator.reexportDirs(deps.ReexportedDirs...)
|
||||||
p.libraryDecorator.reexportDeps(deps.ReexportedFlagsDeps)
|
p.libraryDecorator.reexportSystemDirs(deps.ReexportedSystemDirs...)
|
||||||
|
p.libraryDecorator.reexportFlags(deps.ReexportedFlags...)
|
||||||
|
p.libraryDecorator.reexportDeps(deps.ReexportedDeps...)
|
||||||
|
|
||||||
builderFlags := flagsToBuilderFlags(flags)
|
builderFlags := flagsToBuilderFlags(flags)
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
type SAbiProperties struct {
|
type SAbiProperties struct {
|
||||||
CreateSAbiDumps bool `blueprint:"mutated"`
|
CreateSAbiDumps bool `blueprint:"mutated"`
|
||||||
ReexportedIncludeFlags []string
|
ReexportedIncludes []string `blueprint:"mutated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type sabi struct {
|
type sabi struct {
|
||||||
|
|
|
@ -29,10 +29,6 @@ func includeDirsToFlags(dirs android.Paths) string {
|
||||||
return android.JoinWithPrefix(dirs.Strings(), "-I")
|
return android.JoinWithPrefix(dirs.Strings(), "-I")
|
||||||
}
|
}
|
||||||
|
|
||||||
func includeFilesToFlags(files android.Paths) string {
|
|
||||||
return android.JoinWithPrefix(files.Strings(), "-include ")
|
|
||||||
}
|
|
||||||
|
|
||||||
func ldDirsToFlags(dirs []string) string {
|
func ldDirsToFlags(dirs []string) string {
|
||||||
return android.JoinWithPrefix(dirs, "-L")
|
return android.JoinWithPrefix(dirs, "-L")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue