Convert checkSdkVersions to use ModuleProxy.
Bug: 377723687
Test: Unit tests and compare the ninja and mk files generated.
Change-Id: I5d7150feb8dbb84ac4e01059e76f451fbfc5f7eb
diff --git a/java/java.go b/java/java.go
index 25be93b..1689aee 100644
--- a/java/java.go
+++ b/java/java.go
@@ -276,6 +276,11 @@
UsesLibrary *usesLibrary
}
+type ModuleWithSdkDepInfo struct {
+ SdkLinkType sdkLinkType
+ Stubs bool
+}
+
// JavaInfo contains information about a java module for use by modules that depend on it.
type JavaInfo struct {
// HeaderJars is a list of jars that can be passed as the javac classpath in order to link
@@ -364,10 +369,16 @@
ProvidesUsesLibInfo *ProvidesUsesLibInfo
ModuleWithUsesLibraryInfo *ModuleWithUsesLibraryInfo
+
+ ModuleWithSdkDepInfo *ModuleWithSdkDepInfo
}
var JavaInfoProvider = blueprint.NewProvider[*JavaInfo]()
+type JavaLibraryInfo struct{}
+
+var JavaLibraryInfoProvider = blueprint.NewProvider[JavaLibraryInfo]()
+
// SyspropPublicStubInfo contains info about the sysprop public stub library that corresponds to
// the sysprop implementation library.
type SyspropPublicStubInfo struct {
@@ -1047,6 +1058,8 @@
TopLevelTarget: j.sourceProperties.Top_level_test_target,
})
+ android.SetProvider(ctx, JavaLibraryInfoProvider, JavaLibraryInfo{})
+
if javaInfo != nil {
setExtraJavaInfo(ctx, j, javaInfo)
android.SetProvider(ctx, JavaInfoProvider, javaInfo)
@@ -3542,4 +3555,12 @@
UsesLibrary: mwul.UsesLibrary(),
}
}
+
+ if mwsd, ok := module.(moduleWithSdkDep); ok {
+ linkType, stubs := mwsd.getSdkLinkType(ctx, ctx.ModuleName())
+ javaInfo.ModuleWithSdkDepInfo = &ModuleWithSdkDepInfo{
+ SdkLinkType: linkType,
+ Stubs: stubs,
+ }
+ }
}