cc: Make export_include_dirs configurable
Bug: 325444956
Test: m
Test: m [custom cc_library_headers with select]
Change-Id: Iebd66bb3f322276ff0f16dc7765257ea309b081f
diff --git a/cc/library_stub.go b/cc/library_stub.go
index cddb1b5..746b951 100644
--- a/cc/library_stub.go
+++ b/cc/library_stub.go
@@ -20,6 +20,8 @@
"android/soong/android"
"android/soong/multitree"
+
+ "github.com/google/blueprint/proptools"
)
var (
@@ -122,7 +124,7 @@
// 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 @@
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)
}
}
}