summaryrefslogtreecommitdiff
path: root/sdk/bootclasspath_fragment_sdk_test.go
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2021-04-22 01:45:29 +0100
committerPaul Duffin <paulduffin@google.com>2021-04-23 12:12:37 +0100
commit023dba0a3f815b50d2c040617262419ffdc0ea53 (patch)
treea34aeb31e8ffbbb91ecb4be200ba78a93f28827f /sdk/bootclasspath_fragment_sdk_test.go
parenta3693772a6fe4dd7439405125a775f4775047d93 (diff)
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
Diffstat (limited to 'sdk/bootclasspath_fragment_sdk_test.go')
-rw-r--r--sdk/bootclasspath_fragment_sdk_test.go48
1 files changed, 35 insertions, 13 deletions
diff --git a/sdk/bootclasspath_fragment_sdk_test.go b/sdk/bootclasspath_fragment_sdk_test.go
index 0ce4351eb..ef4d7cd45 100644
--- a/sdk/bootclasspath_fragment_sdk_test.go
+++ b/sdk/bootclasspath_fragment_sdk_test.go
@@ -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),
)
}