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
This commit is contained in:
Jiakai Zhang
2021-09-26 08:58:02 +00:00
parent 774dd305f4
commit ea18033f31
2 changed files with 97 additions and 0 deletions

View File

@@ -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,