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
This commit is contained in:
Jihoon Kang 2023-05-30 19:12:28 +00:00
parent 67b6443258
commit 91c839566e
4 changed files with 28 additions and 35 deletions

View file

@ -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 // JavaApiLibraryName returns the name of .txt equivalent of a java_library, but does
// not check if either module exists. // not check if either module exists.
// TODO: Return .txt (single-tree or multi-tree equivalents) based on config // 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. // Export the name of the soong modules representing the various Java API surfaces.
func javaSdkMakeVars(ctx MakeVarsContext) { func javaSdkMakeVars(ctx MakeVarsContext) {
ctx.Strict("ANDROID_PUBLIC_STUBS", SdkPublic.JavaLibraryName(ctx.Config())) ctx.Strict("ANDROID_PUBLIC_STUBS", SdkPublic.DefaultJavaLibraryName())
ctx.Strict("ANDROID_SYSTEM_STUBS", SdkSystem.JavaLibraryName(ctx.Config())) ctx.Strict("ANDROID_SYSTEM_STUBS", SdkSystem.DefaultJavaLibraryName())
ctx.Strict("ANDROID_TEST_STUBS", SdkTest.JavaLibraryName(ctx.Config())) ctx.Strict("ANDROID_TEST_STUBS", SdkTest.DefaultJavaLibraryName())
ctx.Strict("ANDROID_MODULE_LIB_STUBS", SdkModule.JavaLibraryName(ctx.Config())) ctx.Strict("ANDROID_MODULE_LIB_STUBS", SdkModule.DefaultJavaLibraryName())
ctx.Strict("ANDROID_SYSTEM_SERVER_STUBS", SdkSystemServer.JavaLibraryName(ctx.Config())) ctx.Strict("ANDROID_SYSTEM_SERVER_STUBS", SdkSystemServer.DefaultJavaLibraryName())
// TODO (jihoonkang): Create a .txt equivalent for core.current.stubs ctx.Strict("ANDROID_CORE_STUBS", SdkCore.DefaultJavaLibraryName())
ctx.Strict("ANDROID_CORE_STUBS", SdkCore.JavaLibraryName(ctx.Config()))
} }

View file

