Revert^2 "Package dexpreopt artifacts for libcore jars in the ART apex."

This reverts commit 24babe3a66.

Build failures are fixed after reworking the patch:

  - 'missing dependencies' on aosp-master-art branch is fixed by
    disabling profile generation in case default profile is not
    found (it is part of framework absent in aosp-master-art)

  - invalid dex2oat invocation should no longer happen after
    disabling dexpreopt on targets that do not use default ART config
    (fixed in CL If2d4fe2cdcb6a81c7c6d730d18c2b681a74fb0b7)

Dexpreopt artifacts for the libcore part of the boot class path are
now packaged in the ART apex. The system image still contains
dexpreopt artifacts for the full set of boot class path libraries
(both libcore and framework); the libcore part will be removed and
boot image extension will be used in a follow-up CL.

Since this is specific to the ART apex and makes no sense for other
apexes, the implementation adds a boolean flag "is ART apex" rather
than a new apex module property.

Build rules for the new set of dexpreopt artifacts are created using
a new variant of the global boot image config. Previously we had two
variants: "default" (for the system image) and "apex" (for the
JIT-zygote experiment). This patch adds a third "art" variant.

Bug: 143594594
Bug: 143593500

Test: m
Test: m com.android.art deapexer \
    && find $ANDROID_BUILD_TOP -type f -name 'com.android.art.*.apex \
        | xargs deapexer | grep boot \
    Expect to find javalib/$ARCH/boot*.{art,oat,vdex} files.
Test: m art/build/apex/runtests.sh

Change-Id: Ib37acaec8401bd23c8d547dadf773565406ef448
This commit is contained in:
Ulyana Trafimovich
2019-11-06 17:20:49 +00:00
committed by Ulya Trafimovich
parent af60d490ff
commit 66b3e99649
4 changed files with 81 additions and 38 deletions

View File

@@ -106,15 +106,20 @@ func stemOf(moduleName string) string {
return moduleName
}
func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name string,
needZip bool) bootImageConfig {
// Construct a variant of the global config for dexpreopted bootclasspath jars. The variants differ
// in the list of input jars (libcore, framework, or both), in the naming scheme for the dexpreopt
// files (ART recognizes "apex" names as special), and whether to include a zip archive.
//
// 'name' is a string unique for each profile (used in directory names and ninja rule names)
// 'stem' is the basename of the image: the resulting filenames are <stem>[-<jar>].{art,oat,vdex}.
func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name string, stem string,
needZip bool, artApexJarsOnly bool) bootImageConfig {
return ctx.Config().Once(key, func() interface{} {
global := dexpreoptGlobalConfig(ctx)
artModules := global.ArtApexJars
nonFrameworkModules := concat(artModules, global.ProductUpdatableBootModules)
frameworkModules := android.RemoveListFromList(global.BootJars, nonFrameworkModules)
imageModules := concat(artModules, frameworkModules)
imageModules := artModules
var bootLocations []string
@@ -123,9 +128,15 @@ func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name strin
filepath.Join("/apex/com.android.art/javalib", stemOf(m)+".jar"))
}
for _, m := range frameworkModules {
bootLocations = append(bootLocations,
filepath.Join("/system/framework", stemOf(m)+".jar"))
if !artApexJarsOnly {
nonFrameworkModules := concat(artModules, global.ProductUpdatableBootModules)
frameworkModules := android.RemoveListFromList(global.BootJars, nonFrameworkModules)
imageModules = concat(imageModules, frameworkModules)
for _, m := range frameworkModules {
bootLocations = append(bootLocations,
filepath.Join("/system/framework", stemOf(m)+".jar"))
}
}
// The path to bootclasspath dex files needs to be known at module GenerateAndroidBuildAction time, before
@@ -143,13 +154,14 @@ func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name strin
var zip android.WritablePath
if needZip {
zip = dir.Join(ctx, name+".zip")
zip = dir.Join(ctx, stem+".zip")
}
targets := dexpreoptTargets(ctx)
imageConfig := bootImageConfig{
name: name,
stem: stem,
modules: imageModules,
dexLocations: bootLocations,
dexPaths: bootDexPaths,
@@ -163,7 +175,7 @@ func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name strin
for _, target := range targets {
imageDir := dir.Join(ctx, "system/framework", target.Arch.ArchType.String())
imageConfig.images[target.Arch.ArchType] = imageDir.Join(ctx, name+".art")
imageConfig.images[target.Arch.ArchType] = imageDir.Join(ctx, stem+".art")
imagesDeps := make([]android.Path, 0, len(imageConfig.modules)*3)
for _, dep := range imageConfig.moduleFiles(ctx, imageDir, ".art", ".oat", ".vdex") {
@@ -176,15 +188,25 @@ func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name strin
}).(bootImageConfig)
}
// Default config is the one that goes in the system image. It includes both libcore and framework.
var defaultBootImageConfigKey = android.NewOnceKey("defaultBootImageConfig")
var apexBootImageConfigKey = android.NewOnceKey("apexBootImageConfig")
func defaultBootImageConfig(ctx android.PathContext) bootImageConfig {
return getBootImageConfig(ctx, defaultBootImageConfigKey, "boot", true)
return getBootImageConfig(ctx, defaultBootImageConfigKey, "boot", "boot", true, false)
}
// Apex config is used for the JIT-zygote experiment. It includes both libcore and framework, but AOT-compiles only libcore.
var apexBootImageConfigKey = android.NewOnceKey("apexBootImageConfig")
func apexBootImageConfig(ctx android.PathContext) bootImageConfig {
return getBootImageConfig(ctx, apexBootImageConfigKey, "apex", false)
return getBootImageConfig(ctx, apexBootImageConfigKey, "apex", "apex", false, false)
}
// ART config is the one used for the ART apex. It includes only libcore.
var artBootImageConfigKey = android.NewOnceKey("artBootImageConfig")
func artBootImageConfig(ctx android.PathContext) bootImageConfig {
return getBootImageConfig(ctx, artBootImageConfigKey, "art", "boot", false, true)
}
func defaultBootclasspath(ctx android.PathContext) []string {