Merge "Merge SingletonProviderContext with OtherModuleProviderContext" into main am: 246b43049c am: 73282e8129

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3216676

Change-Id: Ic5fa82e4179f922e35479e527a392db141a973c4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Yu Liu
2024-08-13 16:38:05 +00:00
committed by Automerger Merge Worker
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)
// 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 @@ func TestAconfigDeclarationsWithExportableUnset(t *testing.T) {
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 @@ func TestGenerateAndroidBuildActions(t *testing.T) {
}
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)

View File

@@ -38,6 +38,6 @@ func TestAconfigValueSet(t *testing.T) {
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())
}

View File

@@ -33,7 +33,7 @@ func TestAconfigValues(t *testing.T) {
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)
}

View File

@@ -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 @@ func (this *allAconfigDeclarationsSingleton) GenerateBuildActions(ctx android.Si
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
}

View File

@@ -38,7 +38,7 @@ func (this *allBuildFlagDeclarationsSingleton) GenerateBuildActions(ctx android.
// 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
}

View File

@@ -30,7 +30,7 @@ func (this *exportedJavaDeclarationsLibrarySingleton) GenerateBuildActions(ctx a
// 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
}