@ -1928,22 +1928,22 @@ type moduleWithSdkDep interface {
func (m *Module) getSdkLinkType(ctx android.BaseModuleContext, name string) (ret sdkLinkType, stubs bool) { func (m *Module) getSdkLinkType(ctx android.BaseModuleContext, name string) (ret sdkLinkType, stubs bool) {
switch name { switch name {
case android.SdkCore.JavaLibraryName(ctx.Config()), case android.SdkCore.DefaultJavaLibraryName(),
android.JavaApiLibraryName(ctx.Config(), "legacy.core.platform.api.stubs"), "legacy.core.platform.api.stubs",
android.JavaApiLibraryName(ctx.Config(), "stable.core.platform.api.stubs"), "stable.core.platform.api.stubs",
"stub-annotations", "private-stub-annotations-jar", "stub-annotations", "private-stub-annotations-jar",
android.JavaApiLibraryName(ctx.Config(), "core-lambda-stubs"), "core-lambda-stubs",
"core-generated-annotation-stubs": "core-generated-annotation-stubs":
return javaCore, true return javaCore, true
case android.SdkPublic.JavaLibraryName(ctx.Config()): case android.SdkPublic.DefaultJavaLibraryName():
return javaSdk, true return javaSdk, true
case android.SdkSystem.JavaLibraryName(ctx.Config()): case android.SdkSystem.DefaultJavaLibraryName():
return javaSystem, true return javaSystem, true
case android.SdkModule.JavaLibraryName(ctx.Config()): case android.SdkModule.DefaultJavaLibraryName():
return javaModule, true return javaModule, true
case android.SdkSystemServer.JavaLibraryName(ctx.Config()): case android.SdkSystemServer.DefaultJavaLibraryName():
return javaSystemServer, true return javaSystemServer, true
case android.SdkTest.JavaLibraryName(ctx.Config()): case android.SdkTest.DefaultJavaLibraryName():
return javaSystem, true return javaSystem, true
} }

View file

@ -236,12 +236,12 @@ func hiddenAPIComputeMonolithicStubLibModules(config android.Config) map[*Hidden
testStubModules = append(testStubModules, "sdk_test_current_android") testStubModules = append(testStubModules, "sdk_test_current_android")
} else { } else {
// Use stub modules built from source // Use stub modules built from source
publicStubModules = append(publicStubModules, android.SdkPublic.JavaLibraryName(config)) publicStubModules = append(publicStubModules, android.SdkPublic.DefaultJavaLibraryName())
systemStubModules = append(systemStubModules, android.SdkSystem.JavaLibraryName(config)) systemStubModules = append(systemStubModules, android.SdkSystem.DefaultJavaLibraryName())
testStubModules = append(testStubModules, android.SdkTest.JavaLibraryName(config)) testStubModules = append(testStubModules, android.SdkTest.DefaultJavaLibraryName())
} }
// We do not have prebuilts of the core platform api yet // 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. // Allow products to define their own stubs for custom product jars that apps can use.
publicStubModules = append(publicStubModules, config.ProductHiddenAPIStubs()...) publicStubModules = append(publicStubModules, config.ProductHiddenAPIStubs()...)

View file

@ -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)) systemModules := android.JavaApiLibraryName(ctx.Config(), fmt.Sprintf("core-%s-stubs-system-modules", systemModulesKind))
return sdkDep{ return sdkDep{
useModule: true, useModule: true,
bootclasspath: []string{module, android.JavaApiLibraryName(ctx.Config(), config.DefaultLambdaStubsLibrary)}, bootclasspath: []string{module, config.DefaultLambdaStubsLibrary},
systemModules: systemModules, systemModules: systemModules,
java9Classpath: []string{module}, java9Classpath: []string{module},
frameworkResModule: "framework-res", frameworkResModule: "framework-res",
@ -193,20 +193,20 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext android.SdkContext)
noFrameworksLibs: true, noFrameworksLibs: true,
} }
case android.SdkPublic, android.SdkSystem, android.SdkTest: 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: case android.SdkCore:
return sdkDep{ return sdkDep{
useModule: true, 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"), systemModules: android.JavaApiLibraryName(ctx.Config(), "core-public-stubs-system-modules"),
noFrameworksLibs: true, noFrameworksLibs: true,
} }
case android.SdkModule: case android.SdkModule:
// TODO(146757305): provide .apk and .aidl that have more APIs for modules // 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: case android.SdkSystemServer:
// TODO(146757305): provide .apk and .aidl that have more APIs for modules // 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: default:
panic(fmt.Errorf("invalid sdk %q", sdkVersion.Raw)) 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. // Create framework.aidl by extracting anything that implements android.os.Parcelable from the SDK stubs modules.
func createSdkFrameworkAidl(ctx android.SingletonContext) { func createSdkFrameworkAidl(ctx android.SingletonContext) {
stubsModules := []string{ stubsModules := []string{
android.SdkPublic.JavaLibraryName(ctx.Config()), android.SdkPublic.DefaultJavaLibraryName(),
android.SdkTest.JavaLibraryName(ctx.Config()), android.SdkTest.DefaultJavaLibraryName(),
android.SdkSystem.JavaLibraryName(ctx.Config()), android.SdkSystem.DefaultJavaLibraryName(),
} }
combinedAidl := sdkFrameworkAidlPath(ctx) 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. // Creates a version of framework.aidl for the non-updatable part of the platform.
func createNonUpdatableFrameworkAidl(ctx android.SingletonContext) { func createNonUpdatableFrameworkAidl(ctx android.SingletonContext) {
stubsModules := []string{android.SdkModule.JavaLibraryName(ctx.Config())} stubsModules := []string{android.SdkModule.DefaultJavaLibraryName()}
combinedAidl := nonUpdatableFrameworkAidlPath(ctx) combinedAidl := nonUpdatableFrameworkAidlPath(ctx)
tempPath := tempPathForRestat(ctx, combinedAidl) tempPath := tempPathForRestat(ctx, combinedAidl)