Merge SingletonProviderContext with OtherModuleProviderContext
Bug: 358425833
Test: CI
Change-Id: I8e3f40dc3cfc5337008b419801f8e6bf2d48e8b2
diff --git a/aconfig/aconfig_declarations_test.go b/aconfig/aconfig_declarations_test.go
index 5483295..e89cd31 100644
--- a/aconfig/aconfig_declarations_test.go
+++ b/aconfig/aconfig_declarations_test.go
@@ -40,7 +40,7 @@
module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule)
// Check that the provider has the right contents
- depData, _ := android.SingletonModuleProvider(result, module, android.AconfigDeclarationsProviderKey)
+ depData, _ := android.OtherModuleProvider(result, module, android.AconfigDeclarationsProviderKey)
android.AssertStringEquals(t, "package", depData.Package, "com.example.package")
android.AssertStringEquals(t, "container", depData.Container, "com.android.foo")
android.AssertBoolEquals(t, "exportable", depData.Exportable, true)
@@ -67,7 +67,7 @@
result := runTest(t, android.FixtureExpectsNoErrors, bp)
module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule)
- depData, _ := android.SingletonModuleProvider(result, module, android.AconfigDeclarationsProviderKey)
+ depData, _ := android.OtherModuleProvider(result, module, android.AconfigDeclarationsProviderKey)
android.AssertBoolEquals(t, "exportable", depData.Exportable, false)
}
@@ -205,7 +205,7 @@
}
result := fixture.RunTestWithBp(t, test.bp)
module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule)
- depData, _ := android.SingletonModuleProvider(result, module, android.AconfigReleaseDeclarationsProviderKey)
+ depData, _ := android.OtherModuleProvider(result, module, android.AconfigReleaseDeclarationsProviderKey)
expectedKeys := []string{""}
for _, rc := range strings.Split(test.buildFlags["RELEASE_ACONFIG_EXTRA_RELEASE_CONFIGS"], " ") {
expectedKeys = append(expectedKeys, rc)
diff --git a/aconfig/aconfig_value_set_test.go b/aconfig/aconfig_value_set_test.go
index 7d18999..32c31cb 100644
--- a/aconfig/aconfig_value_set_test.go
+++ b/aconfig/aconfig_value_set_test.go
@@ -38,6 +38,6 @@
module := result.ModuleForTests("module_name", "").Module().(*ValueSetModule)
// Check that the provider has the right contents
- depData, _ := android.SingletonModuleProvider(result, module, valueSetProviderKey)
+ depData, _ := android.OtherModuleProvider(result, module, valueSetProviderKey)
android.AssertStringEquals(t, "AvailablePackages", "blah.aconfig_values", depData.AvailablePackages["foo.package"][0].String())
}
diff --git a/aconfig/aconfig_values_test.go b/aconfig/aconfig_values_test.go
index 526579c..ddbea57 100644
--- a/aconfig/aconfig_values_test.go
+++ b/aconfig/aconfig_values_test.go
@@ -33,7 +33,7 @@
module := result.ModuleForTests("module_name", "").Module().(*ValuesModule)
// Check that the provider has the right contents
- depData, _ := android.SingletonModuleProvider(result, module, valuesProviderKey)
+ depData, _ := android.OtherModuleProvider(result, module, valuesProviderKey)
android.AssertStringEquals(t, "package", "foo.package", depData.Package)
android.AssertPathsEndWith(t, "srcs", []string{"blah.aconfig_values"}, depData.Values)
}
diff --git a/aconfig/all_aconfig_declarations.go b/aconfig/all_aconfig_declarations.go
index 0437c26..6ad54da 100644
--- a/aconfig/all_aconfig_declarations.go
+++ b/aconfig/all_aconfig_declarations.go
@@ -15,9 +15,10 @@
package aconfig
import (
- "android/soong/android"
"fmt"
"slices"
+
+ "android/soong/android"
)
// A singleton module that collects all of the aconfig flags declared in the
@@ -55,7 +56,7 @@
var packages = make(map[string]int)
var cacheFiles android.Paths
ctx.VisitAllModules(func(module android.Module) {
- decl, ok := android.SingletonModuleProvider(ctx, module, android.AconfigReleaseDeclarationsProviderKey)
+ decl, ok := android.OtherModuleProvider(ctx, module, android.AconfigReleaseDeclarationsProviderKey)
if !ok {
return
}
diff --git a/aconfig/build_flags/all_build_flag_declarations.go b/aconfig/build_flags/all_build_flag_declarations.go
index 282c9dc..5f02912 100644
--- a/aconfig/build_flags/all_build_flag_declarations.go
+++ b/aconfig/build_flags/all_build_flag_declarations.go
@@ -38,7 +38,7 @@
// Find all of the build_flag_declarations modules
var intermediateFiles android.Paths
ctx.VisitAllModules(func(module android.Module) {
- decl, ok := android.SingletonModuleProvider(ctx, module, BuildFlagDeclarationsProviderKey)
+ decl, ok := android.OtherModuleProvider(ctx, module, BuildFlagDeclarationsProviderKey)
if !ok {
return
}
diff --git a/aconfig/exported_java_aconfig_library.go b/aconfig/exported_java_aconfig_library.go
index 291938f..a64cac8 100644
--- a/aconfig/exported_java_aconfig_library.go
+++ b/aconfig/exported_java_aconfig_library.go
@@ -30,7 +30,7 @@
// Find all of the aconfig_declarations modules
var cacheFiles android.Paths
ctx.VisitAllModules(func(module android.Module) {
- decl, ok := android.SingletonModuleProvider(ctx, module, android.AconfigDeclarationsProviderKey)
+ decl, ok := android.OtherModuleProvider(ctx, module, android.AconfigDeclarationsProviderKey)
if !ok {
return
}
diff --git a/aidl_library/aidl_library_test.go b/aidl_library/aidl_library_test.go
index 01eab0e..1660456 100644
--- a/aidl_library/aidl_library_test.go
+++ b/aidl_library/aidl_library_test.go
@@ -15,8 +15,9 @@
package aidl_library
import (
- "android/soong/android"
"testing"
+
+ "android/soong/android"
)
func TestAidlLibrary(t *testing.T) {
@@ -46,7 +47,7 @@
).RunTest(t).TestContext
foo := ctx.ModuleForTests("foo", "").Module().(*AidlLibrary)
- actualInfo, _ := android.SingletonModuleProvider(ctx, foo, AidlLibraryProvider)
+ actualInfo, _ := android.OtherModuleProvider(ctx, foo, AidlLibraryProvider)
android.AssertArrayString(
t,
@@ -95,7 +96,7 @@
).RunTest(t).TestContext
foo := ctx.ModuleForTests("foo", "").Module().(*AidlLibrary)
- actualInfo, _ := android.SingletonModuleProvider(ctx, foo, AidlLibraryProvider)
+ actualInfo, _ := android.OtherModuleProvider(ctx, foo, AidlLibraryProvider)
android.AssertArrayString(
t,
diff --git a/android/aconfig_providers.go b/android/aconfig_providers.go
index a47e80f..f0675dd 100644
--- a/android/aconfig_providers.go
+++ b/android/aconfig_providers.go
@@ -141,7 +141,7 @@
}
func aconfigUpdateAndroidMkData(ctx fillInEntriesContext, mod Module, data *AndroidMkData) {
- info, ok := SingletonModuleProvider(ctx, mod, AconfigPropagatingProviderKey)
+ info, ok := OtherModuleProvider(ctx, mod, AconfigPropagatingProviderKey)
// If there is no aconfigPropagatingProvider, or there are no AconfigFiles, then we are done.
if !ok || len(info.AconfigFiles) == 0 {
return
@@ -172,7 +172,7 @@
if len(*entries) == 0 {
return
}
- info, ok := SingletonModuleProvider(ctx, mod, AconfigPropagatingProviderKey)
+ info, ok := OtherModuleProvider(ctx, mod, AconfigPropagatingProviderKey)
if !ok || len(info.AconfigFiles) == 0 {
return
}
diff --git a/android/all_teams.go b/android/all_teams.go
index d4bf7d0..e3c2e70 100644
--- a/android/all_teams.go
+++ b/android/all_teams.go
@@ -1,9 +1,10 @@
package android
import (
- "android/soong/android/team_proto"
"path/filepath"
+ "android/soong/android/team_proto"
+
"google.golang.org/protobuf/proto"
)
@@ -93,7 +94,7 @@
}
testModInfo := TestModuleInformation{}
- if tmi, ok := SingletonModuleProvider(ctx, module, TestOnlyProviderKey); ok {
+ if tmi, ok := OtherModuleProvider(ctx, module, TestOnlyProviderKey); ok {
testModInfo = tmi
}
diff --git a/android/androidmk.go b/android/androidmk.go
index 9699ce5..e9df752 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -170,7 +170,7 @@
}
func (a *androidMkExtraEntriesContext) Provider(provider blueprint.AnyProviderKey) (any, bool) {
- return a.ctx.moduleProvider(a.mod, provider)
+ return a.ctx.otherModuleProvider(a.mod, provider)
}
type AndroidMkExtraEntriesFunc func(ctx AndroidMkExtraEntriesContext, entries *AndroidMkEntries)
@@ -497,7 +497,7 @@
ModuleDir(module blueprint.Module) string
ModuleSubDir(module blueprint.Module) string
Config() Config
- moduleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool)
+ otherModuleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool)
ModuleType(module blueprint.Module) string
OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{})
}
@@ -633,11 +633,11 @@
}
}
- if licenseMetadata, ok := SingletonModuleProvider(ctx, mod, LicenseMetadataProvider); ok {
+ if licenseMetadata, ok := OtherModuleProvider(ctx, mod, LicenseMetadataProvider); ok {
a.SetPath("LOCAL_SOONG_LICENSE_METADATA", licenseMetadata.LicenseMetadataPath)
}
- if _, ok := SingletonModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
+ if _, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
a.SetBool("LOCAL_SOONG_MODULE_INFO_JSON", true)
}
@@ -918,7 +918,7 @@
}
if !data.Entries.disabled() {
- if moduleInfoJSON, ok := SingletonModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
+ if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
*moduleInfoJSONs = append(*moduleInfoJSONs, moduleInfoJSON)
}
}
@@ -960,7 +960,7 @@
}
if len(entriesList) > 0 && !entriesList[0].disabled() {
- if moduleInfoJSON, ok := SingletonModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
+ if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
*moduleInfoJSONs = append(*moduleInfoJSONs, moduleInfoJSON)
}
}
diff --git a/android/compliance_metadata.go b/android/compliance_metadata.go
index 6ea6654..0080b9a 100644
--- a/android/compliance_metadata.go
+++ b/android/compliance_metadata.go
@@ -267,7 +267,7 @@
writerToCsv(csvWriter, metadata)
return
}
- if provider, ok := ctx.moduleProvider(module, ComplianceMetadataProvider); ok {
+ if provider, ok := ctx.otherModuleProvider(module, ComplianceMetadataProvider); ok {
metadataInfo := provider.(*ComplianceMetadataInfo)
rowId = rowId + 1
metadata := []string{strconv.Itoa(rowId)}
diff --git a/android/logtags.go b/android/logtags.go
index d11cccf..7929057 100644
--- a/android/logtags.go
+++ b/android/logtags.go
@@ -42,7 +42,7 @@
if !module.ExportedToMake() {
return
}
- if logtagsInfo, ok := SingletonModuleProvider(ctx, module, LogtagsProviderKey); ok {
+ if logtagsInfo, ok := OtherModuleProvider(ctx, module, LogtagsProviderKey); ok {
allLogtags = append(allLogtags, logtagsInfo.Logtags...)
}
})
diff --git a/android/makevars.go b/android/makevars.go
index f92f458..ff43cc5 100644
--- a/android/makevars.go
+++ b/android/makevars.go
@@ -94,7 +94,7 @@
ModuleDir(module blueprint.Module) string
ModuleSubDir(module blueprint.Module) string
ModuleType(module blueprint.Module) string
- moduleProvider(module blueprint.Module, key blueprint.AnyProviderKey) (any, bool)
+ otherModuleProvider(module blueprint.Module, key blueprint.AnyProviderKey) (any, bool)
BlueprintFile(module blueprint.Module) string
ModuleErrorf(module blueprint.Module, format string, args ...interface{})
diff --git a/android/module.go b/android/module.go
index f9fab96..15976ad 100644
--- a/android/module.go
+++ b/android/module.go
@@ -2519,7 +2519,7 @@
fromProperty = true
}
} else if cta, isCta := ctx.(*singletonContextAdaptor); isCta {
- providerData, _ := cta.moduleProvider(module, OutputFilesProvider)
+ providerData, _ := cta.otherModuleProvider(module, OutputFilesProvider)
outputFiles, _ = providerData.(OutputFilesInfo)
} else {
return nil, fmt.Errorf("unsupported context %q in method outputFilesForModuleFromProvider", reflect.TypeOf(ctx))
diff --git a/android/provider.go b/android/provider.go
index 3b9c5d2..327f224 100644
--- a/android/provider.go
+++ b/android/provider.go
@@ -14,6 +14,8 @@
var _ OtherModuleProviderContext = ModuleContext(nil)
var _ OtherModuleProviderContext = BottomUpMutatorContext(nil)
var _ OtherModuleProviderContext = TopDownMutatorContext(nil)
+var _ OtherModuleProviderContext = SingletonContext(nil)
+var _ OtherModuleProviderContext = (*TestContext)(nil)
// OtherModuleProvider reads the provider for the given module. If the provider has been set the value is
// returned and the boolean is true. If it has not been set the zero value of the provider's type is returned
@@ -56,26 +58,6 @@
return value.(K), ok
}
-type SingletonModuleProviderContext interface {
- moduleProvider(blueprint.Module, blueprint.AnyProviderKey) (any, bool)
-}
-
-var _ SingletonModuleProviderContext = SingletonContext(nil)
-var _ SingletonModuleProviderContext = (*TestContext)(nil)
-
-// SingletonModuleProvider wraps blueprint.SingletonModuleProvider to provide a type-safe method to retrieve the value
-// of the given provider from a module using a SingletonContext. If the provider has not been set the first return
-// value will be the zero value of the provider's type, and the second return value will be false. If the provider has
-// been set the second return value will be true.
-func SingletonModuleProvider[K any](ctx SingletonModuleProviderContext, module blueprint.Module, provider blueprint.ProviderKey[K]) (K, bool) {
- value, ok := ctx.moduleProvider(module, provider)
- if !ok {
- var k K
- return k, false
- }
- return value.(K), ok
-}
-
// SetProviderContext is a helper interface that is a subset of ModuleContext, BottomUpMutatorContext, or
// TopDownMutatorContext for use in SetProvider.
type SetProviderContext interface {
diff --git a/android/singleton.go b/android/singleton.go
index d364384..92264d2 100644
--- a/android/singleton.go
+++ b/android/singleton.go
@@ -35,7 +35,7 @@
// Allows generating build actions for `referer` based on the metadata for `name` deferred until the singleton context.
ModuleVariantsFromName(referer Module, name string) []Module
- moduleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool)
+ otherModuleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool)
ModuleErrorf(module blueprint.Module, format string, args ...interface{})
Errorf(format string, args ...interface{})
@@ -279,7 +279,7 @@
return result
}
-func (s *singletonContextAdaptor) moduleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool) {
+func (s *singletonContextAdaptor) otherModuleProvider(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool) {
return s.SingletonContext.ModuleProvider(module, provider)
}
diff --git a/android/testing.go b/android/testing.go
index e3853b8..a3e35cb 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -212,7 +212,7 @@
ctx.PreArchMutators(f)
}
-func (ctx *TestContext) moduleProvider(m blueprint.Module, p blueprint.AnyProviderKey) (any, bool) {
+func (ctx *TestContext) otherModuleProvider(m blueprint.Module, p blueprint.AnyProviderKey) (any, bool) {
return ctx.Context.ModuleProvider(m, p)
}
@@ -230,7 +230,7 @@
func (ctx *TestContext) OtherModuleProviderAdaptor() OtherModuleProviderContext {
return NewOtherModuleProviderAdaptor(func(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool) {
- return ctx.moduleProvider(module, provider)
+ return ctx.otherModuleProvider(module, provider)
})
}
diff --git a/apex/apex_singleton.go b/apex/apex_singleton.go
index a8d89b1..f405cb2 100644
--- a/apex/apex_singleton.go
+++ b/apex/apex_singleton.go
@@ -88,7 +88,7 @@
updatableFlatLists := android.Paths{}
ctx.VisitAllModules(func(module android.Module) {
if binaryInfo, ok := module.(android.ApexBundleDepsInfoIntf); ok {
- apexInfo, _ := android.SingletonModuleProvider(ctx, module, android.ApexInfoProvider)
+ apexInfo, _ := android.OtherModuleProvider(ctx, module, android.ApexInfoProvider)
if path := binaryInfo.FlatListPath(); path != nil {
if binaryInfo.Updatable() || apexInfo.Updatable {
updatableFlatLists = append(updatableFlatLists, path)
@@ -155,7 +155,7 @@
prebuiltInfos := []android.PrebuiltInfo{}
ctx.VisitAllModules(func(m android.Module) {
- prebuiltInfo, exists := android.SingletonModuleProvider(ctx, m, android.PrebuiltInfoProvider)
+ prebuiltInfo, exists := android.OtherModuleProvider(ctx, m, android.PrebuiltInfoProvider)
// Use prebuiltInfoProvider to filter out non apex soong modules.
// Use HideFromMake to filter out the unselected variants of a specific apex.
if exists && !m.IsHideFromMake() {
diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go
index f8c823e..25131ee 100644
--- a/apex/bootclasspath_fragment_test.go
+++ b/apex/bootclasspath_fragment_test.go
@@ -152,7 +152,7 @@
// Check stub dex paths exported by art.
artFragment := result.Module("art-bootclasspath-fragment", "android_common")
- artInfo, _ := android.SingletonModuleProvider(result, artFragment, java.HiddenAPIInfoProvider)
+ artInfo, _ := android.OtherModuleProvider(result, artFragment, java.HiddenAPIInfoProvider)
bazPublicStubs := "out/soong/.intermediates/baz.stubs.exportable/android_common/dex/baz.stubs.exportable.jar"
bazSystemStubs := "out/soong/.intermediates/baz.stubs.exportable.system/android_common/dex/baz.stubs.exportable.system.jar"
@@ -165,7 +165,7 @@
// Check stub dex paths exported by other.
otherFragment := result.Module("other-bootclasspath-fragment", "android_common")
- otherInfo, _ := android.SingletonModuleProvider(result, otherFragment, java.HiddenAPIInfoProvider)
+ otherInfo, _ := android.OtherModuleProvider(result, otherFragment, java.HiddenAPIInfoProvider)
fooPublicStubs := "out/soong/.intermediates/foo.stubs.exportable/android_common/dex/foo.stubs.exportable.jar"
fooSystemStubs := "out/soong/.intermediates/foo.stubs.exportable.system/android_common/dex/foo.stubs.exportable.system.jar"
@@ -688,7 +688,7 @@
// Make sure that the fragment provides the hidden API encoded dex jars to the APEX.
fragment := result.Module("mybootclasspathfragment", "android_common_apex10000")
- info, _ := android.SingletonModuleProvider(result, fragment, java.BootclasspathFragmentApexContentInfoProvider)
+ info, _ := android.OtherModuleProvider(result, fragment, java.BootclasspathFragmentApexContentInfoProvider)
checkFragmentExportedDexJar := func(name string, expectedDexJar string) {
module := result.Module(name, "android_common_apex10000")
diff --git a/apex/platform_bootclasspath_test.go b/apex/platform_bootclasspath_test.go
index 645eebb..920fc0c 100644
--- a/apex/platform_bootclasspath_test.go
+++ b/apex/platform_bootclasspath_test.go
@@ -154,7 +154,7 @@
).RunTest(t)
pbcp := result.Module("platform-bootclasspath", "android_common")
- info, _ := android.SingletonModuleProvider(result, pbcp, java.MonolithicHiddenAPIInfoProvider)
+ info, _ := android.OtherModuleProvider(result, pbcp, java.MonolithicHiddenAPIInfoProvider)
for _, category := range java.HiddenAPIFlagFileCategories {
name := category.PropertyName()
@@ -236,7 +236,7 @@
)
pbcp := result.Module("myplatform-bootclasspath", "android_common")
- info, _ := android.SingletonModuleProvider(result, pbcp, java.MonolithicHiddenAPIInfoProvider)
+ info, _ := android.OtherModuleProvider(result, pbcp, java.MonolithicHiddenAPIInfoProvider)
android.AssertArrayString(t, "stub flags", []string{"prebuilt-stub-flags.csv:out/soong/.intermediates/mybootclasspath-fragment/android_common_myapex/modular-hiddenapi/signature-patterns.csv"}, info.StubFlagSubsets.RelativeToTop())
android.AssertArrayString(t, "all flags", []string{"prebuilt-all-flags.csv:out/soong/.intermediates/mybootclasspath-fragment/android_common_myapex/modular-hiddenapi/signature-patterns.csv"}, info.FlagSubsets.RelativeToTop())
diff --git a/bloaty/bloaty.go b/bloaty/bloaty.go
index b72b6d3..8ecea98 100644
--- a/bloaty/bloaty.go
+++ b/bloaty/bloaty.go
@@ -88,7 +88,7 @@
if !m.ExportedToMake() {
return
}
- filePaths, ok := android.SingletonModuleProvider(ctx, m, fileSizeMeasurerKey)
+ filePaths, ok := android.OtherModuleProvider(ctx, m, fileSizeMeasurerKey)
if !ok {
return
}
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 7372fff..779e53d 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -851,7 +851,7 @@
variant := "android_arm64_armv8-a_static"
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
- staticLibInfo, _ := android.SingletonModuleProvider(ctx, moduleA, StaticLibraryInfoProvider)
+ staticLibInfo, _ := android.OtherModuleProvider(ctx, moduleA, StaticLibraryInfoProvider)
actual := android.Paths(staticLibInfo.TransitiveStaticLibrariesForOrdering.ToList()).RelativeToTop()
expected := GetOutputPaths(ctx, variant, []string{"a", "c", "b", "d"})
@@ -887,7 +887,7 @@
variant := "android_arm64_armv8-a_static"
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module)
- staticLibInfo, _ := android.SingletonModuleProvider(ctx, moduleA, StaticLibraryInfoProvider)
+ staticLibInfo, _ := android.OtherModuleProvider(ctx, moduleA, StaticLibraryInfoProvider)
actual := android.Paths(staticLibInfo.TransitiveStaticLibrariesForOrdering.ToList()).RelativeToTop()
expected := GetOutputPaths(ctx, variant, []string{"a", "c", "b"})
@@ -999,7 +999,7 @@
checkExportedIncludeDirs := func(module, variant string, expectedSystemDirs []string, expectedDirs ...string) {
t.Helper()
m := result.ModuleForTests(module, variant).Module()
- f, _ := android.SingletonModuleProvider(result, m, FlagExporterInfoProvider)
+ f, _ := android.OtherModuleProvider(result, m, FlagExporterInfoProvider)
android.AssertPathsRelativeToTopEquals(t, "exported include dirs for "+module+"["+variant+"]",
expectedDirs, f.IncludeDirs)
android.AssertPathsRelativeToTopEquals(t, "exported include dirs for "+module+"["+variant+"]",
@@ -1027,7 +1027,7 @@
}
}
vendorModule := result.ModuleForTests(module, vendorVariant).Module()
- vendorInfo, _ := android.SingletonModuleProvider(result, vendorModule, FlagExporterInfoProvider)
+ vendorInfo, _ := android.OtherModuleProvider(result, vendorModule, FlagExporterInfoProvider)
vendorDirs := android.Concat(vendorInfo.IncludeDirs, vendorInfo.SystemIncludeDirs)
android.AssertStringEquals(t, module+" has different exported include dirs for vendor variant and ABI check",
android.JoinPathsWithPrefix(vendorDirs, "-I"), abiCheckFlags)
@@ -2452,7 +2452,7 @@
checkIncludeDirs := func(t *testing.T, ctx *android.TestContext, module android.Module, checkers ...exportedChecker) {
t.Helper()
- exported, _ := android.SingletonModuleProvider(ctx, module, FlagExporterInfoProvider)
+ exported, _ := android.OtherModuleProvider(ctx, module, FlagExporterInfoProvider)
name := module.Name()
for _, checker := range checkers {
diff --git a/cc/sanitize_test.go b/cc/sanitize_test.go
index 44f38e1..80facd8 100644
--- a/cc/sanitize_test.go
+++ b/cc/sanitize_test.go
@@ -47,7 +47,7 @@
`))
type providerInterface interface {
- android.SingletonModuleProviderContext
+ android.OtherModuleProviderContext
}
// expectSharedLinkDep verifies that the from module links against the to module as a
@@ -55,7 +55,7 @@
func expectSharedLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
t.Helper()
fromLink := from.Description("link")
- toInfo, _ := android.SingletonModuleProvider(ctx, to.Module(), SharedLibraryInfoProvider)
+ toInfo, _ := android.OtherModuleProvider(ctx, to.Module(), SharedLibraryInfoProvider)
if g, w := fromLink.OrderOnly.Strings(), toInfo.SharedLibrary.RelativeToTop().String(); !android.InList(w, g) {
t.Errorf("%s should link against %s, expected %q, got %q",
@@ -68,7 +68,7 @@
func expectNoSharedLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
t.Helper()
fromLink := from.Description("link")
- toInfo, _ := android.SingletonModuleProvider(ctx, to.Module(), SharedLibraryInfoProvider)
+ toInfo, _ := android.OtherModuleProvider(ctx, to.Module(), SharedLibraryInfoProvider)
if g, w := fromLink.OrderOnly.Strings(), toInfo.SharedLibrary.RelativeToTop().String(); android.InList(w, g) {
t.Errorf("%s should not link against %s, expected %q, got %q",
@@ -81,7 +81,7 @@
func expectStaticLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
t.Helper()
fromLink := from.Description("link")
- toInfo, _ := android.SingletonModuleProvider(ctx, to.Module(), StaticLibraryInfoProvider)
+ toInfo, _ := android.OtherModuleProvider(ctx, to.Module(), StaticLibraryInfoProvider)
if g, w := fromLink.Implicits.Strings(), toInfo.StaticLibrary.RelativeToTop().String(); !android.InList(w, g) {
t.Errorf("%s should link against %s, expected %q, got %q",
@@ -95,7 +95,7 @@
func expectNoStaticLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
t.Helper()
fromLink := from.Description("link")
- toInfo, _ := android.SingletonModuleProvider(ctx, to.Module(), StaticLibraryInfoProvider)
+ toInfo, _ := android.OtherModuleProvider(ctx, to.Module(), StaticLibraryInfoProvider)
if g, w := fromLink.Implicits.Strings(), toInfo.StaticLibrary.RelativeToTop().String(); android.InList(w, g) {
t.Errorf("%s should not link against %s, expected %q, got %q",
diff --git a/java/aar_test.go b/java/aar_test.go
index ebad310..877e2c7 100644
--- a/java/aar_test.go
+++ b/java/aar_test.go
@@ -53,7 +53,7 @@
appMod := ctx.Module(tc.name, "android_common")
appTestMod := ctx.ModuleForTests(tc.name, "android_common")
- info, ok := android.SingletonModuleProvider(ctx, appMod, JniPackageProvider)
+ info, ok := android.OtherModuleProvider(ctx, appMod, JniPackageProvider)
if !ok {
t.Errorf("expected android_library_import to have JniPackageProvider")
}
diff --git a/java/bootclasspath_fragment_test.go b/java/bootclasspath_fragment_test.go
index d72417a..60f1a50 100644
--- a/java/bootclasspath_fragment_test.go
+++ b/java/bootclasspath_fragment_test.go
@@ -273,7 +273,7 @@
`)
fragment := result.Module("myfragment", "android_common")
- info, _ := android.SingletonModuleProvider(result, fragment, HiddenAPIInfoProvider)
+ info, _ := android.OtherModuleProvider(result, fragment, HiddenAPIInfoProvider)
stubsJar := "out/soong/.intermediates/mystublib/android_common/dex/mystublib.jar"
@@ -457,7 +457,7 @@
// Make sure that the library exports hidden API properties for use by the bootclasspath_fragment.
library := result.Module("mynewlibrary", "android_common")
- info, _ := android.SingletonModuleProvider(result, library, hiddenAPIPropertyInfoProvider)
+ info, _ := android.OtherModuleProvider(result, library, hiddenAPIPropertyInfoProvider)
android.AssertArrayString(t, "split packages", []string{"sdklibrary", "newlibrary"}, info.SplitPackages)
android.AssertArrayString(t, "package prefixes", []string{"newlibrary.all.mine"}, info.PackagePrefixes)
android.AssertArrayString(t, "single packages", []string{"newlibrary.mine"}, info.SinglePackages)
diff --git a/java/code_metadata_test.go b/java/code_metadata_test.go
index 99b1f52..9dc9a22 100644
--- a/java/code_metadata_test.go
+++ b/java/code_metadata_test.go
@@ -29,7 +29,7 @@
module := result.ModuleForTests("module-name", "")
// Check that the provider has the right contents
- data, _ := android.SingletonModuleProvider(result, module.Module(), soongTesting.CodeMetadataProviderKey)
+ data, _ := android.OtherModuleProvider(result, module.Module(), soongTesting.CodeMetadataProviderKey)
if !strings.HasSuffix(
data.IntermediatePath.String(), "/intermediateCodeMetadata.pb",
) {
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 56e007b..a81ab83 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -1341,7 +1341,7 @@
image := d.defaultBootImage
if image != nil {
- if profileInstallInfo, ok := android.SingletonModuleProvider(ctx, d, profileInstallInfoProvider); ok {
+ if profileInstallInfo, ok := android.OtherModuleProvider(ctx, d, profileInstallInfoProvider); ok {
ctx.Strict("DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED", profileInstallInfo.profileInstalls.String())
if profileInstallInfo.profileLicenseMetadataFile.Valid() {
ctx.Strict("DEXPREOPT_IMAGE_PROFILE_LICENSE_METADATA", profileInstallInfo.profileLicenseMetadataFile.String())
diff --git a/java/dexpreopt_config_testing.go b/java/dexpreopt_config_testing.go
index 104829f..37c54b9 100644
--- a/java/dexpreopt_config_testing.go
+++ b/java/dexpreopt_config_testing.go
@@ -1237,7 +1237,7 @@
if !mutated {
dexBootJarModule := result.ModuleForTests("dex_bootjars", "android_common")
- profileInstallInfo, _ := android.SingletonModuleProvider(result, dexBootJarModule.Module(), profileInstallInfoProvider)
+ profileInstallInfo, _ := android.OtherModuleProvider(result, dexBootJarModule.Module(), profileInstallInfoProvider)
assertInstallsEqual(t, "profileInstalls", expected.profileInstalls, profileInstallInfo.profileInstalls)
android.AssertStringEquals(t, "profileLicenseMetadataFile", expected.profileLicenseMetadataFile, profileInstallInfo.profileLicenseMetadataFile.RelativeToTop().String())
}
diff --git a/java/java_test.go b/java/java_test.go
index 86bfe9f..477a0b3 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -1100,7 +1100,7 @@
source := ctx.ModuleForTests("source_library", "android_common")
sourceJar := source.Output("javac/source_library.jar")
sourceHeaderJar := source.Output("turbine-combined/source_library.jar")
- sourceJavaInfo, _ := android.SingletonModuleProvider(ctx, source.Module(), JavaInfoProvider)
+ sourceJavaInfo, _ := android.OtherModuleProvider(ctx, source.Module(), JavaInfoProvider)
// The source library produces separate implementation and header jars
android.AssertPathsRelativeToTopEquals(t, "source library implementation jar",
@@ -1110,7 +1110,7 @@
importWithNoDeps := ctx.ModuleForTests("import_with_no_deps", "android_common")
importWithNoDepsJar := importWithNoDeps.Output("combined/import_with_no_deps.jar")
- importWithNoDepsJavaInfo, _ := android.SingletonModuleProvider(ctx, importWithNoDeps.Module(), JavaInfoProvider)
+ importWithNoDepsJavaInfo, _ := android.OtherModuleProvider(ctx, importWithNoDeps.Module(), JavaInfoProvider)
// An import with no deps produces a single jar used as both the header and implementation jar.
android.AssertPathsRelativeToTopEquals(t, "import with no deps implementation jar",
@@ -1123,7 +1123,7 @@
importWithSourceDeps := ctx.ModuleForTests("import_with_source_deps", "android_common")
importWithSourceDepsJar := importWithSourceDeps.Output("combined/import_with_source_deps.jar")
importWithSourceDepsHeaderJar := importWithSourceDeps.Output("turbine-combined/import_with_source_deps.jar")
- importWithSourceDepsJavaInfo, _ := android.SingletonModuleProvider(ctx, importWithSourceDeps.Module(), JavaInfoProvider)
+ importWithSourceDepsJavaInfo, _ := android.OtherModuleProvider(ctx, importWithSourceDeps.Module(), JavaInfoProvider)
// An import with source deps produces separate header and implementation jars.
android.AssertPathsRelativeToTopEquals(t, "import with source deps implementation jar",
@@ -1137,7 +1137,7 @@
importWithImportDeps := ctx.ModuleForTests("import_with_import_deps", "android_common")
importWithImportDepsJar := importWithImportDeps.Output("combined/import_with_import_deps.jar")
- importWithImportDepsJavaInfo, _ := android.SingletonModuleProvider(ctx, importWithImportDeps.Module(), JavaInfoProvider)
+ importWithImportDepsJavaInfo, _ := android.OtherModuleProvider(ctx, importWithImportDeps.Module(), JavaInfoProvider)
// An import with only import deps produces a single jar used as both the header and implementation jar.
android.AssertPathsRelativeToTopEquals(t, "import with import deps implementation jar",
@@ -2274,7 +2274,7 @@
}
`)
c := ctx.ModuleForTests("c", "android_common").Module()
- javaInfo, _ := android.SingletonModuleProvider(ctx, c, JavaInfoProvider)
+ javaInfo, _ := android.OtherModuleProvider(ctx, c, JavaInfoProvider)
transitiveSrcFiles := android.Paths(javaInfo.TransitiveSrcFiles.ToList())
android.AssertArrayString(t, "unexpected jar deps", []string{"b.java", "c.java"}, transitiveSrcFiles.Strings())
}
diff --git a/java/jdeps.go b/java/jdeps.go
index 3400263..e856b37 100644
--- a/java/jdeps.go
+++ b/java/jdeps.go
@@ -89,7 +89,7 @@
dpInfo.Classes = append(dpInfo.Classes, data.Class)
}
- if dep, ok := android.SingletonModuleProvider(ctx, module, JavaInfoProvider); ok {
+ if dep, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
dpInfo.Installed_paths = append(dpInfo.Installed_paths, dep.ImplementationJars.Strings()...)
}
dpInfo.Classes = android.FirstUniqueStrings(dpInfo.Classes)
diff --git a/java/lint.go b/java/lint.go
index 2eea07d..6782adc 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -650,7 +650,7 @@
}
if apex, ok := m.(android.ApexModule); ok && apex.NotAvailableForPlatform() {
- apexInfo, _ := android.SingletonModuleProvider(ctx, m, android.ApexInfoProvider)
+ apexInfo, _ := android.OtherModuleProvider(ctx, m, android.ApexInfoProvider)
if apexInfo.IsForPlatform() {
// There are stray platform variants of modules in apexes that are not available for
// the platform, and they sometimes can't be built. Don't depend on them.
diff --git a/java/sdk.go b/java/sdk.go
index 4ef4ee2..dd198ac 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -278,7 +278,7 @@
ctx.VisitAllModules(func(module android.Module) {
// Collect dex jar paths for the modules listed above.
- if j, ok := android.SingletonModuleProvider(ctx, module, JavaInfoProvider); ok {
+ if j, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok {
name := ctx.ModuleName(module)
if i := android.IndexList(name, stubsModules); i != -1 {
stubsJars[i] = j.HeaderJars
diff --git a/java/sdk_library_test.go b/java/sdk_library_test.go
index 368eca7..52d4af0 100644
--- a/java/sdk_library_test.go
+++ b/java/sdk_library_test.go
@@ -130,7 +130,7 @@
result.ModuleForTests("foo.api.system.28", "")
result.ModuleForTests("foo.api.test.28", "")
- exportedComponentsInfo, _ := android.SingletonModuleProvider(result, foo.Module(), android.ExportedComponentsInfoProvider)
+ exportedComponentsInfo, _ := android.OtherModuleProvider(result, foo.Module(), android.ExportedComponentsInfoProvider)
expectedFooExportedComponents := []string{
"foo-removed.api.combined.public.latest",
"foo-removed.api.combined.system.latest",
diff --git a/java/system_modules_test.go b/java/system_modules_test.go
index 1a8d0b5..b05b0e4 100644
--- a/java/system_modules_test.go
+++ b/java/system_modules_test.go
@@ -25,7 +25,7 @@
paths := []string{}
for _, moduleName := range moduleNames {
module := result.Module(moduleName, "android_common")
- info, _ := android.SingletonModuleProvider(result, module, JavaInfoProvider)
+ info, _ := android.OtherModuleProvider(result, module, JavaInfoProvider)
paths = append(paths, info.HeaderJars.RelativeToTop().Strings()...)
}
return paths
diff --git a/java/test_spec_test.go b/java/test_spec_test.go
index 4144dad..f0a5fdb 100644
--- a/java/test_spec_test.go
+++ b/java/test_spec_test.go
@@ -32,7 +32,7 @@
module := result.ModuleForTests("module-name", "")
// Check that the provider has the right contents
- data, _ := android.SingletonModuleProvider(result, module.Module(), soongTesting.TestSpecProviderKey)
+ data, _ := android.OtherModuleProvider(result, module.Module(), soongTesting.TestSpecProviderKey)
if !strings.HasSuffix(
data.IntermediatePath.String(), "/intermediateTestSpecMetadata.pb",
) {
diff --git a/java/testing.go b/java/testing.go
index a99baf8..e1bf537 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -632,7 +632,7 @@
func CheckClasspathFragmentProtoContentInfoProvider(t *testing.T, result *android.TestResult, generated bool, contents, outputFilename, installDir string) {
t.Helper()
p := result.Module("platform-bootclasspath", "android_common").(*platformBootclasspathModule)
- info, _ := android.SingletonModuleProvider(result, p, ClasspathFragmentProtoContentInfoProvider)
+ info, _ := android.OtherModuleProvider(result, p, ClasspathFragmentProtoContentInfoProvider)
android.AssertBoolEquals(t, "classpath proto generated", generated, info.ClasspathFragmentProtoGenerated)
android.AssertStringEquals(t, "classpath proto contents", contents, info.ClasspathFragmentProtoContents.String())
@@ -652,7 +652,7 @@
func apexNamePairFromModule(ctx *android.TestContext, module android.Module) string {
name := module.Name()
var apex string
- apexInfo, _ := android.SingletonModuleProvider(ctx, module, android.ApexInfoProvider)
+ apexInfo, _ := android.OtherModuleProvider(ctx, module, android.ApexInfoProvider)
if apexInfo.IsForPlatform() {
apex = "platform"
} else {
diff --git a/testing/all_code_metadata.go b/testing/all_code_metadata.go
index 12aa7b5..e89b281 100644
--- a/testing/all_code_metadata.go
+++ b/testing/all_code_metadata.go
@@ -21,7 +21,7 @@
ctx.VisitAllModules(
func(module android.Module) {
- if metadata, ok := android.SingletonModuleProvider(ctx, module, CodeMetadataProviderKey); ok {
+ if metadata, ok := android.OtherModuleProvider(ctx, module, CodeMetadataProviderKey); ok {
intermediateMetadataPaths = append(intermediateMetadataPaths, metadata.IntermediatePath)
}
},
diff --git a/testing/all_test_specs.go b/testing/all_test_specs.go
index b035435..68f24d1 100644
--- a/testing/all_test_specs.go
+++ b/testing/all_test_specs.go
@@ -21,7 +21,7 @@
var intermediateMetadataPaths android.Paths
ctx.VisitAllModules(func(module android.Module) {
- if metadata, ok := android.SingletonModuleProvider(ctx, module, TestSpecProviderKey); ok {
+ if metadata, ok := android.OtherModuleProvider(ctx, module, TestSpecProviderKey); ok {
intermediateMetadataPaths = append(intermediateMetadataPaths, metadata.IntermediatePath)
}
})