Merge "cc: Make export_include_dirs configurable" into main am: ef0024775f
am: 02de5bbcdb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3121811 Change-Id: I39308a9e4b8d5078bdf256ab2c259b39a4d8dfb6 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
5d2a884fe1
3 changed files with 29 additions and 12 deletions
|
@ -507,7 +507,7 @@ func getIncludeDirs(ctx android.ModuleContext, m *Module) []string {
|
|||
moduleDir := ctx.OtherModuleDir(m) + string(filepath.Separator)
|
||||
switch decorator := m.compiler.(type) {
|
||||
case *libraryDecorator:
|
||||
return sliceWithPrefix(moduleDir, decorator.flagExporter.Properties.Export_include_dirs)
|
||||
return sliceWithPrefix(moduleDir, decorator.flagExporter.Properties.Export_include_dirs.GetOrDefault(ctx, nil))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ type FlagExporterProperties struct {
|
|||
// be added to the include path (using -I) for this module and any module that links
|
||||
// against this module. Directories listed in export_include_dirs do not need to be
|
||||
// listed in local_include_dirs.
|
||||
Export_include_dirs []string `android:"arch_variant,variant_prepend"`
|
||||
Export_include_dirs proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"`
|
||||
|
||||
// list of directories that will be added to the system include path
|
||||
// using -isystem for this module and any module that links against this module.
|
||||
|
@ -292,7 +292,7 @@ func (f *flagExporter) exportedIncludes(ctx ModuleContext) android.Paths {
|
|||
if ctx.inProduct() && f.Properties.Target.Product.Override_export_include_dirs != nil {
|
||||
return android.PathsForModuleSrc(ctx, f.Properties.Target.Product.Override_export_include_dirs)
|
||||
}
|
||||
return android.PathsForModuleSrc(ctx, f.Properties.Export_include_dirs)
|
||||
return android.PathsForModuleSrc(ctx, f.Properties.Export_include_dirs.GetOrDefault(ctx, nil))
|
||||
}
|
||||
|
||||
func (f *flagExporter) exportedSystemIncludes(ctx ModuleContext) android.Paths {
|
||||
|
@ -1588,14 +1588,19 @@ func (library *libraryDecorator) link(ctx ModuleContext,
|
|||
// override the module's export_include_dirs with llndk.override_export_include_dirs
|
||||
// if it is set.
|
||||
if override := library.Properties.Llndk.Override_export_include_dirs; override != nil {
|
||||
library.flagExporter.Properties.Export_include_dirs = override
|
||||
library.flagExporter.Properties.Export_include_dirs = proptools.NewConfigurable[[]string](
|
||||
nil,
|
||||
[]proptools.ConfigurableCase[[]string]{
|
||||
proptools.NewConfigurableCase[[]string](nil, &override),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
if Bool(library.Properties.Llndk.Export_headers_as_system) {
|
||||
library.flagExporter.Properties.Export_system_include_dirs = append(
|
||||
library.flagExporter.Properties.Export_system_include_dirs,
|
||||
library.flagExporter.Properties.Export_include_dirs...)
|
||||
library.flagExporter.Properties.Export_include_dirs = nil
|
||||
library.flagExporter.Properties.Export_include_dirs.GetOrDefault(ctx, nil)...)
|
||||
library.flagExporter.Properties.Export_include_dirs = proptools.NewConfigurable[[]string](nil, nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1603,7 +1608,12 @@ func (library *libraryDecorator) link(ctx ModuleContext,
|
|||
// override the module's export_include_dirs with vendor_public_library.override_export_include_dirs
|
||||
// if it is set.
|
||||
if override := library.Properties.Vendor_public_library.Override_export_include_dirs; override != nil {
|
||||
library.flagExporter.Properties.Export_include_dirs = override
|
||||
library.flagExporter.Properties.Export_include_dirs = proptools.NewConfigurable[[]string](
|
||||
nil,
|
||||
[]proptools.ConfigurableCase[[]string]{
|
||||
proptools.NewConfigurableCase[[]string](nil, &override),
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ import (
|
|||
|
||||
"android/soong/android"
|
||||
"android/soong/multitree"
|
||||
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -122,7 +124,7 @@ func (d *apiLibraryDecorator) Name(basename string) string {
|
|||
// The directories are not guaranteed to exist during Soong analysis.
|
||||
func (d *apiLibraryDecorator) exportIncludes(ctx ModuleContext) {
|
||||
exporterProps := d.flagExporter.Properties
|
||||
for _, dir := range exporterProps.Export_include_dirs {
|
||||
for _, dir := range exporterProps.Export_include_dirs.GetOrDefault(ctx, nil) {
|
||||
d.dirs = append(d.dirs, android.MaybeExistentPathForSource(ctx, ctx.ModuleDir(), dir))
|
||||
}
|
||||
// system headers
|
||||
|
@ -178,16 +180,21 @@ func (d *apiLibraryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps
|
|||
in = variantMod.Src()
|
||||
|
||||
// Copy LLDNK properties to cc_api_library module
|
||||
d.libraryDecorator.flagExporter.Properties.Export_include_dirs = append(
|
||||
d.libraryDecorator.flagExporter.Properties.Export_include_dirs,
|
||||
exportIncludeDirs := append(d.libraryDecorator.flagExporter.Properties.Export_include_dirs.GetOrDefault(ctx, nil),
|
||||
variantMod.exportProperties.Export_include_dirs...)
|
||||
d.libraryDecorator.flagExporter.Properties.Export_include_dirs = proptools.NewConfigurable[[]string](
|
||||
nil,
|
||||
[]proptools.ConfigurableCase[[]string]{
|
||||
proptools.NewConfigurableCase[[]string](nil, &exportIncludeDirs),
|
||||
},
|
||||
)
|
||||
|
||||
// Export headers as system include dirs if specified. Mostly for libc
|
||||
if Bool(variantMod.exportProperties.Export_headers_as_system) {
|
||||
d.libraryDecorator.flagExporter.Properties.Export_system_include_dirs = append(
|
||||
d.libraryDecorator.flagExporter.Properties.Export_system_include_dirs,
|
||||
d.libraryDecorator.flagExporter.Properties.Export_include_dirs...)
|
||||
d.libraryDecorator.flagExporter.Properties.Export_include_dirs = nil
|
||||
d.libraryDecorator.flagExporter.Properties.Export_include_dirs.GetOrDefault(ctx, nil)...)
|
||||
d.libraryDecorator.flagExporter.Properties.Export_include_dirs = proptools.NewConfigurable[[]string](nil, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue