Convert OtherModuleProvider to generic providers API
Convert all of the callers of OtherModuleProvider/OtherModuleHasProvider
to use the type-safe android.OtherModuleProvider API.
Bug: 316410648
Test: builds
Change-Id: Id77f514d68761a262d9ea830a601dbed804bbbe5
diff --git a/testing/code_metadata.go b/testing/code_metadata.go
index 222a48c..3cf7c59 100644
--- a/testing/code_metadata.go
+++ b/testing/code_metadata.go
@@ -96,10 +96,8 @@
for _, m := range ctx.GetDirectDepsWithTag(codeDepTag) {
targetName := m.Name()
var moduleSrcs []string
- if ctx.OtherModuleHasProvider(m, blueprint.SrcsFileProviderKey) {
- moduleSrcs = ctx.OtherModuleProvider(
- m, blueprint.SrcsFileProviderKey,
- ).(blueprint.SrcsFileProviderData).SrcPaths
+ if srcsFileInfo, ok := android.OtherModuleProvider(ctx, m, blueprint.SrcsFileProviderKey); ok {
+ moduleSrcs = srcsFileInfo.SrcPaths
}
if module.properties.MultiOwnership {
metadata := &code_metadata_internal_proto.CodeMetadataInternal_TargetOwnership{
diff --git a/testing/test_spec.go b/testing/test_spec.go
index 02f6c60..d259612 100644
--- a/testing/test_spec.go
+++ b/testing/test_spec.go
@@ -91,7 +91,7 @@
func (module *TestSpecModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
for _, m := range ctx.GetDirectDepsWithTag(testsDepTag) {
- if !ctx.OtherModuleHasProvider(m, TestModuleProviderKey) {
+ if _, ok := android.OtherModuleProvider(ctx, m, TestModuleProviderKey); !ok {
ctx.ModuleErrorf(ErrTestModuleDataNotFound, m.Name())
}
}