Change exportedDirs and exportedSystemDirs from []string to android.Paths
exportedDirs and exportedSystemDirs are now changed to android.Paths so that we can later manipulate the paths via Rel(), etc. Test: m Change-Id: I6fb02ea4983bcebac351bc284f75b44885379e8f
This commit is contained in:
parent
8141c8781a
commit
7495504db4
|
@ -148,10 +148,10 @@ func makeOverrideModuleNames(ctx AndroidMkContext, overrides []string) []string
|
|||
func (library *libraryDecorator) androidMkWriteExportedFlags(w io.Writer) {
|
||||
exportedFlags := library.exportedFlags()
|
||||
for _, dir := range library.exportedDirs() {
|
||||
exportedFlags = append(exportedFlags, "-I"+dir)
|
||||
exportedFlags = append(exportedFlags, "-I"+dir.String())
|
||||
}
|
||||
for _, dir := range library.exportedSystemDirs() {
|
||||
exportedFlags = append(exportedFlags, "-isystem "+dir)
|
||||
exportedFlags = append(exportedFlags, "-isystem "+dir.String())
|
||||
}
|
||||
if len(exportedFlags) > 0 {
|
||||
fmt.Fprintln(w, "LOCAL_EXPORT_CFLAGS :=", strings.Join(exportedFlags, " "))
|
||||
|
|
26
cc/cc.go
26
cc/cc.go
|
@ -123,10 +123,10 @@ type PathDeps struct {
|
|||
GeneratedHeaders android.Paths
|
||||
|
||||
Flags []string
|
||||
IncludeDirs []string
|
||||
SystemIncludeDirs []string
|
||||
ReexportedDirs []string
|
||||
ReexportedSystemDirs []string
|
||||
IncludeDirs android.Paths
|
||||
SystemIncludeDirs android.Paths
|
||||
ReexportedDirs android.Paths
|
||||
ReexportedSystemDirs android.Paths
|
||||
ReexportedFlags []string
|
||||
ReexportedDeps android.Paths
|
||||
|
||||
|
@ -1101,10 +1101,10 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|||
flags.GlobalFlags = append(flags.GlobalFlags, deps.Flags...)
|
||||
|
||||
for _, dir := range deps.IncludeDirs {
|
||||
flags.GlobalFlags = append(flags.GlobalFlags, "-I"+dir)
|
||||
flags.GlobalFlags = append(flags.GlobalFlags, "-I"+dir.String())
|
||||
}
|
||||
for _, dir := range deps.SystemIncludeDirs {
|
||||
flags.GlobalFlags = append(flags.GlobalFlags, "-isystem "+dir)
|
||||
flags.GlobalFlags = append(flags.GlobalFlags, "-isystem "+dir.String())
|
||||
}
|
||||
|
||||
c.flags = flags
|
||||
|
@ -1730,13 +1730,13 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||
if genRule, ok := dep.(genrule.SourceFileGenerator); ok {
|
||||
depPaths.GeneratedHeaders = append(depPaths.GeneratedHeaders,
|
||||
genRule.GeneratedDeps()...)
|
||||
dirs := genRule.GeneratedHeaderDirs().Strings()
|
||||
dirs := genRule.GeneratedHeaderDirs()
|
||||
depPaths.IncludeDirs = append(depPaths.IncludeDirs, dirs...)
|
||||
if depTag == genHeaderExportDepTag {
|
||||
depPaths.ReexportedDirs = append(depPaths.ReexportedDirs, dirs...)
|
||||
depPaths.ReexportedDeps = append(depPaths.ReexportedDeps, genRule.GeneratedDeps()...)
|
||||
// Add these re-exported flags to help header-abi-dumper to infer the abi exported by a library.
|
||||
c.sabi.Properties.ReexportedIncludes = append(c.sabi.Properties.ReexportedIncludes, dirs...)
|
||||
c.sabi.Properties.ReexportedIncludes = append(c.sabi.Properties.ReexportedIncludes, dirs.Strings()...)
|
||||
|
||||
}
|
||||
} else {
|
||||
|
@ -1852,7 +1852,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||
// -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()...)
|
||||
c.sabi.Properties.ReexportedIncludes, i.exportedDirs().Strings()...)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2026,11 +2026,11 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||
|
||||
// Dedup exported flags from dependencies
|
||||
depPaths.Flags = android.FirstUniqueStrings(depPaths.Flags)
|
||||
depPaths.IncludeDirs = android.FirstUniqueStrings(depPaths.IncludeDirs)
|
||||
depPaths.SystemIncludeDirs = android.FirstUniqueStrings(depPaths.SystemIncludeDirs)
|
||||
depPaths.IncludeDirs = android.FirstUniquePaths(depPaths.IncludeDirs)
|
||||
depPaths.SystemIncludeDirs = android.FirstUniquePaths(depPaths.SystemIncludeDirs)
|
||||
depPaths.GeneratedHeaders = android.FirstUniquePaths(depPaths.GeneratedHeaders)
|
||||
depPaths.ReexportedDirs = android.FirstUniqueStrings(depPaths.ReexportedDirs)
|
||||
depPaths.ReexportedSystemDirs = android.FirstUniqueStrings(depPaths.ReexportedSystemDirs)
|
||||
depPaths.ReexportedDirs = android.FirstUniquePaths(depPaths.ReexportedDirs)
|
||||
depPaths.ReexportedSystemDirs = android.FirstUniquePaths(depPaths.ReexportedSystemDirs)
|
||||
depPaths.ReexportedFlags = android.FirstUniqueStrings(depPaths.ReexportedFlags)
|
||||
depPaths.ReexportedDeps = android.FirstUniquePaths(depPaths.ReexportedDeps)
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ type kernelHeadersDecorator struct {
|
|||
func (stub *kernelHeadersDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
|
||||
if ctx.Device() {
|
||||
f := &stub.libraryDecorator.flagExporter
|
||||
f.reexportSystemDirs(ctx.DeviceConfig().DeviceKernelHeaderDirs()...)
|
||||
f.reexportSystemDirs(android.PathsForSource(ctx, ctx.DeviceConfig().DeviceKernelHeaderDirs())...)
|
||||
}
|
||||
return stub.libraryDecorator.linkStatic(ctx, flags, deps, objs)
|
||||
}
|
||||
|
|
|
@ -229,8 +229,8 @@ func LibraryHeaderFactory() android.Module {
|
|||
type flagExporter struct {
|
||||
Properties FlagExporterProperties
|
||||
|
||||
dirs []string
|
||||
systemDirs []string
|
||||
dirs android.Paths
|
||||
systemDirs android.Paths
|
||||
flags []string
|
||||
deps android.Paths
|
||||
}
|
||||
|
@ -244,18 +244,18 @@ func (f *flagExporter) exportedIncludes(ctx ModuleContext) android.Paths {
|
|||
}
|
||||
|
||||
func (f *flagExporter) exportIncludes(ctx ModuleContext) {
|
||||
f.dirs = append(f.dirs, f.exportedIncludes(ctx).Strings()...)
|
||||
f.dirs = append(f.dirs, f.exportedIncludes(ctx)...)
|
||||
}
|
||||
|
||||
func (f *flagExporter) exportIncludesAsSystem(ctx ModuleContext) {
|
||||
f.systemDirs = append(f.systemDirs, f.exportedIncludes(ctx).Strings()...)
|
||||
f.systemDirs = append(f.systemDirs, f.exportedIncludes(ctx)...)
|
||||
}
|
||||
|
||||
func (f *flagExporter) reexportDirs(dirs ...string) {
|
||||
func (f *flagExporter) reexportDirs(dirs ...android.Path) {
|
||||
f.dirs = append(f.dirs, dirs...)
|
||||
}
|
||||
|
||||
func (f *flagExporter) reexportSystemDirs(dirs ...string) {
|
||||
func (f *flagExporter) reexportSystemDirs(dirs ...android.Path) {
|
||||
f.systemDirs = append(f.systemDirs, dirs...)
|
||||
}
|
||||
|
||||
|
@ -273,11 +273,11 @@ func (f *flagExporter) reexportDeps(deps ...android.Path) {
|
|||
f.deps = append(f.deps, deps...)
|
||||
}
|
||||
|
||||
func (f *flagExporter) exportedDirs() []string {
|
||||
func (f *flagExporter) exportedDirs() android.Paths {
|
||||
return f.dirs
|
||||
}
|
||||
|
||||
func (f *flagExporter) exportedSystemDirs() []string {
|
||||
func (f *flagExporter) exportedSystemDirs() android.Paths {
|
||||
return f.systemDirs
|
||||
}
|
||||
|
||||
|
@ -290,8 +290,8 @@ func (f *flagExporter) exportedDeps() android.Paths {
|
|||
}
|
||||
|
||||
type exportedFlagsProducer interface {
|
||||
exportedDirs() []string
|
||||
exportedSystemDirs() []string
|
||||
exportedDirs() android.Paths
|
||||
exportedSystemDirs() android.Paths
|
||||
exportedFlags() []string
|
||||
exportedDeps() android.Paths
|
||||
}
|
||||
|
@ -954,7 +954,7 @@ func (library *libraryDecorator) link(ctx ModuleContext,
|
|||
|
||||
if Bool(library.Properties.Aidl.Export_aidl_headers) {
|
||||
if library.baseCompiler.hasSrcExt(".aidl") {
|
||||
dir := android.PathForModuleGen(ctx, "aidl").String()
|
||||
dir := android.PathForModuleGen(ctx, "aidl")
|
||||
library.reexportDirs(dir)
|
||||
library.reexportDeps(library.baseCompiler.pathDeps...) // TODO: restrict to aidl deps
|
||||
}
|
||||
|
@ -962,25 +962,25 @@ func (library *libraryDecorator) link(ctx ModuleContext,
|
|||
|
||||
if Bool(library.Properties.Proto.Export_proto_headers) {
|
||||
if library.baseCompiler.hasSrcExt(".proto") {
|
||||
includes := []string{}
|
||||
var includes android.Paths
|
||||
if flags.proto.CanonicalPathFromRoot {
|
||||
includes = append(includes, flags.proto.SubDir.String())
|
||||
includes = append(includes, flags.proto.SubDir)
|
||||
}
|
||||
includes = append(includes, flags.proto.Dir.String())
|
||||
includes = append(includes, flags.proto.Dir)
|
||||
library.reexportDirs(includes...)
|
||||
library.reexportDeps(library.baseCompiler.pathDeps...) // TODO: restrict to proto deps
|
||||
}
|
||||
}
|
||||
|
||||
if library.baseCompiler.hasSrcExt(".sysprop") {
|
||||
dir := android.PathForModuleGen(ctx, "sysprop", "include").String()
|
||||
dir := android.PathForModuleGen(ctx, "sysprop", "include")
|
||||
if library.Properties.Sysprop.Platform != nil {
|
||||
isProduct := ctx.ProductSpecific() && !ctx.useVndk()
|
||||
isVendor := ctx.useVndk()
|
||||
isOwnerPlatform := Bool(library.Properties.Sysprop.Platform)
|
||||
|
||||
if !ctx.inRecovery() && (isProduct || (isOwnerPlatform == isVendor)) {
|
||||
dir = android.PathForModuleGen(ctx, "sysprop/public", "include").String()
|
||||
dir = android.PathForModuleGen(ctx, "sysprop/public", "include")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -146,9 +146,9 @@ func (stub *llndkStubDecorator) link(ctx ModuleContext, flags Flags, deps PathDe
|
|||
}
|
||||
|
||||
if Bool(stub.Properties.Export_headers_as_system) {
|
||||
stub.reexportSystemDirs(genHeaderOutDir.String())
|
||||
stub.reexportSystemDirs(genHeaderOutDir)
|
||||
} else {
|
||||
stub.reexportDirs(genHeaderOutDir.String())
|
||||
stub.reexportDirs(genHeaderOutDir)
|
||||
}
|
||||
|
||||
stub.reexportDeps(timestampFiles...)
|
||||
|
|
|
@ -463,8 +463,8 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
|||
RelativeInstallPath string `json:",omitempty"`
|
||||
}{}
|
||||
prop.ExportedFlags = l.exportedFlags()
|
||||
prop.ExportedDirs = l.exportedDirs()
|
||||
prop.ExportedSystemDirs = l.exportedSystemDirs()
|
||||
prop.ExportedDirs = l.exportedDirs().Strings()
|
||||
prop.ExportedSystemDirs = l.exportedSystemDirs().Strings()
|
||||
prop.RelativeInstallPath = m.RelativeInstallPath()
|
||||
|
||||
propOut := libOut + ".json"
|
||||
|
@ -523,7 +523,7 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
|||
|
||||
generatedHeaders = append(generatedHeaders, l.exportedDeps()...)
|
||||
for _, dir := range append(l.exportedDirs(), l.exportedSystemDirs()...) {
|
||||
includeDirs[dir] = true
|
||||
includeDirs[dir.String()] = true
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -143,7 +143,8 @@ func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
|
|||
|
||||
if len(p.properties.Srcs) > 0 && p.shared() {
|
||||
p.libraryDecorator.exportIncludes(ctx)
|
||||
p.libraryDecorator.reexportSystemDirs(p.properties.Export_system_include_dirs...)
|
||||
p.libraryDecorator.reexportSystemDirs(
|
||||
android.PathsForModuleSrc(ctx, p.properties.Export_system_include_dirs)...)
|
||||
p.libraryDecorator.reexportFlags(p.properties.Export_flags...)
|
||||
// current VNDK prebuilts are only shared libs.
|
||||
return p.singleSourcePath(ctx)
|
||||
|
|
Loading…
Reference in New Issue