Merge SingletonProviderContext with OtherModuleProviderContext

Bug: 358425833
Test: CI
Change-Id: I8e3f40dc3cfc5337008b419801f8e6bf2d48e8b2
This commit is contained in:
Yu Liu
2024-08-12 18:23:59 +00:00
parent 703c2e3d64
commit 663e4508dc
38 changed files with 74 additions and 89 deletions

View File

@@ -40,7 +40,7 @@ func TestAconfigDeclarations(t *testing.T) {
module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule) module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule)
// Check that the provider has the right contents // 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, "package", depData.Package, "com.example.package")
android.AssertStringEquals(t, "container", depData.Container, "com.android.foo") android.AssertStringEquals(t, "container", depData.Container, "com.android.foo")
android.AssertBoolEquals(t, "exportable", depData.Exportable, true) android.AssertBoolEquals(t, "exportable", depData.Exportable, true)
@@ -67,7 +67,7 @@ func TestAconfigDeclarationsWithExportableUnset(t *testing.T) {
result := runTest(t, android.FixtureExpectsNoErrors, bp) result := runTest(t, android.FixtureExpectsNoErrors, bp)
module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule) 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) android.AssertBoolEquals(t, "exportable", depData.Exportable, false)
} }
@@ -205,7 +205,7 @@ func TestGenerateAndroidBuildActions(t *testing.T) {
} }
result := fixture.RunTestWithBp(t, test.bp) result := fixture.RunTestWithBp(t, test.bp)
module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule) module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule)
depData, _ := android.SingletonModuleProvider(result, module, android.AconfigReleaseDeclarationsProviderKey) depData, _ := android.OtherModuleProvider(result, module, android.AconfigReleaseDeclarationsProviderKey)
expectedKeys := []string{""} expectedKeys := []string{""}
for _, rc := range strings.Split(test.buildFlags["RELEASE_ACONFIG_EXTRA_RELEASE_CONFIGS"], " ") { for _, rc := range strings.Split(test.buildFlags["RELEASE_ACONFIG_EXTRA_RELEASE_CONFIGS"], " ") {
expectedKeys = append(expectedKeys, rc) expectedKeys = append(expectedKeys, rc)

View File

@@ -38,6 +38,6 @@ func TestAconfigValueSet(t *testing.T) {
module := result.ModuleForTests("module_name", "").Module().(*ValueSetModule) module := result.ModuleForTests("module_name", "").Module().(*ValueSetModule)
// Check that the provider has the right contents // 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()) android.AssertStringEquals(t, "AvailablePackages", "blah.aconfig_values", depData.AvailablePackages["foo.package"][0].String())
} }

View File

@@ -33,7 +33,7 @@ func TestAconfigValues(t *testing.T) {
module := result.ModuleForTests("module_name", "").Module().(*ValuesModule) module := result.ModuleForTests("module_name", "").Module().(*ValuesModule)
// Check that the provider has the right contents // 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.AssertStringEquals(t, "package", "foo.package", depData.Package)
android.AssertPathsEndWith(t, "srcs", []string{"blah.aconfig_values"}, depData.Values) android.AssertPathsEndWith(t, "srcs", []string{"blah.aconfig_values"}, depData.Values)
} }

View File

