summaryrefslogtreecommitdiff
path: root/sdk/java_sdk_test.go
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2020-06-15 14:52:58 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-06-15 14:52:58 +0000
commit623802f2f2c66abc98dd619ae4ae540e69ce98c0 (patch)
tree618317b4a13d621248e8a7d62c3be40903fd4305 /sdk/java_sdk_test.go
parent552d4730c367838538985573f82b4edc7a183b67 (diff)
parent0c5bae5e83a853f5b812f3518ddd1901cba351ec (diff)
Merge "java_sdk_library: Add system-server scope"
Diffstat (limited to 'sdk/java_sdk_test.go')
-rw-r--r--sdk/java_sdk_test.go92
1 files changed, 92 insertions, 0 deletions
diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go
index 56706c7ee..77a4e94b3 100644
--- a/sdk/java_sdk_test.go
+++ b/sdk/java_sdk_test.go
@@ -34,6 +34,8 @@ func testSdkWithJava(t *testing.T, bp string) *testSdkResult {
"api/test-removed.txt": nil,
"api/module-lib-current.txt": nil,
"api/module-lib-removed.txt": nil,
+ "api/system-server-current.txt": nil,
+ "api/system-server-removed.txt": nil,
"build/soong/scripts/gen-java-current-api-files.sh": nil,
}
@@ -61,6 +63,9 @@ java_import {
name: "android_module_lib_stubs_current",
}
java_import {
+ name: "android_system_server_stubs_current",
+}
+java_import {
name: "core-lambda-stubs",
sdk_version: "none",
}
@@ -1398,6 +1403,93 @@ sdk_snapshot {
)
}
+func TestSnapshotWithJavaSdkLibrary_SystemServer(t *testing.T) {
+ result := testSdkWithJava(t, `
+ sdk {
+ name: "mysdk",
+ java_sdk_libs: ["myjavalib"],
+ }
+
+ java_sdk_library {
+ name: "myjavalib",
+ apex_available: ["//apex_available:anyapex"],
+ srcs: ["Test.java"],
+ sdk_version: "current",
+ public: {
+ enabled: true,
+ },
+ system_server: {
+ enabled: true,
+ },
+ }
+ `)
+
+ result.CheckSnapshot("mysdk", "",
+ checkAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+java_sdk_library_import {
+ name: "mysdk_myjavalib@current",
+ sdk_member_name: "myjavalib",
+ apex_available: ["//apex_available:anyapex"],
+ shared_library: true,
+ public: {
+ jars: ["sdk_library/public/myjavalib-stubs.jar"],
+ stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
+ current_api: "sdk_library/public/myjavalib.txt",
+ removed_api: "sdk_library/public/myjavalib-removed.txt",
+ sdk_version: "current",
+ },
+ system_server: {
+ jars: ["sdk_library/system-server/myjavalib-stubs.jar"],
+ stub_srcs: ["sdk_library/system-server/myjavalib_stub_sources"],
+ current_api: "sdk_library/system-server/myjavalib.txt",
+ removed_api: "sdk_library/system-server/myjavalib-removed.txt",
+ sdk_version: "system_server_current",
+ },
+}
+
+java_sdk_library_import {
+ name: "myjavalib",
+ prefer: false,
+ apex_available: ["//apex_available:anyapex"],
+ shared_library: true,
+ public: {
+ jars: ["sdk_library/public/myjavalib-stubs.jar"],
+ stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
+ current_api: "sdk_library/public/myjavalib.txt",
+ removed_api: "sdk_library/public/myjavalib-removed.txt",
+ sdk_version: "current",
+ },
+ system_server: {
+ jars: ["sdk_library/system-server/myjavalib-stubs.jar"],
+ stub_srcs: ["sdk_library/system-server/myjavalib_stub_sources"],
+ current_api: "sdk_library/system-server/myjavalib.txt",
+ removed_api: "sdk_library/system-server/myjavalib-removed.txt",
+ sdk_version: "system_server_current",
+ },
+}
+
+sdk_snapshot {
+ name: "mysdk@current",
+ java_sdk_libs: ["mysdk_myjavalib@current"],
+}
+`),
+ checkAllCopyRules(`
+.intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.system_server/android_common/javac/myjavalib.stubs.system_server.jar -> sdk_library/system-server/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source.system_server/android_common/myjavalib.stubs.source.system_server_api.txt -> sdk_library/system-server/myjavalib.txt
+.intermediates/myjavalib.stubs.source.system_server/android_common/myjavalib.stubs.source.system_server_removed.txt -> sdk_library/system-server/myjavalib-removed.txt
+`),
+ checkMergeZips(
+ ".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip",
+ ".intermediates/mysdk/common_os/tmp/sdk_library/system-server/myjavalib_stub_sources.zip",
+ ),
+ )
+}
+
func TestSnapshotWithJavaSdkLibrary_NamingScheme(t *testing.T) {
result := testSdkWithJava(t, `
sdk {