From ea18033f31bca4250f4ff2ab9772410910f7b49b Mon Sep 17 00:00:00 2001 From: Jiakai Zhang Date: Sun, 26 Sep 2021 08:58:02 +0000 Subject: Add a new SDK member type java_systemserver_libs. Similar to java_boot_libs, java_systemserver_libs only provide access to their dex implementation jar for use by dexpreopting and do not provide an actual implementation jar. This is used in the subsequent CL. Bug: 194150908 Test: m nothing Change-Id: Ib2e7d5e6c002314a0231f46934a766f4a27e610a --- sdk/java_sdk_test.go | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) (limited to 'sdk/java_sdk_test.go') diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go index 2b537398a..0d9b4a063 100644 --- a/sdk/java_sdk_test.go +++ b/sdk/java_sdk_test.go @@ -482,6 +482,71 @@ module_exports_snapshot { ) } +func TestSnapshotWithJavaSystemserverLibrary(t *testing.T) { + result := android.GroupFixturePreparers( + prepareForSdkTestWithJava, + android.FixtureAddFile("aidl", nil), + android.FixtureAddFile("resource.txt", nil), + ).RunTestWithBp(t, ` + module_exports { + name: "myexports", + java_systemserver_libs: ["myjavalib"], + } + + java_library { + name: "myjavalib", + srcs: ["Test.java"], + java_resources: ["resource.txt"], + // The aidl files should not be copied to the snapshot because a java_systemserver_libs member + // is not intended to be used for compiling Java, only for accessing the dex implementation + // jar. + aidl: { + export_include_dirs: ["aidl"], + }, + system_modules: "none", + sdk_version: "none", + compile_dex: true, + permitted_packages: ["pkg.myjavalib"], + } + `) + + CheckSnapshot(t, result, "myexports", "", + checkUnversionedAndroidBpContents(` +// This is auto-generated. DO NOT EDIT. + +java_import { + name: "myjavalib", + prefer: false, + visibility: ["//visibility:public"], + apex_available: ["//apex_available:platform"], + jars: ["java_systemserver_libs/snapshot/jars/are/invalid/myjavalib.jar"], + permitted_packages: ["pkg.myjavalib"], +} +`), + checkVersionedAndroidBpContents(` +// This is auto-generated. DO NOT EDIT. + +java_import { + name: "myexports_myjavalib@current", + sdk_member_name: "myjavalib", + visibility: ["//visibility:public"], + apex_available: ["//apex_available:platform"], + jars: ["java_systemserver_libs/snapshot/jars/are/invalid/myjavalib.jar"], + permitted_packages: ["pkg.myjavalib"], +} + +module_exports_snapshot { + name: "myexports@current", + visibility: ["//visibility:public"], + java_systemserver_libs: ["myexports_myjavalib@current"], +} +`), + checkAllCopyRules(` +.intermediates/myexports/common_os/empty -> java_systemserver_libs/snapshot/jars/are/invalid/myjavalib.jar +`), + ) +} + func TestHostSnapshotWithJavaImplLibrary(t *testing.T) { result := android.GroupFixturePreparers( prepareForSdkTestWithJava, -- cgit v1.2.3-59-g8ed1b