summaryrefslogtreecommitdiff
path: root/java/classpath_element.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2023-12-13 13:47:44 -0800
committer Colin Cross <ccross@android.com> 2023-12-14 16:12:22 -0800
commit313aa5475f50024da74e709a55f840eb7b263153 (patch)
treefe4d43b20d557f151641b323eeae292474478427 /java/classpath_element.go
parentff694a8c88c632559c72653edf99f21c3d761dee (diff)
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
Diffstat (limited to 'java/classpath_element.go')
-rw-r--r--java/classpath_element.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/java/classpath_element.go b/java/classpath_element.go
index af99fb4fb..abbcae7a3 100644
--- a/java/classpath_element.go
+++ b/java/classpath_element.go
@@ -21,7 +21,6 @@ import (
"strings"
"android/soong/android"
- "github.com/google/blueprint"
)
// Supports constructing a list of ClasspathElement from a set of fragments and modules.
@@ -72,8 +71,7 @@ var _ ClasspathElement = (*ClasspathLibraryElement)(nil)
// ClasspathElementContext defines the context methods needed by CreateClasspathElements
type ClasspathElementContext interface {
- OtherModuleHasProvider(m blueprint.Module, provider blueprint.AnyProviderKey) bool
- OtherModuleProvider(m blueprint.Module, provider blueprint.AnyProviderKey) interface{}
+ android.OtherModuleProviderContext
ModuleErrorf(fmt string, args ...interface{})
}
@@ -123,12 +121,12 @@ func CreateClasspathElements(ctx ClasspathElementContext, libraries []android.Mo
// associated with a particular apex.
apexToFragment := map[string]android.Module{}
for _, fragment := range fragments {
- if !ctx.OtherModuleHasProvider(fragment, android.ApexInfoProvider) {
+ apexInfo, ok := android.OtherModuleProvider(ctx, fragment, android.ApexInfoProvider)
+ if !ok {
ctx.ModuleErrorf("fragment %s is not part of an apex", fragment)
continue
}
- apexInfo := ctx.OtherModuleProvider(fragment, android.ApexInfoProvider).(android.ApexInfo)
for _, apex := range apexInfo.InApexVariants {
if existing, ok := apexToFragment[apex]; ok {
ctx.ModuleErrorf("apex %s has multiple fragments, %s and %s", apex, fragment, existing)
@@ -146,8 +144,7 @@ skipLibrary:
// Iterate over the libraries to construct the ClasspathElements list.
for _, library := range libraries {
var element ClasspathElement
- if ctx.OtherModuleHasProvider(library, android.ApexInfoProvider) {
- apexInfo := ctx.OtherModuleProvider(library, android.ApexInfoProvider).(android.ApexInfo)
+ if apexInfo, ok := android.OtherModuleProvider(ctx, library, android.ApexInfoProvider); ok {
var fragment android.Module