Split the core/platform API into stable and legacy versions.

For now, everything outside libcore still uses the legacy version.

Test: treehugger
Bug: 157640067
Change-Id: If5234e9ee533ff537926801a0af045d36b1caf01
This commit is contained in:
Pete Gillin 2020-06-02 15:59:45 +01:00
parent 8a624337b3
commit 1f41dbff64
6 changed files with 22 additions and 19 deletions

View file

@ -28,8 +28,9 @@ import (
var ( var (
pctx = android.NewPackageContext("android/soong/java/config") pctx = android.NewPackageContext("android/soong/java/config")
DefaultBootclasspathLibraries = []string{"core.platform.api.stubs", "core-lambda-stubs"} // TODO(b/157640067): Don't depend on the legacy API by default in the long term.
DefaultSystemModules = "core-platform-api-stubs-system-modules" DefaultBootclasspathLibraries = []string{"legacy.core.platform.api.stubs", "core-lambda-stubs"}
DefaultSystemModules = "legacy-core-platform-api-stubs-system-modules"
DefaultLibraries = []string{"ext", "framework"} DefaultLibraries = []string{"ext", "framework"}
DefaultLambdaStubsLibrary = "core-lambda-stubs" DefaultLambdaStubsLibrary = "core-lambda-stubs"
SdkLambdaStubsPath = "prebuilts/sdk/tools/core-lambda-stubs.jar" SdkLambdaStubsPath = "prebuilts/sdk/tools/core-lambda-stubs.jar"

View file

@ -116,7 +116,7 @@ func stubFlagsRule(ctx android.SingletonContext) {
// Core Platform API stubs // Core Platform API stubs
corePlatformStubModules := []string{ corePlatformStubModules := []string{
"core.platform.api.stubs", "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.

View file

@ -837,8 +837,9 @@ type linkTypeContext interface {
func (m *Module) getLinkType(name string) (ret linkType, stubs bool) { func (m *Module) getLinkType(name string) (ret linkType, stubs bool) {
switch name { switch name {
case "core.current.stubs", "core.platform.api.stubs", "stub-annotations", case "core.current.stubs", "legacy.core.platform.api.stubs", "stable.core.platform.api.stubs",
"private-stub-annotations-jar", "core-lambda-stubs", "core-generated-annotation-stubs": "stub-annotations", "private-stub-annotations-jar",
"core-lambda-stubs", "core-generated-annotation-stubs":
return javaCore, true return javaCore, true
case "android_stubs_current": case "android_stubs_current":
return javaSdk, true return javaSdk, true

View file

@ -156,9 +156,9 @@ func TestClasspath(t *testing.T) {
{ {
name: "nostdlib system_modules", name: "nostdlib system_modules",
properties: `sdk_version: "none", system_modules: "core-platform-api-stubs-system-modules"`, properties: `sdk_version: "none", system_modules: "legacy-core-platform-api-stubs-system-modules"`,
system: "core-platform-api-stubs-system-modules", system: "legacy-core-platform-api-stubs-system-modules",
bootclasspath: []string{"core-platform-api-stubs-system-modules-lib"}, bootclasspath: []string{"legacy-core-platform-api-stubs-system-modules-lib"},
java8classpath: []string{}, java8classpath: []string{},
}, },
{ {

View file

@ -173,7 +173,8 @@ func GatherRequiredDepsForTest() string {
"android_module_lib_stubs_current", "android_module_lib_stubs_current",
"android_system_server_stubs_current", "android_system_server_stubs_current",
"core.current.stubs", "core.current.stubs",
"core.platform.api.stubs", "legacy.core.platform.api.stubs",
"stable.core.platform.api.stubs",
"kotlin-stdlib", "kotlin-stdlib",
"kotlin-stdlib-jdk7", "kotlin-stdlib-jdk7",
"kotlin-stdlib-jdk8", "kotlin-stdlib-jdk8",
@ -186,7 +187,7 @@ func GatherRequiredDepsForTest() string {
name: "%s", name: "%s",
srcs: ["a.java"], srcs: ["a.java"],
sdk_version: "none", sdk_version: "none",
system_modules: "core-platform-api-stubs-system-modules", system_modules: "legacy-core-platform-api-stubs-system-modules",
} }
`, extra) `, extra)
} }
@ -196,7 +197,7 @@ func GatherRequiredDepsForTest() string {
name: "framework", name: "framework",
srcs: ["a.java"], srcs: ["a.java"],
sdk_version: "none", sdk_version: "none",
system_modules: "core-platform-api-stubs-system-modules", system_modules: "legacy-core-platform-api-stubs-system-modules",
aidl: { aidl: {
export_include_dirs: ["framework/aidl"], export_include_dirs: ["framework/aidl"],
}, },
@ -211,7 +212,7 @@ func GatherRequiredDepsForTest() string {
name: "android.hidl.base-V1.0-java", name: "android.hidl.base-V1.0-java",
srcs: ["a.java"], srcs: ["a.java"],
sdk_version: "none", sdk_version: "none",
system_modules: "core-platform-api-stubs-system-modules", system_modules: "legacy-core-platform-api-stubs-system-modules",
installable: true, installable: true,
} }
@ -219,7 +220,7 @@ func GatherRequiredDepsForTest() string {
name: "android.hidl.manager-V1.0-java", name: "android.hidl.manager-V1.0-java",
srcs: ["a.java"], srcs: ["a.java"],
sdk_version: "none", sdk_version: "none",
system_modules: "core-platform-api-stubs-system-modules", system_modules: "legacy-core-platform-api-stubs-system-modules",
installable: true, installable: true,
} }
@ -227,7 +228,7 @@ func GatherRequiredDepsForTest() string {
name: "org.apache.http.legacy", name: "org.apache.http.legacy",
srcs: ["a.java"], srcs: ["a.java"],
sdk_version: "none", sdk_version: "none",
system_modules: "core-platform-api-stubs-system-modules", system_modules: "legacy-core-platform-api-stubs-system-modules",
installable: true, installable: true,
} }
@ -235,7 +236,7 @@ func GatherRequiredDepsForTest() string {
name: "android.test.base", name: "android.test.base",
srcs: ["a.java"], srcs: ["a.java"],
sdk_version: "none", sdk_version: "none",
system_modules: "core-platform-api-stubs-system-modules", system_modules: "legacy-core-platform-api-stubs-system-modules",
installable: true, installable: true,
} }
@ -243,14 +244,14 @@ func GatherRequiredDepsForTest() string {
name: "android.test.mock", name: "android.test.mock",
srcs: ["a.java"], srcs: ["a.java"],
sdk_version: "none", sdk_version: "none",
system_modules: "core-platform-api-stubs-system-modules", system_modules: "legacy-core-platform-api-stubs-system-modules",
installable: true, installable: true,
} }
` `
systemModules := []string{ systemModules := []string{
"core-current-stubs-system-modules", "core-current-stubs-system-modules",
"core-platform-api-stubs-system-modules", "legacy-core-platform-api-stubs-system-modules",
} }
for _, extra := range systemModules { for _, extra := range systemModules {

View file

@ -43,10 +43,10 @@ java_system_modules_import {
name: "core-current-stubs-system-modules", name: "core-current-stubs-system-modules",
} }
java_system_modules_import { java_system_modules_import {
name: "core-platform-api-stubs-system-modules", name: "legacy-core-platform-api-stubs-system-modules",
} }
java_import { java_import {
name: "core.platform.api.stubs", name: "legacy.core.platform.api.stubs",
} }
java_import { java_import {
name: "android_stubs_current", name: "android_stubs_current",