Output bootclasspath_fragment's fragments property to sdk snapshot
Adds support for printing a PropertySet that has a property whose value is an array of structs. Bug: 179354495 Test: m nothing m conscrypt-module-sdk - check generated Android.bp file Change-Id: I71be04188465610bcbea4d3c9a5e8204171a1eeb
This commit is contained in:
@@ -511,6 +511,127 @@ sdk_snapshot {
|
||||
)
|
||||
}
|
||||
|
||||
// TestSnapshotWithBootClasspathFragment_Fragments makes sure that the fragments property of a
|
||||
// bootclasspath_fragment is correctly output to the sdk snapshot.
|
||||
func TestSnapshotWithBootClasspathFragment_Fragments(t *testing.T) {
|
||||
result := android.GroupFixturePreparers(
|
||||
prepareForSdkTestWithJava,
|
||||
java.PrepareForTestWithJavaDefaultModules,
|
||||
java.PrepareForTestWithJavaSdkLibraryFiles,
|
||||
java.FixtureWithLastReleaseApis("mysdklibrary", "myothersdklibrary"),
|
||||
prepareForSdkTestWithApex,
|
||||
|
||||
// Some additional files needed for the myotherapex.
|
||||
android.FixtureMergeMockFs(android.MockFS{
|
||||
"system/sepolicy/apex/myotherapex-file_contexts": nil,
|
||||
"myotherapex/apex_manifest.json": nil,
|
||||
"myotherapex/Test.java": nil,
|
||||
}),
|
||||
|
||||
android.FixtureAddTextFile("myotherapex/Android.bp", `
|
||||
apex {
|
||||
name: "myotherapex",
|
||||
key: "myapex.key",
|
||||
min_sdk_version: "2",
|
||||
bootclasspath_fragments: ["myotherbootclasspathfragment"],
|
||||
}
|
||||
|
||||
bootclasspath_fragment {
|
||||
name: "myotherbootclasspathfragment",
|
||||
apex_available: ["myotherapex"],
|
||||
contents: [
|
||||
"myotherlib",
|
||||
],
|
||||
}
|
||||
|
||||
java_library {
|
||||
name: "myotherlib",
|
||||
apex_available: ["myotherapex"],
|
||||
srcs: ["Test.java"],
|
||||
min_sdk_version: "2",
|
||||
permitted_packages: ["myothersdklibrary"],
|
||||
compile_dex: true,
|
||||
}
|
||||
`),
|
||||
|
||||
android.FixtureWithRootAndroidBp(`
|
||||
sdk {
|
||||
name: "mysdk",
|
||||
bootclasspath_fragments: ["mybootclasspathfragment"],
|
||||
}
|
||||
|
||||
bootclasspath_fragment {
|
||||
name: "mybootclasspathfragment",
|
||||
contents: [
|
||||
"mysdklibrary",
|
||||
],
|
||||
fragments: [
|
||||
{
|
||||
apex: "myotherapex",
|
||||
module: "myotherbootclasspathfragment"
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
java_sdk_library {
|
||||
name: "mysdklibrary",
|
||||
srcs: ["Test.java"],
|
||||
shared_library: false,
|
||||
public: {enabled: true},
|
||||
min_sdk_version: "2",
|
||||
}
|
||||
`),
|
||||
).RunTest(t)
|
||||
|
||||
// A preparer to update the test fixture used when processing an unpackage snapshot.
|
||||
preparerForSnapshot := fixtureAddPrebuiltApexForBootclasspathFragment("myapex", "mybootclasspathfragment")
|
||||
|
||||
CheckSnapshot(t, result, "mysdk", "",
|
||||
checkUnversionedAndroidBpContents(`
|
||||
// This is auto-generated. DO NOT EDIT.
|
||||
|
||||
prebuilt_bootclasspath_fragment {
|
||||
name: "mybootclasspathfragment",
|
||||
prefer: false,
|
||||
visibility: ["//visibility:public"],
|
||||
apex_available: ["//apex_available:platform"],
|
||||
contents: ["mysdklibrary"],
|
||||
fragments: [
|
||||
{
|
||||
apex: "myotherapex",
|
||||
module: "myotherbootclasspathfragment",
|
||||
},
|
||||
],
|
||||
hidden_api: {
|
||||
stub_flags: "hiddenapi/stub-flags.csv",
|
||||
annotation_flags: "hiddenapi/annotation-flags.csv",
|
||||
metadata: "hiddenapi/metadata.csv",
|
||||
index: "hiddenapi/index.csv",
|
||||
all_flags: "hiddenapi/all-flags.csv",
|
||||
},
|
||||
}
|
||||
|
||||
java_sdk_library_import {
|
||||
name: "mysdklibrary",
|
||||
prefer: false,
|
||||
visibility: ["//visibility:public"],
|
||||
apex_available: ["//apex_available:platform"],
|
||||
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",
|
||||
},
|
||||
}
|
||||
`),
|
||||
snapshotTestPreparer(checkSnapshotWithoutSource, preparerForSnapshot),
|
||||
snapshotTestPreparer(checkSnapshotWithSourcePreferred, preparerForSnapshot),
|
||||
snapshotTestPreparer(checkSnapshotPreferredWithSource, preparerForSnapshot),
|
||||
)
|
||||
}
|
||||
|
||||
// Test that bootclasspath_fragment works with sdk.
|
||||
func TestBasicSdkWithBootclasspathFragment(t *testing.T) {
|
||||
android.GroupFixturePreparers(
|
||||
|
Reference in New Issue
Block a user