diff options
| -rw-r--r-- | cc/cmake_snapshot.go | 2 | ||||
| -rw-r--r-- | cc/library.go | 22 | ||||
| -rw-r--r-- | cc/library_stub.go | 17 |
3 files changed, 29 insertions, 12 deletions
diff --git a/cc/cmake_snapshot.go b/cc/cmake_snapshot.go index c21a46f04..5712d5ead 100644 --- a/cc/cmake_snapshot.go +++ b/cc/cmake_snapshot.go @@ -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 } diff --git a/cc/library.go b/cc/library.go index b9c1466b6..090908f79 100644 --- a/cc/library.go +++ b/cc/library.go @@ -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), + }, + ) } } diff --git a/cc/library_stub.go b/cc/library_stub.go index cddb1b5e1..746b95171 100644 --- a/cc/library_stub.go +++ b/cc/library_stub.go @@ -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) } } } |