Consistently use either "boot" or "apex" boot image as the default.

Previous CL Ia9b34aa92ebb1b4de96ea0f8f290d798be19b2cf introduced
asymmetry in handling "boot" and "apex" boot images: in JIT-zygote
experiment, though the "apex" boot image was installed, the "boot"
boot image was still used for generating dexpreopt configs.

It is unclear why this asymmetry was needed at that point; it seems
incorrect to use different boot images for dexpreopting and for
installing on device. After recent changes the asymmetry started
breaking walleye_jitzygote-userdebug on git_rvc-release, because APK
dexpreopt commands refer to inexistent boot image files.

Test: lunch aosp_walleye-userdebug && m
Test: cherry-pick CL in internal, walleye_jitzygote-userdebug boots

Change-Id: Id877c10269cf79caf6ae74b1dc169a31e6a2211b
This commit is contained in:
Ulya Trafimovich 2019-12-13 13:34:06 +00:00
parent 572aeed6a4
commit 48b3b3c71f
3 changed files with 22 additions and 18 deletions

View File

@ -101,10 +101,6 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
global := dexpreoptGlobalConfig(ctx)
bootImage := defaultBootImageConfig(ctx)
defaultBootImage := bootImage
if global.UseApexImage {
bootImage = apexBootImageConfig(ctx)
}
var archs []android.ArchType
for _, a := range ctx.MultiTargets() {
@ -174,11 +170,8 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Mo
DexPreoptImagesDeps: imagesDeps,
DexPreoptImageLocations: bootImage.imageLocations,
// We use the dex paths and dex locations of the default boot image, as it
// contains the full dexpreopt boot classpath. Other images may just contain a subset of
// the dexpreopt boot classpath.
PreoptBootClassPathDexFiles: defaultBootImage.dexPathsDeps.Paths(),
PreoptBootClassPathDexLocations: defaultBootImage.dexLocationsDeps,
PreoptBootClassPathDexFiles: bootImage.dexPathsDeps.Paths(),
PreoptBootClassPathDexLocations: bootImage.dexLocationsDeps,
PreoptExtractedApk: false,

View File

@ -220,15 +220,18 @@ func (d *dexpreoptBootJars) GenerateBuildActions(ctx android.SingletonContext) {
return
}
// Always create the default boot image first, to get a unique profile rule for all images.
d.defaultBootImage = buildBootImage(ctx, defaultBootImageConfig(ctx))
if !skipDexpreoptArtBootJars(ctx) {
// Create boot image for the ART apex (build artifacts are accessed via the global boot image config).
d.otherImages = append(d.otherImages, buildBootImage(ctx, artBootImageConfig(ctx)))
}
// Default boot image is either the framework one, or the JIT-zygote one.
// The boot image that is created first is used to get a unique profile rule for all images.
if global.GenerateApexImage {
// Create boot images for the JIT-zygote experiment.
d.otherImages = append(d.otherImages, buildBootImage(ctx, apexBootImageConfig(ctx)))
d.defaultBootImage = buildBootImage(ctx, apexBootImageConfig(ctx))
d.otherImages = append(d.otherImages, buildBootImage(ctx, frameworkBootImageConfig(ctx)))
} else {
d.defaultBootImage = buildBootImage(ctx, frameworkBootImageConfig(ctx))
}
// Create the ART boot image.
if !skipDexpreoptArtBootJars(ctx) {
d.otherImages = append(d.otherImages, buildBootImage(ctx, artBootImageConfig(ctx)))
}
dumpOatRules(ctx, d.defaultBootImage)

View File

@ -234,7 +234,7 @@ func artBootImageConfig(ctx android.PathContext) bootImageConfig {
return *genBootImageConfigs(ctx)[artBootImageName]
}
func defaultBootImageConfig(ctx android.PathContext) bootImageConfig {
func frameworkBootImageConfig(ctx android.PathContext) bootImageConfig {
return *genBootImageConfigs(ctx)[frameworkBootImageName]
}
@ -242,6 +242,14 @@ func apexBootImageConfig(ctx android.PathContext) bootImageConfig {
return *genBootImageConfigs(ctx)[apexBootImageName]
}
func defaultBootImageConfig(ctx android.PathContext) bootImageConfig {
if dexpreoptGlobalConfig(ctx).UseApexImage {
return apexBootImageConfig(ctx)
} else {
return frameworkBootImageConfig(ctx)
}
}
func defaultBootclasspath(ctx android.PathContext) []string {
return ctx.Config().OnceStringSlice(defaultBootclasspathKey, func() []string {
global := dexpreoptGlobalConfig(ctx)