partial systemserverclasspath snapshot test
Add a test for that checks the SDK snapshot contains sdk library definitions for modules with alowed minSdkVersion, but that doesn't contain definitions for modules with disallowed minSdkVersions. Bug: 289183551 Test: go test ./sdk Change-Id: I194526f8eba4dacb52a345fa67cf7371e722c237
This commit is contained in:
parent
8d7f2e41d1
commit
ff19da2435
1 changed files with 92 additions and 0 deletions
|
@ -86,6 +86,98 @@ func testSnapshotWithSystemServerClasspathFragment(t *testing.T, sdk string, tar
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSnapshotWithPartialSystemServerClasspathFragment(t *testing.T) {
|
||||||
|
commonSdk := `
|
||||||
|
apex {
|
||||||
|
name: "myapex",
|
||||||
|
key: "myapex.key",
|
||||||
|
min_sdk_version: "Tiramisu",
|
||||||
|
systemserverclasspath_fragments: ["mysystemserverclasspathfragment"],
|
||||||
|
}
|
||||||
|
systemserverclasspath_fragment {
|
||||||
|
name: "mysystemserverclasspathfragment",
|
||||||
|
apex_available: ["myapex"],
|
||||||
|
contents: [
|
||||||
|
"mysdklibrary",
|
||||||
|
"mysdklibrary-future",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
java_sdk_library {
|
||||||
|
name: "mysdklibrary",
|
||||||
|
apex_available: ["myapex"],
|
||||||
|
srcs: ["Test.java"],
|
||||||
|
min_sdk_version: "33", // Tiramisu
|
||||||
|
}
|
||||||
|
java_sdk_library {
|
||||||
|
name: "mysdklibrary-future",
|
||||||
|
apex_available: ["myapex"],
|
||||||
|
srcs: ["Test.java"],
|
||||||
|
min_sdk_version: "34", // UpsideDownCake
|
||||||
|
}
|
||||||
|
sdk {
|
||||||
|
name: "mysdk",
|
||||||
|
apexes: ["myapex"],
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForSdkTestWithJava,
|
||||||
|
java.PrepareForTestWithJavaDefaultModules,
|
||||||
|
java.PrepareForTestWithJavaSdkLibraryFiles,
|
||||||
|
java.FixtureWithLastReleaseApis("mysdklibrary", "mysdklibrary-future"),
|
||||||
|
dexpreopt.FixtureSetApexSystemServerJars("myapex:mysdklibrary", "myapex:mysdklibrary-future"),
|
||||||
|
android.FixtureModifyEnv(func(env map[string]string) {
|
||||||
|
// targeting Tiramisu here means that we won't export mysdklibrary-future
|
||||||
|
env["SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE"] = "Tiramisu"
|
||||||
|
}),
|
||||||
|
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
|
||||||
|
variables.Platform_version_active_codenames = []string{"UpsideDownCake"}
|
||||||
|
}),
|
||||||
|
prepareForSdkTestWithApex,
|
||||||
|
android.FixtureWithRootAndroidBp(commonSdk),
|
||||||
|
).RunTest(t)
|
||||||
|
|
||||||
|
CheckSnapshot(t, result, "mysdk", "", checkAndroidBpContents(
|
||||||
|
`// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
|
java_sdk_library_import {
|
||||||
|
name: "mysdklibrary",
|
||||||
|
prefer: false,
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
|
apex_available: ["myapex"],
|
||||||
|
shared_library: true,
|
||||||
|
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",
|
||||||
|
},
|
||||||
|
system: {
|
||||||
|
jars: ["sdk_library/system/mysdklibrary-stubs.jar"],
|
||||||
|
stub_srcs: ["sdk_library/system/mysdklibrary_stub_sources"],
|
||||||
|
current_api: "sdk_library/system/mysdklibrary.txt",
|
||||||
|
removed_api: "sdk_library/system/mysdklibrary-removed.txt",
|
||||||
|
sdk_version: "system_current",
|
||||||
|
},
|
||||||
|
test: {
|
||||||
|
jars: ["sdk_library/test/mysdklibrary-stubs.jar"],
|
||||||
|
stub_srcs: ["sdk_library/test/mysdklibrary_stub_sources"],
|
||||||
|
current_api: "sdk_library/test/mysdklibrary.txt",
|
||||||
|
removed_api: "sdk_library/test/mysdklibrary-removed.txt",
|
||||||
|
sdk_version: "test_current",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
prebuilt_systemserverclasspath_fragment {
|
||||||
|
name: "mysystemserverclasspathfragment",
|
||||||
|
prefer: false,
|
||||||
|
visibility: ["//visibility:public"],
|
||||||
|
apex_available: ["myapex"],
|
||||||
|
contents: ["mysdklibrary"],
|
||||||
|
} `))
|
||||||
|
}
|
||||||
|
|
||||||
func TestSnapshotWithEmptySystemServerClasspathFragment(t *testing.T) {
|
func TestSnapshotWithEmptySystemServerClasspathFragment(t *testing.T) {
|
||||||
commonSdk := `
|
commonSdk := `
|
||||||
apex {
|
apex {
|
||||||
|
|
Loading…
Reference in a new issue