From 91c839566eb43a99ae1f7513be4e4237a85b3553 Mon Sep 17 00:00:00 2001 From: Jihoon Kang Date: Tue, 30 May 2023 19:12:28 +0000 Subject: [PATCH] Cleanup android.JavaApiLibraryName references This change cleans up references to android.JavaApiLibraryName() so that rdeps link against "android_*_stubs_current" instead of "android_*_stubs_current.from-text". Bug: 284995489 Test: m Change-Id: Ibdf33b15981317c43e468dbc1657229d54bbd226 --- android/sdk_version.go | 19 ++++++------------- java/base.go | 18 +++++++++--------- java/hiddenapi_modular.go | 8 ++++---- java/sdk.go | 18 +++++++++--------- 4 files changed, 28 insertions(+), 35 deletions(-) diff --git a/android/sdk_version.go b/android/sdk_version.go index 08762eff2..80aeb2e69 100644 --- a/android/sdk_version.go +++ b/android/sdk_version.go @@ -84,12 +84,6 @@ func (k SdkKind) String() string { } } -// JavaLibraryName returns the soong module containing the Java APIs of that API surface. -func (k SdkKind) JavaLibraryName(c Config) string { - name := k.DefaultJavaLibraryName() - return JavaApiLibraryName(c, name) -} - // JavaApiLibraryName returns the name of .txt equivalent of a java_library, but does // not check if either module exists. // TODO: Return .txt (single-tree or multi-tree equivalents) based on config @@ -335,11 +329,10 @@ func init() { // Export the name of the soong modules representing the various Java API surfaces. func javaSdkMakeVars(ctx MakeVarsContext) { - ctx.Strict("ANDROID_PUBLIC_STUBS", SdkPublic.JavaLibraryName(ctx.Config())) - ctx.Strict("ANDROID_SYSTEM_STUBS", SdkSystem.JavaLibraryName(ctx.Config())) - ctx.Strict("ANDROID_TEST_STUBS", SdkTest.JavaLibraryName(ctx.Config())) - ctx.Strict("ANDROID_MODULE_LIB_STUBS", SdkModule.JavaLibraryName(ctx.Config())) - ctx.Strict("ANDROID_SYSTEM_SERVER_STUBS", SdkSystemServer.JavaLibraryName(ctx.Config())) - // TODO (jihoonkang): Create a .txt equivalent for core.current.stubs - ctx.Strict("ANDROID_CORE_STUBS", SdkCore.JavaLibraryName(ctx.Config())) + ctx.Strict("ANDROID_PUBLIC_STUBS", SdkPublic.DefaultJavaLibraryName()) + ctx.Strict("ANDROID_SYSTEM_STUBS", SdkSystem.DefaultJavaLibraryName()) + ctx.Strict("ANDROID_TEST_STUBS", SdkTest.DefaultJavaLibraryName()) + ctx.Strict("ANDROID_MODULE_LIB_STUBS", SdkModule.DefaultJavaLibraryName()) + ctx.Strict("ANDROID_SYSTEM_SERVER_STUBS", SdkSystemServer.DefaultJavaLibraryName()) + ctx.Strict("ANDROID_CORE_STUBS", SdkCore.DefaultJavaLibraryName()) } diff --git a/java/base.go b/java/base.go index 78c8d6011..ed61e12ed 100644 --- a/java/base.go +++ b/java/base.go @@ -1928,22 +1928,22 @@ type moduleWithSdkDep interface { func (m *Module) getSdkLinkType(ctx android.BaseModuleContext, name string) (ret sdkLinkType, stubs bool) { switch name { - case android.SdkCore.JavaLibraryName(ctx.Config()), - android.JavaApiLibraryName(ctx.Config(), "legacy.core.platform.api.stubs"), - android.JavaApiLibraryName(ctx.Config(), "stable.core.platform.api.stubs"), + case android.SdkCore.DefaultJavaLibraryName(), + "legacy.core.platform.api.stubs", + "stable.core.platform.api.stubs", "stub-annotations", "private-stub-annotations-jar", - android.JavaApiLibraryName(ctx.Config(), "core-lambda-stubs"), + "core-lambda-stubs", "core-generated-annotation-stubs": return javaCore, true - case android.SdkPublic.JavaLibraryName(ctx.Config()): + case android.SdkPublic.DefaultJavaLibraryName(): return javaSdk, true - case android.SdkSystem.JavaLibraryName(ctx.Config()): + case android.SdkSystem.DefaultJavaLibraryName(): return javaSystem, true - case android.SdkModule.JavaLibraryName(ctx.Config()): + case android.SdkModule.DefaultJavaLibraryName(): return javaModule, true - case android.SdkSystemServer.JavaLibraryName(ctx.Config()): + case android.SdkSystemServer.DefaultJavaLibraryName(): return javaSystemServer, true - case android.SdkTest.JavaLibraryName(ctx.Config()): + case android.SdkTest.DefaultJavaLibraryName(): return javaSystem, true } diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go index e54275b88..da9c9970a 100644 --- a/java/hiddenapi_modular.go +++ b/java/hiddenapi_modular.go @@ -236,12 +236,12 @@ func hiddenAPIComputeMonolithicStubLibModules(config android.Config) map[*Hidden testStubModules = append(testStubModules, "sdk_test_current_android") } else { // Use stub modules built from source - publicStubModules = append(publicStubModules, android.SdkPublic.JavaLibraryName(config)) - systemStubModules = append(systemStubModules, android.SdkSystem.JavaLibraryName(config)) - testStubModules = append(testStubModules, android.SdkTest.JavaLibraryName(config)) + publicStubModules = append(publicStubModules, android.SdkPublic.DefaultJavaLibraryName()) + systemStubModules = append(systemStubModules, android.SdkSystem.DefaultJavaLibraryName()) + testStubModules = append(testStubModules, android.SdkTest.DefaultJavaLibraryName()) } // We do not have prebuilts of the core platform api yet - corePlatformStubModules = append(corePlatformStubModules, android.JavaApiLibraryName(config, "legacy.core.platform.api.stubs")) + corePlatformStubModules = append(corePlatformStubModules, "legacy.core.platform.api.stubs") // Allow products to define their own stubs for custom product jars that apps can use. publicStubModules = append(publicStubModules, config.ProductHiddenAPIStubs()...) diff --git a/java/sdk.go b/java/sdk.go index 7fa604fdb..7699aabe0 100644 --- a/java/sdk.go +++ b/java/sdk.go @@ -151,7 +151,7 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext android.SdkContext) systemModules := android.JavaApiLibraryName(ctx.Config(), fmt.Sprintf("core-%s-stubs-system-modules", systemModulesKind)) return sdkDep{ useModule: true, - bootclasspath: []string{module, android.JavaApiLibraryName(ctx.Config(), config.DefaultLambdaStubsLibrary)}, + bootclasspath: []string{module, config.DefaultLambdaStubsLibrary}, systemModules: systemModules, java9Classpath: []string{module}, frameworkResModule: "framework-res", @@ -193,20 +193,20 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext android.SdkContext) noFrameworksLibs: true, } case android.SdkPublic, android.SdkSystem, android.SdkTest: - return toModule(sdkVersion.Kind.JavaLibraryName(ctx.Config()), sdkFrameworkAidlPath(ctx)) + return toModule(sdkVersion.Kind.DefaultJavaLibraryName(), sdkFrameworkAidlPath(ctx)) case android.SdkCore: return sdkDep{ useModule: true, - bootclasspath: []string{android.SdkCore.JavaLibraryName(ctx.Config()), android.JavaApiLibraryName(ctx.Config(), config.DefaultLambdaStubsLibrary)}, + bootclasspath: []string{android.SdkCore.DefaultJavaLibraryName(), config.DefaultLambdaStubsLibrary}, systemModules: android.JavaApiLibraryName(ctx.Config(), "core-public-stubs-system-modules"), noFrameworksLibs: true, } case android.SdkModule: // TODO(146757305): provide .apk and .aidl that have more APIs for modules - return toModule(sdkVersion.Kind.JavaLibraryName(ctx.Config()), nonUpdatableFrameworkAidlPath(ctx)) + return toModule(sdkVersion.Kind.DefaultJavaLibraryName(), nonUpdatableFrameworkAidlPath(ctx)) case android.SdkSystemServer: // TODO(146757305): provide .apk and .aidl that have more APIs for modules - return toModule(sdkVersion.Kind.JavaLibraryName(ctx.Config()), sdkFrameworkAidlPath(ctx)) + return toModule(sdkVersion.Kind.DefaultJavaLibraryName(), sdkFrameworkAidlPath(ctx)) default: panic(fmt.Errorf("invalid sdk %q", sdkVersion.Raw)) } @@ -269,9 +269,9 @@ func (sdkSingleton) GenerateBuildActions(ctx android.SingletonContext) { // Create framework.aidl by extracting anything that implements android.os.Parcelable from the SDK stubs modules. func createSdkFrameworkAidl(ctx android.SingletonContext) { stubsModules := []string{ - android.SdkPublic.JavaLibraryName(ctx.Config()), - android.SdkTest.JavaLibraryName(ctx.Config()), - android.SdkSystem.JavaLibraryName(ctx.Config()), + android.SdkPublic.DefaultJavaLibraryName(), + android.SdkTest.DefaultJavaLibraryName(), + android.SdkSystem.DefaultJavaLibraryName(), } combinedAidl := sdkFrameworkAidlPath(ctx) @@ -286,7 +286,7 @@ func createSdkFrameworkAidl(ctx android.SingletonContext) { // Creates a version of framework.aidl for the non-updatable part of the platform. func createNonUpdatableFrameworkAidl(ctx android.SingletonContext) { - stubsModules := []string{android.SdkModule.JavaLibraryName(ctx.Config())} + stubsModules := []string{android.SdkModule.DefaultJavaLibraryName()} combinedAidl := nonUpdatableFrameworkAidlPath(ctx) tempPath := tempPathForRestat(ctx, combinedAidl)