From 47932935e94adfac8a8a40fca74f45c5a70f82f7 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Thu, 29 Apr 2021 11:46:29 +0100 Subject: [PATCH] Separate storing config for MakeVars from building boot image Previously, the initialization of the dexpreoptBootJars fields used to store information needed in its MakeVars method was interleaved with the calls to buildBootImage(). In fact those fields were initialized from the *bootImageConfig returned by buildBootImage(). However, the method simply returned the *bootImageConfig value that was passed in. Separating the initialization from the calls to buildBootImage() allows the functionality to be moved to platform_bootclasspath separately. Bug: 177892522 Test: m nothing Change-Id: I8ba460f60be553516de5f186e14377bb0ec1b2cd --- java/dexpreopt_bootjars.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index 0a324a9a0..a639d2808 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -431,11 +431,15 @@ func (d *dexpreoptBootJars) GenerateSingletonBuildActions(ctx android.SingletonC defaultImageConfig := defaultBootImageConfig(ctx) profile := bootImageProfileRule(ctx, defaultImageConfig) - // Create the default boot image. - d.defaultBootImage = buildBootImage(ctx, defaultImageConfig, profile) + d.defaultBootImage = defaultImageConfig + artBootImageConfig := artBootImageConfig(ctx) + d.otherImages = []*bootImageConfig{artBootImageConfig} + + // Create the default boot image (build artifacts are accessed via the global boot image config). + buildBootImage(ctx, defaultImageConfig, profile) // 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), profile)) + buildBootImage(ctx, artBootImageConfig, profile) } // shouldBuildBootImages determines whether boot images should be built. @@ -503,7 +507,7 @@ func copyBootJarsToPredefinedLocations(ctx android.ModuleContext, bootModules [] } // buildBootImage takes a bootImageConfig, creates rules to build it, and returns the image. -func buildBootImage(ctx android.SingletonContext, image *bootImageConfig, profile android.WritablePath) *bootImageConfig { +func buildBootImage(ctx android.SingletonContext, image *bootImageConfig, profile android.WritablePath) { var zipFiles android.Paths for _, variant := range image.variants { files := buildBootImageVariant(ctx, variant, profile) @@ -522,8 +526,6 @@ func buildBootImage(ctx android.SingletonContext, image *bootImageConfig, profil rule.Build("zip_"+image.name, "zip "+image.name+" image") } - - return image } // Generate boot image build rules for a specific target.