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 Change-Id: I070157530449a1bb5779e25984c367df3dde7b36
This commit is contained in:
@@ -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 {
|
||||
|
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user