summaryrefslogtreecommitdiff
path: root/sdk/java_sdk_test.go
diff options
context:
space:
mode:
author Anton Hansson <hansson@google.com> 2021-09-21 15:25:12 +0100
committer Anton Hansson <hansson@google.com> 2021-10-15 15:39:31 +0100
commit3adf3c52eb569b2203160e5503a3ddfa68f7a4ac (patch)
tree79f5e0981a5bd8da8d7396b070db8b0dec77c637 /sdk/java_sdk_test.go
parentd446d282edaefd8bd5b179d581463f7d15cca84c (diff)
Add annotations.zip support to java_sdk_library
The annotations zip file is produced by the "main" sdk build and is primarily consumed by android studio. In order to support building the main SDK without requiring the sources of all modules, we are adding module SDK artifacts that allows reconstructing these outputs. The annotations zip contains XML files which should be fairly easy to merge from all the individual parts. Bug: 187397779 Test: unit tests in this CL Test: m sdkextensions-sdk and inspect output Merged-In: I955cae720e6f1382936836ee1d8fb11003f51b7d Change-Id: I955cae720e6f1382936836ee1d8fb11003f51b7d
Diffstat (limited to 'sdk/java_sdk_test.go')
-rw-r--r--sdk/java_sdk_test.go49
1 files changed, 49 insertions, 0 deletions
diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go
index 813dcfd6d..42826b79e 100644
--- a/sdk/java_sdk_test.go
+++ b/sdk/java_sdk_test.go
@@ -1204,6 +1204,55 @@ java_sdk_library_import {
)
}
+func TestSnapshotWithJavaSdkLibrary_AnnotationsZip(t *testing.T) {
+ result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
+ sdk {
+ name: "mysdk",
+ java_sdk_libs: ["myjavalib"],
+ }
+
+ java_sdk_library {
+ name: "myjavalib",
+ srcs: ["Test.java"],
+ sdk_version: "current",
+ shared_library: false,
+ annotations_enabled: true,
+ public: {
+ enabled: true,
+ },
+ }
+ `)
+
+ CheckSnapshot(t, result, "mysdk", "",
+ checkUnversionedAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+java_sdk_library_import {
+ name: "myjavalib",
+ prefer: false,
+ visibility: ["//visibility:public"],
+ apex_available: ["//apex_available:platform"],
+ shared_library: false,
+ 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",
+ annotations: "sdk_library/public/myjavalib_annotations.zip",
+ sdk_version: "current",
+ },
+}
+ `),
+ checkAllCopyRules(`
+.intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+.intermediates/myjavalib.stubs.source/android_common/metalava/myjavalib.stubs.source_annotations.zip -> sdk_library/public/myjavalib_annotations.zip
+ `),
+ checkMergeZips(".intermediates/mysdk/common_os/tmp/sdk_library/public/myjavalib_stub_sources.zip"),
+ )
+}
+
func TestSnapshotWithJavaSdkLibrary_CompileDex(t *testing.T) {
result := android.GroupFixturePreparers(prepareForSdkTestWithJavaSdkLibrary).RunTestWithBp(t, `
sdk {