Allow installing boot images outside of APEX.

After this change, `bootImageConfig.installDirOnDevice` can be set to a
path outside of the APEX, in which case, the boot image will not be
installed in the APEX. Instead, it will be installed to the given path
by Make.

This is a no-op change. Current behavior is not affected.

Bug: 211973309
Test: m nothing
Test: -
  1. m com.android.art
  2. See the boot image still being installed in the ART APEX.
Test: -
  1. Change `installDirOnDevice` of the ART boot image config to
     `system/framework`.
  2. See the boot image being installed in `/system/framework/<arch>`.
Change-Id: Ib13b17cc9e94dc5754c9b51b04df3307323b8783
This commit is contained in:
Jiakai Zhang
2022-01-12 17:56:19 +00:00
parent 9ab9437b40
commit 6decef916c
8 changed files with 204 additions and 29 deletions

View File

@@ -410,6 +410,7 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
// bootclasspath_fragment's contents property.
java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"),
addSource("foo", "bar"),
java.FixtureSetBootImageInstallDirOnDevice("art", "apex/com.android.art/javalib"),
).RunTest(t)
ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{
@@ -437,12 +438,62 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
`mybootclasspathfragment`,
})
// The boot images are installed in the APEX by Soong, so there shouldn't be any dexpreopt-related Make modules.
ensureDoesNotContainRequiredDeps(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{
"mybootclasspathfragment-dexpreopt-arm64-boot.art",
"mybootclasspathfragment-dexpreopt-arm64-boot.oat",
"mybootclasspathfragment-dexpreopt-arm64-boot.vdex",
"mybootclasspathfragment-dexpreopt-arm64-boot-bar.art",
"mybootclasspathfragment-dexpreopt-arm64-boot-bar.oat",
"mybootclasspathfragment-dexpreopt-arm64-boot-bar.vdex",
"mybootclasspathfragment-dexpreopt-arm-boot.art",
"mybootclasspathfragment-dexpreopt-arm-boot.oat",
"mybootclasspathfragment-dexpreopt-arm-boot.vdex",
"mybootclasspathfragment-dexpreopt-arm-boot-bar.art",
"mybootclasspathfragment-dexpreopt-arm-boot-bar.oat",
"mybootclasspathfragment-dexpreopt-arm-boot-bar.vdex",
})
// Make sure that the source bootclasspath_fragment copies its dex files to the predefined
// locations for the art image.
module := result.ModuleForTests("mybootclasspathfragment", "android_common_apex10000")
checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo")
})
t.Run("boot image files from source no boot image in apex", func(t *testing.T) {
result := android.GroupFixturePreparers(
commonPreparer,
// Configure some libraries in the art bootclasspath_fragment that match the source
// bootclasspath_fragment's contents property.
java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"),
addSource("foo", "bar"),
java.FixtureSetBootImageInstallDirOnDevice("art", "system/framework"),
).RunTest(t)
ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{
"etc/boot-image.prof",
"etc/classpaths/bootclasspath.pb",
"javalib/bar.jar",
"javalib/foo.jar",
})
ensureContainsRequiredDeps(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{
"mybootclasspathfragment-dexpreopt-arm64-boot.art",
"mybootclasspathfragment-dexpreopt-arm64-boot.oat",
"mybootclasspathfragment-dexpreopt-arm64-boot.vdex",
"mybootclasspathfragment-dexpreopt-arm64-boot-bar.art",
"mybootclasspathfragment-dexpreopt-arm64-boot-bar.oat",
"mybootclasspathfragment-dexpreopt-arm64-boot-bar.vdex",
"mybootclasspathfragment-dexpreopt-arm-boot.art",
"mybootclasspathfragment-dexpreopt-arm-boot.oat",
"mybootclasspathfragment-dexpreopt-arm-boot.vdex",
"mybootclasspathfragment-dexpreopt-arm-boot-bar.art",
"mybootclasspathfragment-dexpreopt-arm-boot-bar.oat",
"mybootclasspathfragment-dexpreopt-arm-boot-bar.vdex",
})
})
t.Run("boot image disable generate profile", func(t *testing.T) {
result := android.GroupFixturePreparers(
commonPreparer,
@@ -472,6 +523,8 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
// Make sure that a preferred prebuilt with consistent contents doesn't affect the apex.
addPrebuilt(true, "foo", "bar"),
java.FixtureSetBootImageInstallDirOnDevice("art", "apex/com.android.art/javalib"),
).RunTest(t)
ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{