From 2d457e1cc8d0a364603b8e2f68334fc83bb00b15 Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Tue, 29 Jun 2021 22:05:58 +0100 Subject: [PATCH] "module_current" and "system_server_current" should contain ART's @SystemApi(MODULE_LIBRARIES) Before this fix, compiling a java_library against sdk_version: "module_current" can't use the @SystemApi(MODULE_LIBRARIES) provided by the ART module because the system module "core-current-stubs-system-modules" contains only the public APIs. Use the new system module with module lib APIs. (cherry picked from commit b54f5aa3599196cfed8c32d3e52e1c35b51b8473) Bug: 183097033 Test: m droid Merged-In: I274e2710d1ff34e896aa620bfafb4481180c53b5 Change-Id: I374bc4899ef8f60344e37a94ad3cb8492f47fb4d --- java/sdk.go | 18 ++++++++++++++++-- java/sdk_test.go | 4 ++-- java/testing.go | 1 + 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/java/sdk.go b/java/sdk.go index cbd873d33..d1b899e48 100644 --- a/java/sdk.go +++ b/java/sdk.go @@ -175,10 +175,24 @@ func decodeSdkDep(ctx android.EarlyModuleContext, sdkContext android.SdkContext) } case android.SdkModule: // TODO(146757305): provide .apk and .aidl that have more APIs for modules - return toModule([]string{"android_module_lib_stubs_current"}, "framework-res", nonUpdatableFrameworkAidlPath(ctx)) + return sdkDep{ + useModule: true, + bootclasspath: []string{"android_module_lib_stubs_current", config.DefaultLambdaStubsLibrary}, + systemModules: "core-module-lib-stubs-system-modules", + java9Classpath: []string{"android_module_lib_stubs_current"}, + frameworkResModule: "framework-res", + aidl: android.OptionalPathForPath(nonUpdatableFrameworkAidlPath(ctx)), + } case android.SdkSystemServer: // TODO(146757305): provide .apk and .aidl that have more APIs for modules - return toModule([]string{"android_system_server_stubs_current"}, "framework-res", sdkFrameworkAidlPath(ctx)) + return sdkDep{ + useModule: true, + bootclasspath: []string{"android_system_server_stubs_current", config.DefaultLambdaStubsLibrary}, + systemModules: "core-module-lib-stubs-system-modules", + java9Classpath: []string{"android_system_server_stubs_current"}, + frameworkResModule: "framework-res", + aidl: android.OptionalPathForPath(sdkFrameworkAidlPath(ctx)), + } default: panic(fmt.Errorf("invalid sdk %q", sdkVersion.Raw)) } diff --git a/java/sdk_test.go b/java/sdk_test.go index 2b1846592..bb595a54e 100644 --- a/java/sdk_test.go +++ b/java/sdk_test.go @@ -219,7 +219,7 @@ func TestClasspath(t *testing.T) { name: "module_current", properties: `sdk_version: "module_current",`, bootclasspath: []string{"android_module_lib_stubs_current", "core-lambda-stubs"}, - system: "core-current-stubs-system-modules", + system: "core-module-lib-stubs-system-modules", java9classpath: []string{"android_module_lib_stubs_current"}, aidl: "-pout/soong/framework_non_updatable.aidl", }, @@ -227,7 +227,7 @@ func TestClasspath(t *testing.T) { name: "system_server_current", properties: `sdk_version: "system_server_current",`, bootclasspath: []string{"android_system_server_stubs_current", "core-lambda-stubs"}, - system: "core-current-stubs-system-modules", + system: "core-module-lib-stubs-system-modules", java9classpath: []string{"android_system_server_stubs_current"}, aidl: "-pout/soong/framework.aidl", }, diff --git a/java/testing.go b/java/testing.go index 7b452f762..3ef51bd4d 100644 --- a/java/testing.go +++ b/java/testing.go @@ -312,6 +312,7 @@ func gatherRequiredDepsForTest() string { systemModules := []string{ "core-current-stubs-system-modules", + "core-module-lib-stubs-system-modules", "legacy-core-platform-api-stubs-system-modules", "stable-core-platform-api-stubs-system-modules", }