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. 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
This commit is contained in:
@@ -22,13 +22,16 @@ import (
|
||||
"android/soong/java"
|
||||
)
|
||||
|
||||
func TestSnapshotWithSystemServerClasspathFragment(t *testing.T) {
|
||||
func testSnapshotWithSystemServerClasspathFragment(t *testing.T, targetBuildRelease string, expectedSdkSnapshot 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,34 @@ func TestSnapshotWithSystemServerClasspathFragment(t *testing.T) {
|
||||
).RunTest(t)
|
||||
|
||||
CheckSnapshot(t, result, "mysdk", "",
|
||||
checkAndroidBpContents(`
|
||||
checkAndroidBpContents(expectedSdkSnapshot),
|
||||
)
|
||||
}
|
||||
|
||||
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",
|
||||
},
|
||||
}
|
||||
`)
|
||||
})
|
||||
|
||||
t.Run("target-t", func(t *testing.T) {
|
||||
testSnapshotWithSystemServerClasspathFragment(t, "Tiramisu", `
|
||||
// This is auto-generated. DO NOT EDIT.
|
||||
|
||||
java_sdk_library_import {
|
||||
@@ -120,6 +150,6 @@ prebuilt_systemserverclasspath_fragment {
|
||||
"mysdklibrary",
|
||||
],
|
||||
}
|
||||
`),
|
||||
)
|
||||
`)
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user