summaryrefslogtreecommitdiff
path: root/sdk/systemserverclasspath_fragment_sdk_test.go
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2022-07-01 15:56:06 +0000
committerPaul Duffin <paulduffin@google.com>2022-07-05 14:48:09 +0000
commitb0c28d63d608572cc55cf2ec5edd9fc3ef257ec0 (patch)
treef587dd20697338fff1f76b7dcb90d4d282bcbdeb /sdk/systemserverclasspath_fragment_sdk_test.go
parent4f7e82f1cea429076ca369d15c108fd7dbc172ab (diff)
Stop exporting systemserverclasspath_fragment when targeting S
Previously, when targeting the S release the generated sdk snapshot would contain prebuilt_systemserverclasspath_fragment modules even though they were only added in T. This allows SdkMemberTypes to specify the set of target build releases they support and ignores them when targeting an unsupported target build release. The Merged-In value was chosen to prevent this from being merged into branches where it will conflict due to https://r.android.com/2105804. That will allow this change to be submitted in tm-dev before it is submitted in AOSP. Test: m nothing packages/modules/common/build/mainline_modules_sdks.sh # Check that the for-S-build snapshots do not include SSCPFs. Bug: 237718221 Change-Id: I2df08c2fcebf9b866695d691572a9d3783758b17 Merged-In: Ib6d1b72bc8399fbb39075494ae37da92f4b28d03
Diffstat (limited to 'sdk/systemserverclasspath_fragment_sdk_test.go')
-rw-r--r--sdk/systemserverclasspath_fragment_sdk_test.go65
1 files changed, 59 insertions, 6 deletions
diff --git a/sdk/systemserverclasspath_fragment_sdk_test.go b/sdk/systemserverclasspath_fragment_sdk_test.go
index 16e3e7fa9..819083d23 100644
--- a/sdk/systemserverclasspath_fragment_sdk_test.go
+++ b/sdk/systemserverclasspath_fragment_sdk_test.go
@@ -22,13 +22,16 @@ import (
"android/soong/java"
)
-func TestSnapshotWithSystemServerClasspathFragment(t *testing.T) {
+func testSnapshotWithSystemServerClasspathFragment(t *testing.T, targetBuildRelease string, expectedUnversionedSdkSnapshot string, expectedVersionedSdkSnapshot string) {
result := android.GroupFixturePreparers(
prepareForSdkTestWithJava,
java.PrepareForTestWithJavaDefaultModules,
java.PrepareForTestWithJavaSdkLibraryFiles,
java.FixtureWithLastReleaseApis("mysdklibrary"),
dexpreopt.FixtureSetApexSystemServerJars("myapex:mylib", "myapex:mysdklibrary"),
+ android.FixtureModifyEnv(func(env map[string]string) {
+ env["SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE"] = targetBuildRelease
+ }),
prepareForSdkTestWithApex,
android.FixtureWithRootAndroidBp(`
@@ -83,7 +86,58 @@ func TestSnapshotWithSystemServerClasspathFragment(t *testing.T) {
).RunTest(t)
CheckSnapshot(t, result, "mysdk", "",
- checkUnversionedAndroidBpContents(`
+ checkUnversionedAndroidBpContents(expectedUnversionedSdkSnapshot),
+ checkVersionedAndroidBpContents(expectedVersionedSdkSnapshot),
+ )
+}
+
+func TestSnapshotWithSystemServerClasspathFragment(t *testing.T) {
+ t.Run("target-s", func(t *testing.T) {
+ testSnapshotWithSystemServerClasspathFragment(t, "S", `
+// This is auto-generated. DO NOT EDIT.
+
+java_sdk_library_import {
+ name: "mysdklibrary",
+ prefer: false,
+ visibility: ["//visibility:public"],
+ apex_available: ["myapex"],
+ shared_library: false,
+ public: {
+ jars: ["sdk_library/public/mysdklibrary-stubs.jar"],
+ stub_srcs: ["sdk_library/public/mysdklibrary_stub_sources"],
+ current_api: "sdk_library/public/mysdklibrary.txt",
+ removed_api: "sdk_library/public/mysdklibrary-removed.txt",
+ sdk_version: "current",
+ },
+}
+`, `
+// This is auto-generated. DO NOT EDIT.
+
+java_sdk_library_import {
+ name: "mysdk_mysdklibrary@current",
+ sdk_member_name: "mysdklibrary",
+ visibility: ["//visibility:public"],
+ apex_available: ["myapex"],
+ shared_library: false,
+ public: {
+ jars: ["sdk_library/public/mysdklibrary-stubs.jar"],
+ stub_srcs: ["sdk_library/public/mysdklibrary_stub_sources"],
+ current_api: "sdk_library/public/mysdklibrary.txt",
+ removed_api: "sdk_library/public/mysdklibrary-removed.txt",
+ sdk_version: "current",
+ },
+}
+
+sdk_snapshot {
+ name: "mysdk@current",
+ visibility: ["//visibility:public"],
+ java_sdk_libs: ["mysdk_mysdklibrary@current"],
+}
+`)
+ })
+
+ t.Run("target-t", func(t *testing.T) {
+ testSnapshotWithSystemServerClasspathFragment(t, "Tiramisu", `
// This is auto-generated. DO NOT EDIT.
java_sdk_library_import {
@@ -120,8 +174,7 @@ prebuilt_systemserverclasspath_fragment {
"mysdklibrary",
],
}
-`),
- checkVersionedAndroidBpContents(`
+`, `
// This is auto-generated. DO NOT EDIT.
java_sdk_library_import {
@@ -166,6 +219,6 @@ sdk_snapshot {
java_systemserver_libs: ["mysdk_mylib@current"],
systemserverclasspath_fragments: ["mysdk_mysystemserverclasspathfragment@current"],
}
-`),
- )
+`)
+ })
}