Allow using updatable boot jars in dexpreopt (but don't use them yet).
This CL handles updatable boot jars in the same hacky way as we handle non-updatable boot jars: it creates a set of predefined paths to the dex jars in a global config, then traverses all modules in a singleton context, finds updatable boot jars and adds copy rules from these jars to the predefined paths. A proper way would be to register dependencies of the dexpreopted modules on the boot jars and extracting paths to dex files by walking these dependencies. Bug: 178467404 Test: lunch aosp_cf_x86_64_phone-userdebug && m Test: added new Soong test Change-Id: I87f764109315f79315d73bf43799b70eb010fc0b
This commit is contained in:
@@ -160,14 +160,17 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
|
||||
|
||||
globalSoong := dexpreopt.GetGlobalSoongConfig(ctx)
|
||||
global := dexpreopt.GetGlobalConfig(ctx)
|
||||
|
||||
isSystemServerJar := inList(ctx.ModuleName(), global.SystemServerJars)
|
||||
|
||||
bootImage := defaultBootImageConfig(ctx)
|
||||
dexFiles := bootImage.dexPathsDeps.Paths()
|
||||
// The dex locations for all Android variants are identical.
|
||||
dexLocations := bootImage.getAnyAndroidVariant().dexLocationsDeps
|
||||
if global.UseArtImage {
|
||||
bootImage = artBootImageConfig(ctx)
|
||||
}
|
||||
|
||||
// System server jars are an exception: they are dexpreopted without updatable bootclasspath.
|
||||
dexFiles, dexLocations := bcpForDexpreopt(ctx, global.PreoptWithUpdatableBcp && !isSystemServerJar)
|
||||
|
||||
targets := ctx.MultiTargets()
|
||||
if len(targets) == 0 {
|
||||
// assume this is a java library, dexpreopt for all arches for now
|
||||
@@ -176,7 +179,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
|
||||
targets = append(targets, target)
|
||||
}
|
||||
}
|
||||
if inList(ctx.ModuleName(), global.SystemServerJars) && !d.isSDKLibrary {
|
||||
if isSystemServerJar && !d.isSDKLibrary {
|
||||
// If the module is not an SDK library and it's a system server jar, only preopt the primary arch.
|
||||
targets = targets[:1]
|
||||
}
|
||||
@@ -237,7 +240,7 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
|
||||
DexPreoptImagesDeps: imagesDeps,
|
||||
DexPreoptImageLocations: imageLocations,
|
||||
|
||||
PreoptBootClassPathDexFiles: dexFiles,
|
||||
PreoptBootClassPathDexFiles: dexFiles.Paths(),
|
||||
PreoptBootClassPathDexLocations: dexLocations,
|
||||
|
||||
PreoptExtractedApk: false,
|
||||
|
Reference in New Issue
Block a user