aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2022-01-27 16:39:47 +0000
committerPaul Duffin <paulduffin@google.com>2022-02-10 17:29:58 +0000
commit7a57bb106322b3caaf6395ea2dd2f81aeef35c92 (patch)
tree4ca2e88d060e8eb711eaf19030c52796c6019cc4
parent56f266d22c8f3740961ef8c5825d0c2d3419e66e (diff)
downloadsoong-7a57bb106322b3caaf6395ea2dd2f81aeef35c92.tar.gz
Only output annotations properties in snapshots for T+
Marks the `scopeProperties.AnnotationsZip` property as only being supported on T builds and above. Bug: 204763318 Test: m nothing Merged-In: Ie59396287c08da77a6a1f15d4be202429e011e17 Change-Id: Ie59396287c08da77a6a1f15d4be202429e011e17 (cherry picked from commit a54016c3ba5db8efd69d098e0bb4cb8b318d2efa)
-rw-r--r--java/sdk_library.go2
-rw-r--r--sdk/java_sdk_test.go52
2 files changed, 53 insertions, 1 deletions
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 1ae5535da..4f0b346fe 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -2562,7 +2562,7 @@ type scopeProperties struct {
StubsSrcJar android.Path
CurrentApiFile android.Path
RemovedApiFile android.Path
- AnnotationsZip android.Path
+ AnnotationsZip android.Path `supported_build_releases:"T+"`
SdkVersion string
}
diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go
index 42826b79e..db13e77ac 100644
--- a/sdk/java_sdk_test.go
+++ b/sdk/java_sdk_test.go
@@ -1253,6 +1253,58 @@ java_sdk_library_import {
)
}
+func TestSnapshotWithJavaSdkLibrary_AnnotationsZip_PreT(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ prepareForSdkTestWithJavaSdkLibrary,
+ android.FixtureMergeEnv(map[string]string{
+ "SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE": "S",
+ }),
+ ).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",
+ 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
+ `),
+ 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 {