Cleanup hardcoded references to android_*stubs_current
These hardcoded refs will need to be updated when we start using .txt
stub equivalent (single-tree/multi-tree). Instead of strewing this logic
all over the codebase, create a helper function that contains the
replacement logic. All other places should call this helper function
instead of calculating the name of .txt equivalent soong module by
itself.
(Will do a similar cleanup in build/make)
Test: no change in ninja file
Change-Id: I6bf999eb4aeaba6ac2a44b9016bae4ec8c79ce19
diff --git a/java/sdk.go b/java/sdk.go
index 1e7727b..72a5006 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -191,12 +191,8 @@
bootclasspath: corePlatformBootclasspathLibraries(ctx),
noFrameworksLibs: true,
}
- case android.SdkPublic:
- return toModule("android_stubs_current", sdkFrameworkAidlPath(ctx))
- case android.SdkSystem:
- return toModule("android_system_stubs_current", sdkFrameworkAidlPath(ctx))
- case android.SdkTest:
- return toModule("android_test_stubs_current", sdkFrameworkAidlPath(ctx))
+ case android.SdkPublic, android.SdkSystem, android.SdkTest:
+ return toModule(sdkVersion.Kind.JavaLibraryName(ctx.Config()), sdkFrameworkAidlPath(ctx))
case android.SdkCore:
return sdkDep{
useModule: true,
@@ -206,10 +202,10 @@
}
case android.SdkModule:
// TODO(146757305): provide .apk and .aidl that have more APIs for modules
- return toModule("android_module_lib_stubs_current", nonUpdatableFrameworkAidlPath(ctx))
+ return toModule(sdkVersion.Kind.JavaLibraryName(ctx.Config()), nonUpdatableFrameworkAidlPath(ctx))
case android.SdkSystemServer:
// TODO(146757305): provide .apk and .aidl that have more APIs for modules
- return toModule("android_system_server_stubs_current", sdkFrameworkAidlPath(ctx))
+ return toModule(sdkVersion.Kind.JavaLibraryName(ctx.Config()), sdkFrameworkAidlPath(ctx))
default:
panic(fmt.Errorf("invalid sdk %q", sdkVersion.Raw))
}
@@ -272,9 +268,9 @@
// Create framework.aidl by extracting anything that implements android.os.Parcelable from the SDK stubs modules.
func createSdkFrameworkAidl(ctx android.SingletonContext) {
stubsModules := []string{
- "android_stubs_current",
- "android_test_stubs_current",
- "android_system_stubs_current",
+ android.SdkPublic.JavaLibraryName(ctx.Config()),
+ android.SdkTest.JavaLibraryName(ctx.Config()),
+ android.SdkSystem.JavaLibraryName(ctx.Config()),
}
combinedAidl := sdkFrameworkAidlPath(ctx)
@@ -289,7 +285,7 @@
// Creates a version of framework.aidl for the non-updatable part of the platform.
func createNonUpdatableFrameworkAidl(ctx android.SingletonContext) {
- stubsModules := []string{"android_module_lib_stubs_current"}
+ stubsModules := []string{android.SdkModule.JavaLibraryName(ctx.Config())}
combinedAidl := nonUpdatableFrameworkAidlPath(ctx)
tempPath := tempPathForRestat(ctx, combinedAidl)