Remove configurable values from providers
Providers are data exported from one module to another.
Configurable properties are the collection of all possible values of a
property, to be resolved under the module's configuration.
If you export a configurable from one module to another and then resolve
it there, it will be evaluated with the wrong configuration.
Bug: 394967253
Test: m nothing
Change-Id: I934b08538bcc3267b3ec44925591f16a1c59292c
diff --git a/cc/cc.go b/cc/cc.go
index ad6468d..dd557b5 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -66,19 +66,19 @@
type CompilerInfo struct {
Srcs android.Paths
// list of module-specific flags that will be used for C and C++ compiles.
- Cflags proptools.Configurable[[]string]
+ Cflags []string
AidlInterfaceInfo AidlInterfaceInfo
LibraryDecoratorInfo *LibraryDecoratorInfo
}
type LinkerInfo struct {
- WholeStaticLibs proptools.Configurable[[]string]
+ WholeStaticLibs []string
// list of modules that should be statically linked into this module.
- StaticLibs proptools.Configurable[[]string]
+ StaticLibs []string
// list of modules that should be dynamically linked into this module.
- SharedLibs proptools.Configurable[[]string]
+ SharedLibs []string
// list of modules that should only provide headers for this module.
- HeaderLibs proptools.Configurable[[]string]
+ HeaderLibs []string
ImplementationModuleName *string
BinaryDecoratorInfo *BinaryDecoratorInfo
@@ -91,7 +91,7 @@
type BinaryDecoratorInfo struct{}
type LibraryDecoratorInfo struct {
- ExportIncludeDirs proptools.Configurable[[]string]
+ ExportIncludeDirs []string
InjectBsslHash bool
}
@@ -2295,9 +2295,10 @@
HasLlndkStubs: c.HasLlndkStubs(),
}
if c.compiler != nil {
+ cflags := c.compiler.baseCompilerProps().Cflags
ccInfo.CompilerInfo = &CompilerInfo{
Srcs: c.compiler.(CompiledInterface).Srcs(),
- Cflags: c.compiler.baseCompilerProps().Cflags,
+ Cflags: cflags.GetOrDefault(ctx, nil),
AidlInterfaceInfo: AidlInterfaceInfo{
Sources: c.compiler.baseCompilerProps().AidlInterface.Sources,
AidlRoot: c.compiler.baseCompilerProps().AidlInterface.AidlRoot,
@@ -2308,16 +2309,17 @@
switch decorator := c.compiler.(type) {
case *libraryDecorator:
ccInfo.CompilerInfo.LibraryDecoratorInfo = &LibraryDecoratorInfo{
- ExportIncludeDirs: decorator.flagExporter.Properties.Export_include_dirs,
+ ExportIncludeDirs: decorator.flagExporter.Properties.Export_include_dirs.GetOrDefault(ctx, nil),
}
}
}
if c.linker != nil {
+ baseLinkerProps := c.linker.baseLinkerProps()
ccInfo.LinkerInfo = &LinkerInfo{
- WholeStaticLibs: c.linker.baseLinkerProps().Whole_static_libs,
- StaticLibs: c.linker.baseLinkerProps().Static_libs,
- SharedLibs: c.linker.baseLinkerProps().Shared_libs,
- HeaderLibs: c.linker.baseLinkerProps().Header_libs,
+ WholeStaticLibs: baseLinkerProps.Whole_static_libs.GetOrDefault(ctx, nil),
+ StaticLibs: baseLinkerProps.Static_libs.GetOrDefault(ctx, nil),
+ SharedLibs: baseLinkerProps.Shared_libs.GetOrDefault(ctx, nil),
+ HeaderLibs: baseLinkerProps.Header_libs.GetOrDefault(ctx, nil),
}
switch decorator := c.linker.(type) {
case *binaryDecorator:
diff --git a/cc/cmake_snapshot.go b/cc/cmake_snapshot.go
index 71fbcce..3f6a01d 100644
--- a/cc/cmake_snapshot.go
+++ b/cc/cmake_snapshot.go
@@ -204,24 +204,19 @@
return info.CompilerInfo.AidlInterfaceInfo
},
"getCflagsProperty": func(ctx android.ModuleContext, info *CcInfo) []string {
- prop := info.CompilerInfo.Cflags
- return prop.GetOrDefault(ctx, nil)
+ return info.CompilerInfo.Cflags
},
"getWholeStaticLibsProperty": func(ctx android.ModuleContext, info *CcInfo) []string {
- prop := info.LinkerInfo.WholeStaticLibs
- return prop.GetOrDefault(ctx, nil)
+ return info.LinkerInfo.WholeStaticLibs
},
"getStaticLibsProperty": func(ctx android.ModuleContext, info *CcInfo) []string {
- prop := info.LinkerInfo.StaticLibs
- return prop.GetOrDefault(ctx, nil)
+ return info.LinkerInfo.StaticLibs
},
"getSharedLibsProperty": func(ctx android.ModuleContext, info *CcInfo) []string {
- prop := info.LinkerInfo.SharedLibs
- return prop.GetOrDefault(ctx, nil)
+ return info.LinkerInfo.SharedLibs
},
"getHeaderLibsProperty": func(ctx android.ModuleContext, info *CcInfo) []string {
- prop := info.LinkerInfo.HeaderLibs
- return prop.GetOrDefault(ctx, nil)
+ return info.LinkerInfo.HeaderLibs
},
"getExtraLibs": getExtraLibs,
"getIncludeDirs": getIncludeDirs,
@@ -552,7 +547,7 @@
func getIncludeDirs(ctx android.ModuleContext, m android.ModuleProxy, info *CcInfo) []string {
moduleDir := ctx.OtherModuleDir(m) + string(filepath.Separator)
if info.CompilerInfo.LibraryDecoratorInfo != nil {
- return sliceWithPrefix(moduleDir, info.CompilerInfo.LibraryDecoratorInfo.ExportIncludeDirs.GetOrDefault(ctx, nil))
+ return sliceWithPrefix(moduleDir, info.CompilerInfo.LibraryDecoratorInfo.ExportIncludeDirs)
}
return nil
}
diff --git a/java/java.go b/java/java.go
index 900f0e3..c204476 100644
--- a/java/java.go
+++ b/java/java.go
@@ -373,7 +373,7 @@
ProvidesUsesLibInfo *ProvidesUsesLibInfo
- ModuleWithUsesLibraryInfo *ModuleWithUsesLibraryInfo
+ MissingOptionalUsesLibs []string
ModuleWithSdkDepInfo *ModuleWithSdkDepInfo
@@ -3679,11 +3679,11 @@
usesLibrary *usesLibrary) {
dep, ok := android.OtherModuleProvider(ctx, depModule, JavaInfoProvider)
- if !ok || dep.ModuleWithUsesLibraryInfo == nil {
+ if !ok {
return
}
- for _, lib := range dep.ModuleWithUsesLibraryInfo.UsesLibrary.usesLibraryProperties.Missing_optional_uses_libs {
+ for _, lib := range dep.MissingOptionalUsesLibs {
if !android.InList(lib, usesLibrary.usesLibraryProperties.Missing_optional_uses_libs) {
usesLibrary.usesLibraryProperties.Missing_optional_uses_libs =
append(usesLibrary.usesLibraryProperties.Missing_optional_uses_libs, lib)
@@ -3771,9 +3771,7 @@
}
if mwul, ok := module.(ModuleWithUsesLibrary); ok {
- javaInfo.ModuleWithUsesLibraryInfo = &ModuleWithUsesLibraryInfo{
- UsesLibrary: mwul.UsesLibrary(),
- }
+ javaInfo.MissingOptionalUsesLibs = mwul.UsesLibrary().usesLibraryProperties.Missing_optional_uses_libs
}
if mwsd, ok := module.(moduleWithSdkDep); ok {
diff --git a/rust/rust.go b/rust/rust.go
index 7880dee..2b1b454 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -1202,10 +1202,11 @@
// Define the linker info if compiler != nil because Rust currently
// does compilation and linking in one step. If this changes in the future,
// move this as appropriate.
+ baseCompilerProps := mod.compiler.baseCompilerProps()
ccInfo.LinkerInfo = &cc.LinkerInfo{
- WholeStaticLibs: mod.compiler.baseCompilerProps().Whole_static_libs,
- StaticLibs: mod.compiler.baseCompilerProps().Static_libs,
- SharedLibs: mod.compiler.baseCompilerProps().Shared_libs,
+ WholeStaticLibs: baseCompilerProps.Whole_static_libs.GetOrDefault(ctx, nil),
+ StaticLibs: baseCompilerProps.Static_libs.GetOrDefault(ctx, nil),
+ SharedLibs: baseCompilerProps.Shared_libs.GetOrDefault(ctx, nil),
}
android.SetProvider(ctx, cc.CcInfoProvider, ccInfo)