summaryrefslogtreecommitdiff
path: root/sdk/systemserverclasspath_fragment_sdk_test.go
diff options
context:
space:
mode:
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"],
}
-`),
- )
+`)
+ })
}