Convert ModuleProvder to generic providers API
Convert all of the callers of ModuleProvider/ModuleHasProvider to use the type-safe android.SingletonModuleProvider API. Bug: 316410648 Test: builds Change-Id: I6f11638546b64749e451cebbf33140248dc1d193
This commit is contained in:
@@ -22,8 +22,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"android/soong/android"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
)
|
||||
|
||||
var prepareForAsanTest = android.FixtureAddFile("asan/Android.bp", []byte(`
|
||||
@@ -49,7 +47,7 @@ var prepareForTsanTest = android.FixtureAddFile("tsan/Android.bp", []byte(`
|
||||
`))
|
||||
|
||||
type providerInterface interface {
|
||||
ModuleProvider(blueprint.Module, blueprint.AnyProviderKey) interface{}
|
||||
android.SingletonModuleProviderContext
|
||||
}
|
||||
|
||||
// expectSharedLinkDep verifies that the from module links against the to module as a
|
||||
@@ -57,7 +55,7 @@ type providerInterface interface {
|
||||
func expectSharedLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
|
||||
t.Helper()
|
||||
fromLink := from.Description("link")
|
||||
toInfo := ctx.ModuleProvider(to.Module(), SharedLibraryInfoProvider).(SharedLibraryInfo)
|
||||
toInfo, _ := android.SingletonModuleProvider(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",
|
||||
@@ -70,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) {
|
||||
t.Helper()
|
||||
fromLink := from.Description("link")
|
||||
toInfo := ctx.ModuleProvider(to.Module(), SharedLibraryInfoProvider).(SharedLibraryInfo)
|
||||
toInfo, _ := android.SingletonModuleProvider(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",
|
||||
@@ -83,7 +81,7 @@ func expectNoSharedLinkDep(t *testing.T, ctx providerInterface, from, to android
|
||||
func expectStaticLinkDep(t *testing.T, ctx providerInterface, from, to android.TestingModule) {
|
||||
t.Helper()
|
||||
fromLink := from.Description("link")
|
||||
toInfo := ctx.ModuleProvider(to.Module(), StaticLibraryInfoProvider).(StaticLibraryInfo)
|
||||
toInfo, _ := android.SingletonModuleProvider(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",
|
||||
@@ -97,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) {
|
||||
t.Helper()
|
||||
fromLink := from.Description("link")
|
||||
toInfo := ctx.ModuleProvider(to.Module(), StaticLibraryInfoProvider).(StaticLibraryInfo)
|
||||
toInfo, _ := android.SingletonModuleProvider(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",
|
||||
|
Reference in New Issue
Block a user