Add exported_bootclasspath_fragments to prebuilt_apex/apex_set

This is needed to allow a prebuilt_bootclasspath_fragment to be used
interchangeably with a bootclasspath_fragment in the
platform_bootclasspath module.

The platform_bootclasspath module depends on APEX specific variants of
bootclasspath_fragment modules. That works because the
bootclasspath_fragment modules are part of an apex and so have an APEX
specific variant which the platform_bootclasspath can specify.

Using a prebuilt_bootclasspath_fragment in place of a
bootclasspath_fragment requires that the prebuilt also has an APEX
specific variant.

Specifying exported_bootclasspath_fragments on a prebuilt_apex/apex_set
will cause it to create an APEX variant for the named module whcih will
allow it to be selected by the platform_bootclasspath module.

Bug: 186034565
Bug: 177892522
Test: m nothing
Change-Id: I7ddacc6498ec3a4a9f26c5f78b7f9a033e494d78
This commit is contained in:
Paul Duffin
2021-04-22 01:45:29 +01:00
parent a3693772a6
commit 023dba0a3f
5 changed files with 71 additions and 21 deletions

View File

@@ -24,6 +24,7 @@ import (
func TestSnapshotWithBootclasspathFragment_ImageName(t *testing.T) {
result := android.GroupFixturePreparers(
prepareForSdkTestWithJava,
java.PrepareForTestWithJavaDefaultModules,
prepareForSdkTestWithApex,
// Some additional files needed for the art apex.
@@ -32,6 +33,20 @@ func TestSnapshotWithBootclasspathFragment_ImageName(t *testing.T) {
"com.android.art.pem": nil,
"system/sepolicy/apex/com.android.art-file_contexts": nil,
}),
// platform_bootclasspath that depends on the fragment.
android.FixtureAddTextFile("frameworks/base/boot/Android.bp", `
platform_bootclasspath {
name: "platform-bootclasspath",
fragments: [
{
apex: "com.android.art",
module: "mybootclasspathfragment",
},
],
}
`),
java.FixtureConfigureBootJars("com.android.art:mybootlib"),
android.FixtureWithRootAndroidBp(`
sdk {
@@ -72,6 +87,23 @@ func TestSnapshotWithBootclasspathFragment_ImageName(t *testing.T) {
`),
).RunTest(t)
// A preparer to add a prebuilt apex to the test fixture.
prepareWithPrebuiltApex := android.GroupFixturePreparers(
android.FixtureAddTextFile("prebuilts/apex/Android.bp", `
prebuilt_apex {
name: "com.android.art",
src: "art.apex",
exported_java_libs: [
"mybootlib",
],
exported_bootclasspath_fragments: [
"mybootclasspathfragment",
],
}
`),
android.FixtureAddFile("prebuilts/apex/art.apex", nil),
)
CheckSnapshot(t, result, "mysdk", "",
checkUnversionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
@@ -121,19 +153,9 @@ sdk_snapshot {
checkAllCopyRules(`
.intermediates/mybootlib/android_common/javac/mybootlib.jar -> java/mybootlib.jar
`),
snapshotTestPreparer(checkSnapshotPreferredWithSource, android.GroupFixturePreparers(
android.FixtureAddTextFile("prebuilts/apex/Android.bp", `
prebuilt_apex {
name: "com.android.art",
src: "art.apex",
exported_java_libs: [
"mybootlib",
],
}
`),
android.FixtureAddFile("prebuilts/apex/art.apex", nil),
),
),
snapshotTestPreparer(checkSnapshotWithoutSource, prepareWithPrebuiltApex),
snapshotTestPreparer(checkSnapshotWithSourcePreferred, prepareWithPrebuiltApex),
snapshotTestPreparer(checkSnapshotPreferredWithSource, prepareWithPrebuiltApex),
)
}