Merge "Cleanup hardcoded references to android_*stubs_current"
This commit is contained in:
@@ -84,6 +84,40 @@ 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 JavaLibraryNameFromText(c, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// JavaLibraryNameFromText 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
|
||||||
|
func JavaLibraryNameFromText(c Config, name string) string {
|
||||||
|
// This returns the default for now.
|
||||||
|
// TODO: Implement this
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k SdkKind) defaultJavaLibraryName() string {
|
||||||
|
switch k {
|
||||||
|
case SdkPublic:
|
||||||
|
return "android_stubs_current"
|
||||||
|
case SdkSystem:
|
||||||
|
return "android_system_stubs_current"
|
||||||
|
case SdkTest:
|
||||||
|
return "android_test_stubs_current"
|
||||||
|
case SdkCore:
|
||||||
|
return "core.current.stubs"
|
||||||
|
case SdkModule:
|
||||||
|
return "android_module_lib_stubs_current"
|
||||||
|
case SdkSystemServer:
|
||||||
|
return "android_system_server_stubs_current"
|
||||||
|
default:
|
||||||
|
panic(fmt.Errorf("APIs of API surface %v cannot be provided by a single Soong module\n", k))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// SdkSpec represents the kind and the version of an SDK for a module to build against
|
// SdkSpec represents the kind and the version of an SDK for a module to build against
|
||||||
type SdkSpec struct {
|
type SdkSpec struct {
|
||||||
Kind SdkKind
|
Kind SdkKind
|
||||||
|
10
java/base.go
10
java/base.go
@@ -1924,15 +1924,15 @@ func (m *Module) getSdkLinkType(ctx android.BaseModuleContext, name string) (ret
|
|||||||
"stub-annotations", "private-stub-annotations-jar",
|
"stub-annotations", "private-stub-annotations-jar",
|
||||||
"core-lambda-stubs", "core-generated-annotation-stubs":
|
"core-lambda-stubs", "core-generated-annotation-stubs":
|
||||||
return javaCore, true
|
return javaCore, true
|
||||||
case "android_stubs_current":
|
case android.SdkPublic.JavaLibraryName(ctx.Config()):
|
||||||
return javaSdk, true
|
return javaSdk, true
|
||||||
case "android_system_stubs_current":
|
case android.SdkSystem.JavaLibraryName(ctx.Config()):
|
||||||
return javaSystem, true
|
return javaSystem, true
|
||||||
case "android_module_lib_stubs_current":
|
case android.SdkModule.JavaLibraryName(ctx.Config()):
|
||||||
return javaModule, true
|
return javaModule, true
|
||||||
case "android_system_server_stubs_current":
|
case android.SdkSystemServer.JavaLibraryName(ctx.Config()):
|
||||||
return javaSystemServer, true
|
return javaSystemServer, true
|
||||||
case "android_test_stubs_current":
|
case android.SdkTest.JavaLibraryName(ctx.Config()):
|
||||||
return javaSystem, true
|
return javaSystem, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -236,9 +236,9 @@ 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_stubs_current")
|
publicStubModules = append(publicStubModules, android.SdkPublic.JavaLibraryName(config))
|
||||||
systemStubModules = append(systemStubModules, "android_system_stubs_current")
|
systemStubModules = append(systemStubModules, android.SdkSystem.JavaLibraryName(config))
|
||||||
testStubModules = append(testStubModules, "android_test_stubs_current")
|
testStubModules = append(testStubModules, android.SdkTest.JavaLibraryName(config))
|
||||||
}
|
}
|
||||||
// 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, "legacy.core.platform.api.stubs")
|
corePlatformStubModules = append(corePlatformStubModules, "legacy.core.platform.api.stubs")
|
||||||
|
20
java/sdk.go
20
java/sdk.go
@@ -191,12 +191,8 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext android.SdkContext)
|
|||||||
bootclasspath: corePlatformBootclasspathLibraries(ctx),
|
bootclasspath: corePlatformBootclasspathLibraries(ctx),
|
||||||
noFrameworksLibs: true,
|
noFrameworksLibs: true,
|
||||||
}
|
}
|
||||||
case android.SdkPublic:
|
case android.SdkPublic, android.SdkSystem, android.SdkTest:
|
||||||
return toModule("android_stubs_current", sdkFrameworkAidlPath(ctx))
|
return toModule(sdkVersion.Kind.JavaLibraryName(ctx.Config()), 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.SdkCore:
|
case android.SdkCore:
|
||||||
return sdkDep{
|
return sdkDep{
|
||||||
useModule: true,
|
useModule: true,
|
||||||
@@ -206,10 +202,10 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext android.SdkContext)
|
|||||||
}
|
}
|
||||||
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("android_module_lib_stubs_current", nonUpdatableFrameworkAidlPath(ctx))
|
return toModule(sdkVersion.Kind.JavaLibraryName(ctx.Config()), 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("android_system_server_stubs_current", sdkFrameworkAidlPath(ctx))
|
return toModule(sdkVersion.Kind.JavaLibraryName(ctx.Config()), sdkFrameworkAidlPath(ctx))
|
||||||
default:
|
default:
|
||||||
panic(fmt.Errorf("invalid sdk %q", sdkVersion.Raw))
|
panic(fmt.Errorf("invalid sdk %q", sdkVersion.Raw))
|
||||||
}
|
}
|
||||||
@@ -272,9 +268,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_stubs_current",
|
android.SdkPublic.JavaLibraryName(ctx.Config()),
|
||||||
"android_test_stubs_current",
|
android.SdkTest.JavaLibraryName(ctx.Config()),
|
||||||
"android_system_stubs_current",
|
android.SdkSystem.JavaLibraryName(ctx.Config()),
|
||||||
}
|
}
|
||||||
|
|
||||||
combinedAidl := sdkFrameworkAidlPath(ctx)
|
combinedAidl := sdkFrameworkAidlPath(ctx)
|
||||||
@@ -289,7 +285,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_module_lib_stubs_current"}
|
stubsModules := []string{android.SdkModule.JavaLibraryName(ctx.Config())}
|
||||||
|
|
||||||
combinedAidl := nonUpdatableFrameworkAidlPath(ctx)
|
combinedAidl := nonUpdatableFrameworkAidlPath(ctx)
|
||||||
tempPath := tempPathForRestat(ctx, combinedAidl)
|
tempPath := tempPathForRestat(ctx, combinedAidl)
|
||||||
|
Reference in New Issue
Block a user