Tighten bootclasspath_fragment property validation

Previously, due to legacy reasons, the property validation did not
require a contents property and allowed the image_name to be either
"art" or "boot". Those reasons no longer apply and so this change
requires a contents property and only allows the image_name to be set
to "art" if specified.

Bug: 177892522
Test: m nothing
Change-Id: I8855d6e5365ef0b55490e90e7b6c0081cf070ee5
This commit is contained in:
Paul Duffin
2021-05-21 19:28:09 +01:00
parent 58e0e769c9
commit 8018e50ddb
3 changed files with 91 additions and 80 deletions

View File

@@ -424,6 +424,7 @@ func TestBasicSdkWithBootclasspathFragment(t *testing.T) {
android.GroupFixturePreparers(
prepareForSdkTestWithApex,
prepareForSdkTestWithJava,
android.FixtureAddFile("java/mybootlib.jar", nil),
android.FixtureWithRootAndroidBp(`
sdk {
name: "mysdk",
@@ -433,16 +434,27 @@ func TestBasicSdkWithBootclasspathFragment(t *testing.T) {
bootclasspath_fragment {
name: "mybootclasspathfragment",
image_name: "art",
contents: ["mybootlib"],
apex_available: ["myapex"],
}
java_library {
name: "mybootlib",
apex_available: ["myapex"],
srcs: ["Test.java"],
system_modules: "none",
sdk_version: "none",
min_sdk_version: "1",
compile_dex: true,
}
sdk_snapshot {
name: "mysdk@1",
bootclasspath_fragments: ["mybootclasspathfragment_mysdk_1"],
bootclasspath_fragments: ["mysdk_mybootclasspathfragment@1"],
}
prebuilt_bootclasspath_fragment {
name: "mybootclasspathfragment_mysdk_1",
name: "mysdk_mybootclasspathfragment@1",
sdk_member_name: "mybootclasspathfragment",
prefer: false,
visibility: ["//visibility:public"],
@@ -450,6 +462,15 @@ func TestBasicSdkWithBootclasspathFragment(t *testing.T) {
"myapex",
],
image_name: "art",
contents: ["mysdk_mybootlib@1"],
}
java_import {
name: "mysdk_mybootlib@1",
sdk_member_name: "mybootlib",
visibility: ["//visibility:public"],
apex_available: ["com.android.art"],
jars: ["java/mybootlib.jar"],
}
`),
).RunTest(t)