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

This reverts commit bf0e47648a.

Reason for revert: coverage build with EMMA_INSTRUMENT_FRAMEWORK=true
is fixed by inspecting the environment variable and not generating
boot image in case it is set.

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.

Test: m
Test: m art/build/apex/runtests.sh

Bug: 144091989
Change-Id: I113c0d39222d6d697cb62cd09d5010607872fc2b
This commit is contained in:
Ulyana Trafimovich
2019-11-08 10:51:01 +00:00
committed by Ulya Trafimovich
parent 1f38237c12
commit de534414b3
4 changed files with 89 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 {