diff options
author | Jiakai Zhang <jiakaiz@google.com> | 2023-05-10 16:40:18 +0100 |
---|---|---|
committer | Cherrypicker Worker <android-build-cherrypicker-worker@google.com> | 2023-05-12 11:16:10 +0000 |
commit | 4e9eb1ae46ea2d5914a616454f0a92579cdc85f2 (patch) | |
tree | 4b69bb7e92ef23b4cf9a7fcc67847ef595460f8c | |
parent | c67528bf7e236d8789c356ba75f408e69561506e (diff) | |
download | soong-4e9eb1ae46ea2d5914a616454f0a92579cdc85f2.tar.gz |
Remove the ability to install boot images by bootclasspath_fragments.
We don't need this anymore because we are going to compile ART jars and
framework jars together.
Bug: 280776428
Test: m
(cherry picked from https://android-review.googlesource.com/q/commit:b47caccbc037b65462f757c462a99732ad6dd51c)
Merged-In: I070157530449a1bb5779e25984c367df3dde7b36
Change-Id: I070157530449a1bb5779e25984c367df3dde7b36
-rw-r--r-- | apex/apex.go | 18 | ||||
-rw-r--r-- | apex/bootclasspath_fragment_test.go | 161 | ||||
-rw-r--r-- | apex/prebuilt.go | 5 | ||||
-rw-r--r-- | java/bootclasspath_fragment.go | 132 | ||||
-rw-r--r-- | java/dexpreopt_bootjars.go | 24 |
5 files changed, 17 insertions, 323 deletions
diff --git a/apex/apex.go b/apex/apex.go index d2c535c5e..7fb6f504e 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -2276,16 +2276,13 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, ctx.PropertyErrorf("sh_binaries", "%q is not a sh_binary module", depName) } case bcpfTag: - bcpfModule, ok := child.(*java.BootclasspathFragmentModule) + _, ok := child.(*java.BootclasspathFragmentModule) if !ok { ctx.PropertyErrorf("bootclasspath_fragments", "%q is not a bootclasspath_fragment module", depName) return false } vctx.filesInfo = append(vctx.filesInfo, apexBootclasspathFragmentFiles(ctx, child)...) - for _, makeModuleName := range bcpfModule.BootImageDeviceInstallMakeModules() { - a.makeModulesToInstall = append(a.makeModulesToInstall, makeModuleName) - } return true case sscpfTag: if _, ok := child.(*java.SystemServerClasspathModule); !ok { @@ -2651,19 +2648,6 @@ func apexBootclasspathFragmentFiles(ctx android.ModuleContext, module blueprint. bootclasspathFragmentInfo := ctx.OtherModuleProvider(module, java.BootclasspathFragmentApexContentInfoProvider).(java.BootclasspathFragmentApexContentInfo) var filesToAdd []apexFile - // Add the boot image files, e.g. .art, .oat and .vdex files. - if bootclasspathFragmentInfo.ShouldInstallBootImageInApex() { - for arch, files := range bootclasspathFragmentInfo.AndroidBootImageFilesByArchType() { - dirInApex := filepath.Join("javalib", arch.String()) - for _, f := range files { - androidMkModuleName := "javalib_" + arch.String() + "_" + filepath.Base(f.String()) - // TODO(b/177892522) - consider passing in the bootclasspath fragment module here instead of nil - af := newApexFile(ctx, f, androidMkModuleName, dirInApex, etc, nil) - filesToAdd = append(filesToAdd, af) - } - } - } - // Add classpaths.proto config. if af := apexClasspathFragmentProtoFile(ctx, module); af != nil { filesToAdd = append(filesToAdd, *af) diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go index 0a72116a6..1b5288696 100644 --- a/apex/bootclasspath_fragment_test.go +++ b/apex/bootclasspath_fragment_test.go @@ -115,20 +115,7 @@ func TestBootclasspathFragments(t *testing.T) { // Make sure that the art-bootclasspath-fragment is using the correct configuration. checkBootclasspathFragment(t, result, "art-bootclasspath-fragment", "android_common_apex10000", - "com.android.art:baz,com.android.art:quuz", ` -dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.art -dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.oat -dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.vdex -dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-quuz.art -dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-quuz.oat -dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-quuz.vdex -dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.art -dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.oat -dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.vdex -dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-quuz.art -dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-quuz.oat -dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-quuz.vdex -`) + "com.android.art:baz,com.android.art:quuz") } func TestBootclasspathFragments_FragmentDependency(t *testing.T) { @@ -261,7 +248,7 @@ func TestBootclasspathFragments_FragmentDependency(t *testing.T) { checkAPIScopeStubs("other", otherInfo, java.CorePlatformHiddenAPIScope) } -func checkBootclasspathFragment(t *testing.T, result *android.TestResult, moduleName, variantName string, expectedConfiguredModules string, expectedBootclasspathFragmentFiles string) { +func checkBootclasspathFragment(t *testing.T, result *android.TestResult, moduleName, variantName string, expectedConfiguredModules string) { t.Helper() bootclasspathFragment := result.ModuleForTests(moduleName, variantName).Module().(*java.BootclasspathFragmentModule) @@ -269,19 +256,6 @@ func checkBootclasspathFragment(t *testing.T, result *android.TestResult, module bootclasspathFragmentInfo := result.ModuleProvider(bootclasspathFragment, java.BootclasspathFragmentApexContentInfoProvider).(java.BootclasspathFragmentApexContentInfo) modules := bootclasspathFragmentInfo.Modules() android.AssertStringEquals(t, "invalid modules for "+moduleName, expectedConfiguredModules, modules.String()) - - // Get a list of all the paths in the boot image sorted by arch type. - allPaths := []string{} - bootImageFilesByArchType := bootclasspathFragmentInfo.AndroidBootImageFilesByArchType() - for _, archType := range android.ArchTypeList() { - if paths, ok := bootImageFilesByArchType[archType]; ok { - for _, path := range paths { - allPaths = append(allPaths, android.NormalizePathForTesting(path)) - } - } - } - - android.AssertTrimmedStringEquals(t, "invalid paths for "+moduleName, expectedBootclasspathFragmentFiles, strings.Join(allPaths, "\n")) } func TestBootclasspathFragmentInArtApex(t *testing.T) { @@ -420,18 +394,6 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{ "etc/boot-image.prof", "etc/classpaths/bootclasspath.pb", - "javalib/arm/boot.art", - "javalib/arm/boot.oat", - "javalib/arm/boot.vdex", - "javalib/arm/boot-bar.art", - "javalib/arm/boot-bar.oat", - "javalib/arm/boot-bar.vdex", - "javalib/arm64/boot.art", - "javalib/arm64/boot.oat", - "javalib/arm64/boot.vdex", - "javalib/arm64/boot-bar.art", - "javalib/arm64/boot-bar.oat", - "javalib/arm64/boot-bar.vdex", "javalib/bar.jar", "javalib/foo.jar", }) @@ -441,62 +403,12 @@ 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("generate boot image profile even if dexpreopt is disabled", func(t *testing.T) { result := android.GroupFixturePreparers( commonPreparer, @@ -552,18 +464,6 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { ensureExactDeapexedContents(t, result.TestContext, "com.android.art", "android_common", []string{ "etc/boot-image.prof", - "javalib/arm/boot.art", - "javalib/arm/boot.oat", - "javalib/arm/boot.vdex", - "javalib/arm/boot-bar.art", - "javalib/arm/boot-bar.oat", - "javalib/arm/boot-bar.vdex", - "javalib/arm64/boot.art", - "javalib/arm64/boot.oat", - "javalib/arm64/boot.vdex", - "javalib/arm64/boot-bar.art", - "javalib/arm64/boot-bar.oat", - "javalib/arm64/boot-bar.vdex", "javalib/bar.jar", "javalib/foo.jar", }) @@ -574,65 +474,12 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) { `prebuilt_com.android.art`, }) - // 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 prebuilt bootclasspath_fragment copies its dex files to the predefined // locations for the art image. module := result.ModuleForTests("prebuilt_mybootclasspathfragment", "android_common_com.android.art") checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo") }) - t.Run("boot image files from preferred prebuilt 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"), - - // Make sure that a preferred prebuilt with consistent contents doesn't affect the apex. - addPrebuilt(true, "foo", "bar"), - - java.FixtureSetBootImageInstallDirOnDevice("art", "system/framework"), - ).RunTest(t) - - ensureExactDeapexedContents(t, result.TestContext, "com.android.art", "android_common", []string{ - "etc/boot-image.prof", - "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("source with inconsistency between config and contents", func(t *testing.T) { android.GroupFixturePreparers( commonPreparer, @@ -782,10 +629,6 @@ func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) { module := result.ModuleForTests("mybootclasspathfragment", "android_common_com.android.art") checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo") - - // Check that the right deapexer module was chosen for a boot image. - param := module.Output("out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.art") - android.AssertStringDoesContain(t, "didn't find the expected deapexer in the input path", param.Input.String(), "/com.android.art.deapexer") }) t.Run("enabled alternative APEX", func(t *testing.T) { diff --git a/apex/prebuilt.go b/apex/prebuilt.go index 31cecf111..0d83830f1 100644 --- a/apex/prebuilt.go +++ b/apex/prebuilt.go @@ -199,14 +199,11 @@ func (p *prebuiltCommon) initApexFilesForAndroidMk(ctx android.ModuleContext) { p.apexFilesForAndroidMk = append(p.apexFilesForAndroidMk, af) } } else if tag == exportedBootclasspathFragmentTag { - bcpfModule, ok := child.(*java.PrebuiltBootclasspathFragmentModule) + _, ok := child.(*java.PrebuiltBootclasspathFragmentModule) if !ok { ctx.PropertyErrorf("exported_bootclasspath_fragments", "%q is not a prebuilt_bootclasspath_fragment module", name) return false } - for _, makeModuleName := range bcpfModule.BootImageDeviceInstallMakeModules() { - p.requiredModuleNames = append(p.requiredModuleNames, makeModuleName) - } // Visit the children of the bootclasspath_fragment. return true } else if tag == exportedSystemserverclasspathFragmentTag { diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go index 6ccf5a331..f45165943 100644 --- a/java/bootclasspath_fragment.go +++ b/java/bootclasspath_fragment.go @@ -240,11 +240,6 @@ type BootclasspathFragmentModule struct { // Collect the module directory for IDE info in java/jdeps.go. modulePaths []string - - // Installs for on-device boot image files. This list has entries only if the installs should be - // handled by Make (e.g., the boot image should be installed on the system partition, rather than - // in the APEX). - bootImageDeviceInstalls []dexpreopterInstall } // commonBootclasspathFragment defines the methods that are implemented by both source and prebuilt @@ -268,12 +263,6 @@ type commonBootclasspathFragment interface { var _ commonBootclasspathFragment = (*BootclasspathFragmentModule)(nil) -// bootImageFilesByArch is a map from android.ArchType to the paths to the boot image files. -// -// The paths include the .art, .oat and .vdex files, one for each of the modules from which the boot -// image is created. -type bootImageFilesByArch map[android.ArchType]android.Paths - func bootclasspathFragmentFactory() android.Module { m := &BootclasspathFragmentModule{} m.AddProperties(&m.properties, &m.sourceOnlyProperties) @@ -395,12 +384,6 @@ type BootclasspathFragmentApexContentInfo struct { // set image_name: "art". modules android.ConfiguredJarList - // Map from arch type to the boot image files. - bootImageFilesByArch bootImageFilesByArch - - // True if the boot image should be installed in the APEX. - shouldInstallBootImageInApex bool - // Map from the base module name (without prebuilt_ prefix) of a fragment's contents module to the // hidden API encoded dex jar path. contentModuleDexJarPaths bootDexJarByModule @@ -417,18 +400,6 @@ func (i BootclasspathFragmentApexContentInfo) Modules() android.ConfiguredJarLis return i.modules } -// Get a map from ArchType to the associated boot image's contents for Android. -// -// Extension boot images only return their own files, not the files of the boot images they extend. -func (i BootclasspathFragmentApexContentInfo) AndroidBootImageFilesByArchType() bootImageFilesByArch { - return i.bootImageFilesByArch -} - -// Return true if the boot image should be installed in the APEX. -func (i *BootclasspathFragmentApexContentInfo) ShouldInstallBootImageInApex() bool { - return i.shouldInstallBootImageInApex -} - // DexBootJarPathForContentModule returns the path to the dex boot jar for specified module. // // The dex boot jar is one which has had hidden API encoding performed on it. @@ -566,25 +537,6 @@ func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.Mo // Copy the dex jars of this fragment's content modules to their predefined locations. copyBootJarsToPredefinedLocations(ctx, hiddenAPIOutput.EncodedBootDexFilesByModule, imageConfig.dexPathsByModule) } - - for _, variant := range bootImageFiles.variants { - archType := variant.config.target.Arch.ArchType - arch := archType.String() - for _, install := range variant.deviceInstalls { - // Remove the "/" prefix because the path should be relative to $ANDROID_PRODUCT_OUT. - installDir := strings.TrimPrefix(filepath.Dir(install.To), "/") - installBase := filepath.Base(install.To) - installPath := android.PathForModuleInPartitionInstall(ctx, "", installDir) - - b.bootImageDeviceInstalls = append(b.bootImageDeviceInstalls, dexpreopterInstall{ - name: arch + "-" + installBase, - moduleName: b.Name(), - outputPathOnHost: install.From, - installDirOnDevice: installPath, - installFileOnDevice: installBase, - }) - } - } } // A prebuilt fragment cannot contribute to an apex. @@ -643,12 +595,8 @@ func (b *BootclasspathFragmentModule) provideApexContentInfo(ctx android.ModuleC info.profilePathOnHost = bootImageFiles.profile info.profileInstallPathInApex = imageConfig.profileInstallPathInApex } - - info.shouldInstallBootImageInApex = imageConfig.shouldInstallInApex() } - info.bootImageFilesByArch = bootImageFiles.byArch - // Make the apex content info available for other modules. ctx.SetProvider(BootclasspathFragmentApexContentInfoProvider, info) } @@ -960,21 +908,9 @@ func (b *BootclasspathFragmentModule) AndroidMkEntries() []android.AndroidMkEntr }, }, }} - for _, install := range b.bootImageDeviceInstalls { - entriesList = append(entriesList, install.ToMakeEntries()) - } return entriesList } -// Returns the names of all Make modules that handle the installation of the boot image. -func (b *BootclasspathFragmentModule) BootImageDeviceInstallMakeModules() []string { - var makeModules []string - for _, install := range b.bootImageDeviceInstalls { - makeModules = append(makeModules, install.FullModuleName()) - } - return makeModules -} - // Collect information for opening IDE project files in java/jdeps.go. func (b *BootclasspathFragmentModule) IDEInfo(dpInfo *android.IdeInfo) { dpInfo.Deps = append(dpInfo.Deps, b.properties.Contents...) @@ -1262,59 +1198,17 @@ func (module *PrebuiltBootclasspathFragmentModule) produceBootImageFiles(ctx and // built without a profile as the prebuilt modules do not provide a profile. buildBootImageVariantsForBuildOs(ctx, imageConfig, profile) - if imageConfig.shouldInstallInApex() { - // If the boot image files for the android variants are in the prebuilt apex, we must use those - // rather than building new ones because those boot image files are going to be used on device. - files := bootImageFilesByArch{} - bootImageFiles := bootImageOutputs{ - byArch: files, - profile: profile, - } - for _, variant := range imageConfig.apexVariants() { - arch := variant.target.Arch.ArchType - bootImageFiles.variants = append(bootImageFiles.variants, bootImageVariantOutputs{ - variant, - // No device installs needed when installed in APEX. - nil, - }) - for _, toPath := range variant.imagesDeps { - apexRelativePath := apexRootRelativePathToBootImageFile(arch, toPath.Base()) - // Get the path to the file that the deapexer extracted from the prebuilt apex file. - fromPath := di.PrebuiltExportPath(apexRelativePath) - - // Return the toPath as the calling code expects the paths in the returned map to be the - // paths predefined in the bootImageConfig. - files[arch] = append(files[arch], toPath) - - // Copy the file to the predefined location. - ctx.Build(pctx, android.BuildParams{ - Rule: android.Cp, - Input: fromPath, - Output: toPath, - }) - } - } - return bootImageFiles - } else { - if profile == nil && imageConfig.isProfileGuided() { - ctx.ModuleErrorf("Unable to produce boot image files: neither boot image files nor profiles exists in the prebuilt apex") - return bootImageOutputs{} - } - // Build boot image files for the android variants from the dex files provided by the contents - // of this module. - return buildBootImageVariantsForAndroidOs(ctx, imageConfig, profile) + if profile == nil && imageConfig.isProfileGuided() { + ctx.ModuleErrorf("Unable to produce boot image files: profiles not found in the prebuilt apex") + return bootImageOutputs{} } + // Build boot image files for the android variants from the dex files provided by the contents + // of this module. + return buildBootImageVariantsForAndroidOs(ctx, imageConfig, profile) } var _ commonBootclasspathFragment = (*PrebuiltBootclasspathFragmentModule)(nil) -// createBootImageTag creates the tag to uniquely identify the boot image file among all of the -// files that a module requires from the prebuilt .apex file. -func createBootImageTag(arch android.ArchType, baseName string) string { - tag := fmt.Sprintf(".bootimage-%s-%s", arch, baseName) - return tag -} - // RequiredFilesFromPrebuiltApex returns the list of all files the prebuilt_bootclasspath_fragment // requires from a prebuilt .apex file. // @@ -1328,25 +1222,11 @@ func (module *PrebuiltBootclasspathFragmentModule) RequiredFilesFromPrebuiltApex // Add the boot image profile. files = append(files, imageConfig.profileInstallPathInApex) } - if imageConfig.shouldInstallInApex() { - // Add the boot image files, e.g. .art, .oat and .vdex files. - for _, variant := range imageConfig.apexVariants() { - arch := variant.target.Arch.ArchType - for _, path := range variant.imagesDeps.Paths() { - base := path.Base() - files = append(files, apexRootRelativePathToBootImageFile(arch, base)) - } - } - } return files } return nil } -func apexRootRelativePathToBootImageFile(arch android.ArchType, base string) string { - return filepath.Join("javalib", arch.String(), base) -} - var _ android.RequiredFilesFromPrebuiltApex = (*PrebuiltBootclasspathFragmentModule)(nil) func prebuiltBootclasspathFragmentFactory() android.Module { diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index 8e79674fb..7b5c294a0 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -421,11 +421,6 @@ func (image *bootImageConfig) apexVariants() []*bootImageVariant { return variants } -// Returns true if the boot image should be installed in the APEX. -func (image *bootImageConfig) shouldInstallInApex() bool { - return strings.HasPrefix(image.installDirOnDevice, "apex/") -} - // Return boot image locations (as a list of symbolic paths). // // The image "location" is a symbolic path that, with multiarchitecture support, doesn't really @@ -596,6 +591,12 @@ func buildBootImageVariantsForBuildOs(ctx android.ModuleContext, image *bootImag buildBootImageForOsType(ctx, image, profile, ctx.Config().BuildOS) } +// bootImageFilesByArch is a map from android.ArchType to the paths to the boot image files. +// +// The paths include the .art, .oat and .vdex files, one for each of the modules from which the boot +// image is created. +type bootImageFilesByArch map[android.ArchType]android.Paths + // bootImageOutputs encapsulates information about boot images that were created/obtained by // commonBootclasspathFragment.produceBootImageFiles. type bootImageOutputs struct { @@ -656,8 +657,7 @@ func buildBootImageZipInPredefinedLocation(ctx android.ModuleContext, image *boo } type bootImageVariantOutputs struct { - config *bootImageVariant - deviceInstalls android.RuleBuilderInstalls + config *bootImageVariant } // Generate boot image build rules for a specific target. @@ -800,7 +800,6 @@ func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, p var vdexInstalls android.RuleBuilderInstalls var unstrippedInstalls android.RuleBuilderInstalls - var deviceInstalls android.RuleBuilderInstalls for _, artOrOat := range image.moduleFiles(ctx, outputDir, ".art", ".oat") { cmd.ImplicitOutput(artOrOat) @@ -826,14 +825,6 @@ func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, p android.RuleBuilderInstall{unstrippedOat, filepath.Join(installDir, unstrippedOat.Base())}) } - if image.installDirOnHost != image.installDirOnDevice && !image.shouldInstallInApex() && !ctx.Config().UnbundledBuild() { - installDirOnDevice := filepath.Join("/", image.installDirOnDevice, arch.String()) - for _, file := range image.moduleFiles(ctx, outputDir, ".art", ".oat", ".vdex") { - deviceInstalls = append(deviceInstalls, - android.RuleBuilderInstall{file, filepath.Join(installDirOnDevice, file.Base())}) - } - } - rule.Build(image.name+"JarsDexpreopt_"+image.target.String(), "dexpreopt "+image.name+" jars "+arch.String()) // save output and installed files for makevars @@ -849,7 +840,6 @@ func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, p return bootImageVariantOutputs{ image, - deviceInstalls, } } |