@@ -15,9 +15,10 @@
package aconfig package aconfig
import ( import (
"android/soong/android"
"fmt" "fmt"
"slices" "slices"
"android/soong/android"
) )
// A singleton module that collects all of the aconfig flags declared in the // A singleton module that collects all of the aconfig flags declared in the
@@ -55,7 +56,7 @@ func (this *allAconfigDeclarationsSingleton) GenerateBuildActions(ctx android.Si
var packages = make(map[string]int) var packages = make(map[string]int)
var cacheFiles android.Paths var cacheFiles android.Paths
ctx.VisitAllModules(func(module android.Module) { ctx.VisitAllModules(func(module android.Module) {
decl, ok := android.SingletonModuleProvider(ctx, module, android.AconfigReleaseDeclarationsProviderKey) decl, ok := android.OtherModuleProvider(ctx, module, android.AconfigReleaseDeclarationsProviderKey)
if !ok { if !ok {
return return
} }

View File

@@ -38,7 +38,7 @@ func (this *allBuildFlagDeclarationsSingleton) GenerateBuildActions(ctx android.
// Find all of the build_flag_declarations modules // Find all of the build_flag_declarations modules
var intermediateFiles android.Paths var intermediateFiles android.Paths
ctx.VisitAllModules(func(module android.Module) { ctx.VisitAllModules(func(module android.Module) {
decl, ok := android.SingletonModuleProvider(ctx, module, BuildFlagDeclarationsProviderKey) decl, ok := android.OtherModuleProvider(ctx, module, BuildFlagDeclarationsProviderKey)
if !ok { if !ok {
return return
} }

View File

@@ -30,7 +30,7 @@ func (this *exportedJavaDeclarationsLibrarySingleton) GenerateBuildActions(ctx a
// Find all of the aconfig_declarations modules // Find all of the aconfig_declarations modules
var cacheFiles android.Paths var cacheFiles android.Paths
ctx.VisitAllModules(func(module android.Module) { ctx.VisitAllModules(func(module android.Module) {
decl, ok := android.SingletonModuleProvider(ctx, module, android.AconfigDeclarationsProviderKey) decl, ok := android.OtherModuleProvider(ctx, module, android.AconfigDeclarationsProviderKey)
if !ok { if !ok {
return return
} }

View File

@@ -15,8 +15,9 @@
package aidl_library package aidl_library
import ( import (
"android/soong/android"
"testing" "testing"
"android/soong/android"
) )
func TestAidlLibrary(t *testing.T) { func TestAidlLibrary(t *testing.T) {
@@ -46,7 +47,7 @@ func TestAidlLibrary(t *testing.T) {
).RunTest(t).TestContext ).RunTest(t).TestContext
foo := ctx.ModuleForTests("foo", "").Module().(*AidlLibrary) foo := ctx.ModuleForTests("foo", "").Module().(*AidlLibrary)
actualInfo, _ := android.SingletonModuleProvider(ctx, foo, AidlLibraryProvider) actualInfo, _ := android.OtherModuleProvider(ctx, foo, AidlLibraryProvider)
android.AssertArrayString( android.AssertArrayString(
t, t,
@@ -95,7 +96,7 @@ func TestAidlLibraryWithoutStripImportPrefix(t *testing.T) {
).RunTest(t).TestContext ).RunTest(t).TestContext
foo := ctx.ModuleForTests("foo", "").Module().(*AidlLibrary) foo := ctx.ModuleForTests("foo", "").Module().(*AidlLibrary)
actualInfo, _ := android.SingletonModuleProvider(ctx, foo, AidlLibraryProvider) actualInfo, _ := android.OtherModuleProvider(ctx, foo, AidlLibraryProvider)
android.AssertArrayString( android.AssertArrayString(
t, t,

View File

@@ -141,7 +141,7 @@ func aconfigUpdateAndroidBuildActions(ctx ModuleContext) {
} }
func aconfigUpdateAndroidMkData(ctx fillInEntriesContext, mod Module, data *AndroidMkData) { 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 there is no aconfigPropagatingProvider, or there are no AconfigFiles, then we are done.
if !ok || len(info.AconfigFiles) == 0 { if !ok || len(info.AconfigFiles) == 0 {
return return
@@ -172,7 +172,7 @@ func aconfigUpdateAndroidMkEntries(ctx fillInEntriesContext, mod Module, entries
if len(*entries) == 0 { if len(*entries) == 0 {
return return
} }
info, ok := SingletonModuleProvider(ctx, mod, AconfigPropagatingProviderKey) info, ok := OtherModuleProvider(ctx, mod, AconfigPropagatingProviderKey)
if !ok || len(info.AconfigFiles) == 0 { if !ok || len(info.AconfigFiles) == 0 {
return return
} }

View File

@@ -1,9 +1,10 @@
package android package android
import ( import (
"android/soong/android/team_proto"
"path/filepath" "path/filepath"
"android/soong/android/team_proto"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
) )
@@ -93,7 +94,7 @@ func (t *allTeamsSingleton) GenerateBuildActions(ctx SingletonContext) {
} }
testModInfo := TestModuleInformation{} testModInfo := TestModuleInformation{}
if tmi, ok := SingletonModuleProvider(ctx, module, TestOnlyProviderKey); ok { if tmi, ok := OtherModuleProvider(ctx, module, TestOnlyProviderKey); ok {
testModInfo = tmi testModInfo = tmi
} }

View File

@@ -170,7 +170,7 @@ type androidMkExtraEntriesContext struct {
} }
func (a *androidMkExtraEntriesContext) Provider(provider blueprint.AnyProviderKey) (any, bool) { 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) type AndroidMkExtraEntriesFunc func(ctx AndroidMkExtraEntriesContext, entries *AndroidMkEntries)
@@ -497,7 +497,7 @@ type fillInEntriesContext interface {
ModuleDir(module blueprint.Module) string ModuleDir(module blueprint.Module) string
ModuleSubDir(module blueprint.Module) string ModuleSubDir(module blueprint.Module) string
Config() Config 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 ModuleType(module blueprint.Module) string
OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{}) OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{})
} }
@@ -633,11 +633,11 @@ func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint
} }
} }
if licenseMetadata, ok := SingletonModuleProvider(ctx, mod, LicenseMetadataProvider); ok { if licenseMetadata, ok := OtherModuleProvider(ctx, mod, LicenseMetadataProvider); ok {
a.SetPath("LOCAL_SOONG_LICENSE_METADATA", licenseMetadata.LicenseMetadataPath) 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) a.SetBool("LOCAL_SOONG_MODULE_INFO_JSON", true)
} }
@@ -918,7 +918,7 @@ func translateAndroidModule(ctx SingletonContext, w io.Writer, moduleInfoJSONs *
} }
if !data.Entries.disabled() { if !data.Entries.disabled() {
if moduleInfoJSON, ok := SingletonModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok { if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
*moduleInfoJSONs = append(*moduleInfoJSONs, moduleInfoJSON) *moduleInfoJSONs = append(*moduleInfoJSONs, moduleInfoJSON)
} }
} }
@@ -960,7 +960,7 @@ func translateAndroidMkEntriesModule(ctx SingletonContext, w io.Writer, moduleIn
} }
if len(entriesList) > 0 && !entriesList[0].disabled() { 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) *moduleInfoJSONs = append(*moduleInfoJSONs, moduleInfoJSON)
} }
} }

View File

@@ -267,7 +267,7 @@ func (c *complianceMetadataSingleton) GenerateBuildActions(ctx SingletonContext)
writerToCsv(csvWriter, metadata) writerToCsv(csvWriter, metadata)
return return
} }
if provider, ok := ctx.moduleProvider(module, ComplianceMetadataProvider); ok { if provider, ok := ctx.otherModuleProvider(module, ComplianceMetadataProvider); ok {
metadataInfo := provider.(*ComplianceMetadataInfo) metadataInfo := provider.(*ComplianceMetadataInfo)
rowId = rowId + 1 rowId = rowId + 1
metadata := []string{strconv.Itoa(rowId)} metadata := []string{strconv.Itoa(rowId)}

View File

@@ -42,7 +42,7 @@ func (l *logtagsSingleton) GenerateBuildActions(ctx SingletonContext) {
if !module.ExportedToMake() { if !module.ExportedToMake() {
return return
} }
if logtagsInfo, ok := SingletonModuleProvider(ctx, module, LogtagsProviderKey); ok { if logtagsInfo, ok := OtherModuleProvider(ctx, module, LogtagsProviderKey); ok {
allLogtags = append(allLogtags, logtagsInfo.Logtags...) allLogtags = append(allLogtags, logtagsInfo.Logtags...)
} }
}) })

View File

@@ -94,7 +94,7 @@ type MakeVarsContext interface {
ModuleDir(module blueprint.Module) string ModuleDir(module blueprint.Module) string
ModuleSubDir(module blueprint.Module) string ModuleSubDir(module blueprint.Module) string
ModuleType(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 BlueprintFile(module blueprint.Module) string
ModuleErrorf(module blueprint.Module, format string, args ...interface{}) ModuleErrorf(module blueprint.Module, format string, args ...interface{})

View File

@@ -2519,7 +2519,7 @@ func outputFilesForModuleFromProvider(ctx PathContext, module blueprint.Module,
fromProperty = true fromProperty = true
} }
} else if cta, isCta := ctx.(*singletonContextAdaptor); isCta { } else if cta, isCta := ctx.(*singletonContextAdaptor); isCta {
providerData, _ := cta.moduleProvider(module, OutputFilesProvider) providerData, _ := cta.otherModuleProvider(module, OutputFilesProvider)
outputFiles, _ = providerData.(OutputFilesInfo) outputFiles, _ = providerData.(OutputFilesInfo)
} else { } else {
return nil, fmt.Errorf("unsupported context %q in method outputFilesForModuleFromProvider", reflect.TypeOf(ctx)) return nil, fmt.Errorf("unsupported context %q in method outputFilesForModuleFromProvider", reflect.TypeOf(ctx))

View File

@@ -14,6 +14,8 @@ var _ OtherModuleProviderContext = BaseModuleContext(nil)
var _ OtherModuleProviderContext = ModuleContext(nil) var _ OtherModuleProviderContext = ModuleContext(nil)
var _ OtherModuleProviderContext = BottomUpMutatorContext(nil) var _ OtherModuleProviderContext = BottomUpMutatorContext(nil)
var _ OtherModuleProviderContext = TopDownMutatorContext(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 // 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 // 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 @@ func ModuleProvider[K any](ctx ModuleProviderContext, provider blueprint.Provide
return value.(K), ok 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 // SetProviderContext is a helper interface that is a subset of ModuleContext, BottomUpMutatorContext, or
// TopDownMutatorContext for use in SetProvider. // TopDownMutatorContext for use in SetProvider.
type SetProviderContext interface { type SetProviderContext interface {

View File

@@ -35,7 +35,7 @@ type SingletonContext interface {
// Allows generating build actions for `referer` based on the metadata for `name` deferred until the singleton context. // Allows generating build actions for `referer` based on the metadata for `name` deferred until the singleton context.
ModuleVariantsFromName(referer Module, name string) []Module 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{}) ModuleErrorf(module blueprint.Module, format string, args ...interface{})
Errorf(format string, args ...interface{}) Errorf(format string, args ...interface{})
@@ -279,7 +279,7 @@ func (s *singletonContextAdaptor) ModuleVariantsFromName(referer Module, name st
return result 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) return s.SingletonContext.ModuleProvider(module, provider)
} }

View File

@@ -212,7 +212,7 @@ func (ctx *TestContext) HardCodedPreArchMutators(f RegisterMutatorFunc) {
ctx.PreArchMutators(f) 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) return ctx.Context.ModuleProvider(m, p)
} }
@@ -230,7 +230,7 @@ func (ctx *TestContext) FinalDepsMutators(f RegisterMutatorFunc) {
func (ctx *TestContext) OtherModuleProviderAdaptor() OtherModuleProviderContext { func (ctx *TestContext) OtherModuleProviderAdaptor() OtherModuleProviderContext {
return NewOtherModuleProviderAdaptor(func(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool) { return NewOtherModuleProviderAdaptor(func(module blueprint.Module, provider blueprint.AnyProviderKey) (any, bool) {
return ctx.moduleProvider(module, provider) return ctx.otherModuleProvider(module, provider)
}) })
} }

View File

@@ -88,7 +88,7 @@ func (s *apexDepsInfoSingleton) GenerateBuildActions(ctx android.SingletonContex
updatableFlatLists := android.Paths{} updatableFlatLists := android.Paths{}
ctx.VisitAllModules(func(module android.Module) { ctx.VisitAllModules(func(module android.Module) {
if binaryInfo, ok := module.(android.ApexBundleDepsInfoIntf); ok { 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 path := binaryInfo.FlatListPath(); path != nil {
if binaryInfo.Updatable() || apexInfo.Updatable { if binaryInfo.Updatable() || apexInfo.Updatable {
updatableFlatLists = append(updatableFlatLists, path) updatableFlatLists = append(updatableFlatLists, path)
@@ -155,7 +155,7 @@ func (a *apexPrebuiltInfo) GenerateBuildActions(ctx android.SingletonContext) {
prebuiltInfos := []android.PrebuiltInfo{} prebuiltInfos := []android.PrebuiltInfo{}
ctx.VisitAllModules(func(m android.Module) { 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 prebuiltInfoProvider to filter out non apex soong modules.
// Use HideFromMake to filter out the unselected variants of a specific apex. // Use HideFromMake to filter out the unselected variants of a specific apex.
if exists && !m.IsHideFromMake() { if exists && !m.IsHideFromMake() {

View File

@@ -152,7 +152,7 @@ func TestBootclasspathFragments_FragmentDependency(t *testing.T) {
// Check stub dex paths exported by art. // Check stub dex paths exported by art.
artFragment := result.Module("art-bootclasspath-fragment", "android_common") 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" 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" bazSystemStubs := "out/soong/.intermediates/baz.stubs.exportable.system/android_common/dex/baz.stubs.exportable.system.jar"
@@ -165,7 +165,7 @@ func TestBootclasspathFragments_FragmentDependency(t *testing.T) {
// Check stub dex paths exported by other. // Check stub dex paths exported by other.
otherFragment := result.Module("other-bootclasspath-fragment", "android_common") 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" 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" fooSystemStubs := "out/soong/.intermediates/foo.stubs.exportable.system/android_common/dex/foo.stubs.exportable.system.jar"
@@ -688,7 +688,7 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) {
// Make sure that the fragment provides the hidden API encoded dex jars to the APEX. // Make sure that the fragment provides the hidden API encoded dex jars to the APEX.
fragment := result.Module("mybootclasspathfragment", "android_common_apex10000") 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) { checkFragmentExportedDexJar := func(name string, expectedDexJar string) {
module := result.Module(name, "android_common_apex10000") module := result.Module(name, "android_common_apex10000")

View File

@@ -154,7 +154,7 @@ func TestPlatformBootclasspath_Fragments(t *testing.T) {
).RunTest(t) ).RunTest(t)
pbcp := result.Module("platform-bootclasspath", "android_common") 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 { for _, category := range java.HiddenAPIFlagFileCategories {
name := category.PropertyName() name := category.PropertyName()
@@ -236,7 +236,7 @@ func TestPlatformBootclasspath_LegacyPrebuiltFragment(t *testing.T) {
) )
pbcp := result.Module("myplatform-bootclasspath", "android_common") 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, "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()) 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())

View File

@@ -88,7 +88,7 @@ func (singleton *sizesSingleton) GenerateBuildActions(ctx android.SingletonConte
if !m.ExportedToMake() { if !m.ExportedToMake() {
return return
} }
filePaths, ok := android.SingletonModuleProvider(ctx, m, fileSizeMeasurerKey) filePaths, ok := android.OtherModuleProvider(ctx, m, fileSizeMeasurerKey)
if !ok { if !ok {
return return
} }

View File

@@ -851,7 +851,7 @@ func TestStaticLibDepReordering(t *testing.T) {
variant := "android_arm64_armv8-a_static" variant := "android_arm64_armv8-a_static"
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module) 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() actual := android.Paths(staticLibInfo.TransitiveStaticLibrariesForOrdering.ToList()).RelativeToTop()
expected := GetOutputPaths(ctx, variant, []string{"a", "c", "b", "d"}) expected := GetOutputPaths(ctx, variant, []string{"a", "c", "b", "d"})
@@ -887,7 +887,7 @@ func TestStaticLibDepReorderingWithShared(t *testing.T) {
variant := "android_arm64_armv8-a_static" variant := "android_arm64_armv8-a_static"
moduleA := ctx.ModuleForTests("a", variant).Module().(*Module) 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() actual := android.Paths(staticLibInfo.TransitiveStaticLibrariesForOrdering.ToList()).RelativeToTop()
expected := GetOutputPaths(ctx, variant, []string{"a", "c", "b"}) expected := GetOutputPaths(ctx, variant, []string{"a", "c", "b"})
@@ -999,7 +999,7 @@ func TestLlndkLibrary(t *testing.T) {
checkExportedIncludeDirs := func(module, variant string, expectedSystemDirs []string, expectedDirs ...string) { checkExportedIncludeDirs := func(module, variant string, expectedSystemDirs []string, expectedDirs ...string) {
t.Helper() t.Helper()
m := result.ModuleForTests(module, variant).Module() 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+"]", android.AssertPathsRelativeToTopEquals(t, "exported include dirs for "+module+"["+variant+"]",
expectedDirs, f.IncludeDirs) expectedDirs, f.IncludeDirs)
android.AssertPathsRelativeToTopEquals(t, "exported include dirs for "+module+"["+variant+"]", android.AssertPathsRelativeToTopEquals(t, "exported include dirs for "+module+"["+variant+"]",
@@ -1027,7 +1027,7 @@ func TestLlndkLibrary(t *testing.T) {
} }
} }
vendorModule := result.ModuleForTests(module, vendorVariant).Module() 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) vendorDirs := android.Concat(vendorInfo.IncludeDirs, vendorInfo.SystemIncludeDirs)
android.AssertStringEquals(t, module+" has different exported include dirs for vendor variant and ABI check", android.AssertStringEquals(t, module+" has different exported include dirs for vendor variant and ABI check",
android.JoinPathsWithPrefix(vendorDirs, "-I"), abiCheckFlags) android.JoinPathsWithPrefix(vendorDirs, "-I"), abiCheckFlags)
@@ -2452,7 +2452,7 @@ func TestIncludeDirsExporting(t *testing.T) {
checkIncludeDirs := func(t *testing.T, ctx *android.TestContext, module android.Module, checkers ...exportedChecker) { checkIncludeDirs := func(t *testing.T, ctx *android.TestContext, module android.Module, checkers ...exportedChecker) {
t.Helper() t.Helper()
exported, _ := android.SingletonModuleProvider(ctx, module, FlagExporterInfoProvider) exported, _ := android.OtherModuleProvider(ctx, module, FlagExporterInfoProvider)
name := module.Name() name := module.Name()
for _, checker := range checkers { for _, checker := range checkers {

View File

@@ -47,7 +47,7 @@ var prepareForTsanTest = android.FixtureAddFile("tsan/Android.bp", []byte(`
`)) `))
type providerInterface interface { type providerInterface interface {
android.SingletonModuleProviderContext android.OtherModuleProviderContext
} }
// expectSharedLinkDep verifies that the from module links against the to module as a // expectSharedLinkDep verifies that the from module links against the to module as a
@@ -55,7 +55,7 @@ type providerInterface interface {
func expectSharedLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) { func expectSharedLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
t.Helper() t.Helper()
fromLink := from.Description("link") 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) { 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", t.Errorf("%s should link against %s, expected %q, got %q",
@@ -68,7 +68,7 @@ func expectSharedLinkDep(t *testing.T, ctx providerInterface, from, to android.T
func expectNoSharedLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) { func expectNoSharedLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
t.Helper() t.Helper()
fromLink := from.Description("link") 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) { 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", t.Errorf("%s should not link against %s, expected %q, got %q",
@@ -81,7 +81,7 @@ func expectNoSharedLinkDep(t *testing.T, ctx providerInterface, from, to android
func expectStaticLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) { func expectStaticLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
t.Helper() t.Helper()
fromLink := from.Description("link") 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) { 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", t.Errorf("%s should link against %s, expected %q, got %q",
@@ -95,7 +95,7 @@ func expectStaticLinkDep(t *testing.T, ctx providerInterface, from, to android.T
func expectNoStaticLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) { func expectNoStaticLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
t.Helper() t.Helper()
fromLink := from.Description("link") 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) { 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", t.Errorf("%s should not link against %s, expected %q, got %q",

View File

@@ -53,7 +53,7 @@ func TestAarImportProducesJniPackages(t *testing.T) {
appMod := ctx.Module(tc.name, "android_common") appMod := ctx.Module(tc.name, "android_common")
appTestMod := ctx.ModuleForTests(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 { if !ok {
t.Errorf("expected android_library_import to have JniPackageProvider") t.Errorf("expected android_library_import to have JniPackageProvider")
} }

View File

@@ -273,7 +273,7 @@ func TestBootclasspathFragment_StubLibs(t *testing.T) {
`) `)
fragment := result.Module("myfragment", "android_common") 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" stubsJar := "out/soong/.intermediates/mystublib/android_common/dex/mystublib.jar"
@@ -457,7 +457,7 @@ func TestSnapshotWithBootclasspathFragment_HiddenAPI(t *testing.T) {
// Make sure that the library exports hidden API properties for use by the bootclasspath_fragment. // Make sure that the library exports hidden API properties for use by the bootclasspath_fragment.
library := result.Module("mynewlibrary", "android_common") 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, "split packages", []string{"sdklibrary", "newlibrary"}, info.SplitPackages)
android.AssertArrayString(t, "package prefixes", []string{"newlibrary.all.mine"}, info.PackagePrefixes) android.AssertArrayString(t, "package prefixes", []string{"newlibrary.all.mine"}, info.PackagePrefixes)
android.AssertArrayString(t, "single packages", []string{"newlibrary.mine"}, info.SinglePackages) android.AssertArrayString(t, "single packages", []string{"newlibrary.mine"}, info.SinglePackages)

View File

@@ -29,7 +29,7 @@ func TestCodeMetadata(t *testing.T) {
module := result.ModuleForTests("module-name", "") module := result.ModuleForTests("module-name", "")
// Check that the provider has the right contents // 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( if !strings.HasSuffix(
data.IntermediatePath.String(), "/intermediateCodeMetadata.pb", data.IntermediatePath.String(), "/intermediateCodeMetadata.pb",
) { ) {

View File

@@ -1341,7 +1341,7 @@ func (d *dexpreoptBootJars) MakeVars(ctx android.MakeVarsContext) {
image := d.defaultBootImage image := d.defaultBootImage
if image != nil { 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()) ctx.Strict("DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED", profileInstallInfo.profileInstalls.String())
if profileInstallInfo.profileLicenseMetadataFile.Valid() { if profileInstallInfo.profileLicenseMetadataFile.Valid() {
ctx.Strict("DEXPREOPT_IMAGE_PROFILE_LICENSE_METADATA", profileInstallInfo.profileLicenseMetadataFile.String()) ctx.Strict("DEXPREOPT_IMAGE_PROFILE_LICENSE_METADATA", profileInstallInfo.profileLicenseMetadataFile.String())

View File

@@ -1237,7 +1237,7 @@ func nestedCheckBootImageConfig(t *testing.T, result *android.TestResult, imageC
if !mutated { if !mutated {
dexBootJarModule := result.ModuleForTests("dex_bootjars", "android_common") 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) assertInstallsEqual(t, "profileInstalls", expected.profileInstalls, profileInstallInfo.profileInstalls)
android.AssertStringEquals(t, "profileLicenseMetadataFile", expected.profileLicenseMetadataFile, profileInstallInfo.profileLicenseMetadataFile.RelativeToTop().String()) android.AssertStringEquals(t, "profileLicenseMetadataFile", expected.profileLicenseMetadataFile, profileInstallInfo.profileLicenseMetadataFile.RelativeToTop().String())
} }

View File

@@ -1100,7 +1100,7 @@ func TestJavaImport(t *testing.T) {
source := ctx.ModuleForTests("source_library", "android_common") source := ctx.ModuleForTests("source_library", "android_common")
sourceJar := source.Output("javac/source_library.jar") sourceJar := source.Output("javac/source_library.jar")
sourceHeaderJar := source.Output("turbine-combined/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 // The source library produces separate implementation and header jars
android.AssertPathsRelativeToTopEquals(t, "source library implementation jar", android.AssertPathsRelativeToTopEquals(t, "source library implementation jar",
@@ -1110,7 +1110,7 @@ func TestJavaImport(t *testing.T) {
importWithNoDeps := ctx.ModuleForTests("import_with_no_deps", "android_common") importWithNoDeps := ctx.ModuleForTests("import_with_no_deps", "android_common")
importWithNoDepsJar := importWithNoDeps.Output("combined/import_with_no_deps.jar") 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. // 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", android.AssertPathsRelativeToTopEquals(t, "import with no deps implementation jar",
@@ -1123,7 +1123,7 @@ func TestJavaImport(t *testing.T) {
importWithSourceDeps := ctx.ModuleForTests("import_with_source_deps", "android_common") importWithSourceDeps := ctx.ModuleForTests("import_with_source_deps", "android_common")
importWithSourceDepsJar := importWithSourceDeps.Output("combined/import_with_source_deps.jar") importWithSourceDepsJar := importWithSourceDeps.Output("combined/import_with_source_deps.jar")
importWithSourceDepsHeaderJar := importWithSourceDeps.Output("turbine-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. // An import with source deps produces separate header and implementation jars.
android.AssertPathsRelativeToTopEquals(t, "import with source deps implementation jar", android.AssertPathsRelativeToTopEquals(t, "import with source deps implementation jar",
@@ -1137,7 +1137,7 @@ func TestJavaImport(t *testing.T) {
importWithImportDeps := ctx.ModuleForTests("import_with_import_deps", "android_common") importWithImportDeps := ctx.ModuleForTests("import_with_import_deps", "android_common")
importWithImportDepsJar := importWithImportDeps.Output("combined/import_with_import_deps.jar") 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. // 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", android.AssertPathsRelativeToTopEquals(t, "import with import deps implementation jar",
@@ -2274,7 +2274,7 @@ func TestTransitiveSrcFiles(t *testing.T) {
} }
`) `)
c := ctx.ModuleForTests("c", "android_common").Module() 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()) transitiveSrcFiles := android.Paths(javaInfo.TransitiveSrcFiles.ToList())
android.AssertArrayString(t, "unexpected jar deps", []string{"b.java", "c.java"}, transitiveSrcFiles.Strings()) android.AssertArrayString(t, "unexpected jar deps", []string{"b.java", "c.java"}, transitiveSrcFiles.Strings())
} }

View File

@@ -89,7 +89,7 @@ func (j *jdepsGeneratorSingleton) GenerateBuildActions(ctx android.SingletonCont
dpInfo.Classes = append(dpInfo.Classes, data.Class) 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.Installed_paths = append(dpInfo.Installed_paths, dep.ImplementationJars.Strings()...)
} }
dpInfo.Classes = android.FirstUniqueStrings(dpInfo.Classes) dpInfo.Classes = android.FirstUniqueStrings(dpInfo.Classes)

View File

@@ -650,7 +650,7 @@ func (l *lintSingleton) generateLintReportZips(ctx android.SingletonContext) {
} }
if apex, ok := m.(android.ApexModule); ok && apex.NotAvailableForPlatform() { 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() { if apexInfo.IsForPlatform() {
// There are stray platform variants of modules in apexes that are not available for // 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. // the platform, and they sometimes can't be built. Don't depend on them.

View File

@@ -278,7 +278,7 @@ func createFrameworkAidl(stubsModules []string, path android.WritablePath, ctx a
ctx.VisitAllModules(func(module android.Module) { ctx.VisitAllModules(func(module android.Module) {
// Collect dex jar paths for the modules listed above. // 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) name := ctx.ModuleName(module)
if i := android.IndexList(name, stubsModules); i != -1 { if i := android.IndexList(name, stubsModules); i != -1 {
stubsJars[i] = j.HeaderJars stubsJars[i] = j.HeaderJars

View File

@@ -130,7 +130,7 @@ func TestJavaSdkLibrary(t *testing.T) {
result.ModuleForTests("foo.api.system.28", "") result.ModuleForTests("foo.api.system.28", "")
result.ModuleForTests("foo.api.test.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{ expectedFooExportedComponents := []string{
"foo-removed.api.combined.public.latest", "foo-removed.api.combined.public.latest",
"foo-removed.api.combined.system.latest", "foo-removed.api.combined.system.latest",

View File

@@ -25,7 +25,7 @@ func getModuleHeaderJarsAsRelativeToTopPaths(result *android.TestResult, moduleN
paths := []string{} paths := []string{}
for _, moduleName := range moduleNames { for _, moduleName := range moduleNames {
module := result.Module(moduleName, "android_common") 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()...) paths = append(paths, info.HeaderJars.RelativeToTop().Strings()...)
} }
return paths return paths

View File

@@ -32,7 +32,7 @@ func TestTestSpec(t *testing.T) {
module := result.ModuleForTests("module-name", "") module := result.ModuleForTests("module-name", "")
// Check that the provider has the right contents // 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( if !strings.HasSuffix(
data.IntermediatePath.String(), "/intermediateTestSpecMetadata.pb", data.IntermediatePath.String(), "/intermediateTestSpecMetadata.pb",
) { ) {

View File

@@ -632,7 +632,7 @@ func CheckPlatformBootclasspathModules(t *testing.T, result *android.TestResult,
func CheckClasspathFragmentProtoContentInfoProvider(t *testing.T, result *android.TestResult, generated bool, contents, outputFilename, installDir string) { func CheckClasspathFragmentProtoContentInfoProvider(t *testing.T, result *android.TestResult, generated bool, contents, outputFilename, installDir string) {
t.Helper() t.Helper()
p := result.Module("platform-bootclasspath", "android_common").(*platformBootclasspathModule) 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.AssertBoolEquals(t, "classpath proto generated", generated, info.ClasspathFragmentProtoGenerated)
android.AssertStringEquals(t, "classpath proto contents", contents, info.ClasspathFragmentProtoContents.String()) android.AssertStringEquals(t, "classpath proto contents", contents, info.ClasspathFragmentProtoContents.String())
@@ -652,7 +652,7 @@ func ApexNamePairsFromModules(ctx *android.TestContext, modules []android.Module
func apexNamePairFromModule(ctx *android.TestContext, module android.Module) string { func apexNamePairFromModule(ctx *android.TestContext, module android.Module) string {
name := module.Name() name := module.Name()
var apex string var apex string
apexInfo, _ := android.SingletonModuleProvider(ctx, module, android.ApexInfoProvider) apexInfo, _ := android.OtherModuleProvider(ctx, module, android.ApexInfoProvider)
if apexInfo.IsForPlatform() { if apexInfo.IsForPlatform() {
apex = "platform" apex = "platform"
} else { } else {

View File

@@ -21,7 +21,7 @@ func (this *allCodeMetadataSingleton) GenerateBuildActions(ctx android.Singleton
ctx.VisitAllModules( ctx.VisitAllModules(
func(module android.Module) { 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) intermediateMetadataPaths = append(intermediateMetadataPaths, metadata.IntermediatePath)
} }
}, },

View File

@@ -21,7 +21,7 @@ func (this *allTestSpecsSingleton) GenerateBuildActions(ctx android.SingletonCon
var intermediateMetadataPaths android.Paths var intermediateMetadataPaths android.Paths
ctx.VisitAllModules(func(module android.Module) { 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) intermediateMetadataPaths = append(intermediateMetadataPaths, metadata.IntermediatePath)
} }
}) })