diff options
author | 2023-11-08 12:07:32 +0000 | |
---|---|---|
committer | 2023-11-08 12:07:32 +0000 | |
commit | 77d4619b1b9c68b39fc9ccb77ef97a198ca47d0a (patch) | |
tree | 16fe7c0d9d2a646552897c58d563430a9ed22460 /java | |
parent | ab748699a2b3137a2859533e9ab39638f445c4d0 (diff) | |
parent | 7dbbbd43ba7145b1168f8a955eb38aa4e16ccb47 (diff) |
Merge "Use the correct mainline BCP jars for app dexpreopt." into main am: 04445d5443 am: f3c1e6f8fe am: 7dbbbd43ba
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2816578
Change-Id: I437d8e0f093fb79778c82507ba2207d3888e994a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'java')
-rw-r--r-- | java/dexpreopt_config.go | 47 | ||||
-rw-r--r-- | java/platform_bootclasspath.go | 9 |
2 files changed, 4 insertions, 52 deletions
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go index 29551efcc..2bd696c3d 100644 --- a/java/dexpreopt_config.go +++ b/java/dexpreopt_config.go @@ -210,57 +210,18 @@ func isProfileProviderApex(ctx android.PathContext, apexName string) bool { return false } -// Apex boot config allows to access build/install paths of apex boot jars without going -// through the usual trouble of registering dependencies on those modules and extracting build paths -// from those dependencies. -type apexBootConfig struct { - // A list of apex boot jars. - modules android.ConfiguredJarList - - // A list of predefined build paths to apex boot jars. They are configured very early, - // before the modules for these jars are processed and the actual paths are generated, and - // later on a singleton adds commands to copy actual jars to the predefined paths. - dexPaths android.WritablePaths - - // Map from module name (without prebuilt_ prefix) to the predefined build path. - dexPathsByModule map[string]android.WritablePath - - // A list of dex locations (a.k.a. on-device paths) to the boot jars. - dexLocations []string -} - -var updatableBootConfigKey = android.NewOnceKey("apexBootConfig") - -// Returns apex boot config. -func GetApexBootConfig(ctx android.PathContext) apexBootConfig { - return ctx.Config().Once(updatableBootConfigKey, func() interface{} { - apexBootJars := dexpreopt.GetGlobalConfig(ctx).ApexBootJars - dir := android.PathForOutput(ctx, getDexpreoptDirName(ctx), "apex_bootjars") - dexPaths := apexBootJars.BuildPaths(ctx, dir) - dexPathsByModuleName := apexBootJars.BuildPathsByModule(ctx, dir) - - dexLocations := apexBootJars.DevicePaths(ctx.Config(), android.Android) - - return apexBootConfig{apexBootJars, dexPaths, dexPathsByModuleName, dexLocations} - }).(apexBootConfig) -} - // Returns a list of paths and a list of locations for the boot jars used in dexpreopt (to be // passed in -Xbootclasspath and -Xbootclasspath-locations arguments for dex2oat). func bcpForDexpreopt(ctx android.PathContext, withUpdatable bool) (android.WritablePaths, []string) { - // Non-updatable boot jars (they are used both in the boot image and in dexpreopt). bootImage := defaultBootImageConfig(ctx) + if withUpdatable { + bootImage = mainlineBootImageConfig(ctx) + } + dexPaths := bootImage.dexPathsDeps // The dex locations for all Android variants are identical. dexLocations := bootImage.getAnyAndroidVariant().dexLocationsDeps - if withUpdatable { - // Apex boot jars (they are used only in dexpreopt, but not in the boot image). - apexBootConfig := GetApexBootConfig(ctx) - dexPaths = append(dexPaths, apexBootConfig.dexPaths...) - dexLocations = append(dexLocations, apexBootConfig.dexLocations...) - } - return dexPaths, dexLocations } diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go index 02a2298cd..0d52614ea 100644 --- a/java/platform_bootclasspath.go +++ b/java/platform_bootclasspath.go @@ -202,8 +202,6 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo bootDexJarByModule := b.generateHiddenAPIBuildActions(ctx, b.configuredModules, b.fragments) buildRuleForBootJarsPackageCheck(ctx, bootDexJarByModule) - - b.copyApexBootJarsForAppsDexpreopt(ctx, apexModules) } // Generate classpaths.proto config @@ -415,10 +413,3 @@ func (b *platformBootclasspathModule) generateHiddenApiMakeVars(ctx android.Make // INTERNAL_PLATFORM_HIDDENAPI_FLAGS is used by Make rules in art/ and cts/. ctx.Strict("INTERNAL_PLATFORM_HIDDENAPI_FLAGS", b.hiddenAPIFlagsCSV.String()) } - -// Copy apex module dex jars to their predefined locations. They will be used for dexpreopt for apps. -func (b *platformBootclasspathModule) copyApexBootJarsForAppsDexpreopt(ctx android.ModuleContext, apexModules []android.Module) { - config := GetApexBootConfig(ctx) - apexBootDexJarsByModule := extractEncodedDexJarsFromModules(ctx, apexModules) - copyBootJarsToPredefinedLocations(ctx, apexBootDexJarsByModule, config.dexPathsByModule) -} |