Rename fields in dexpreopt config

Add 'host' into the name of fields regarding path on the host side to
distinguish between paths on the device(which will be added in the
following commit), and paths on the host.

Bug: 158843648
Test: build and flash, and then
  adb wait-for-device \
    && adb -s $S root \
    && adb -s $S logcat \
    | grep -E 'ClassLoaderContext [a-z ]+ mismatch' -C 1
Change-Id: Ib2645ed51591ba2f4b726c115b401ad2bd6675da
This commit is contained in:
Jeongik Cha 2021-05-07 18:53:21 +09:00
parent 882bcc1c1c
commit a596909342
6 changed files with 31 additions and 31 deletions

View File

@ -130,9 +130,9 @@ type ModuleConfig struct {
ProvidesUsesLibrary string // library name (usually the same as module name) ProvidesUsesLibrary string // library name (usually the same as module name)
ClassLoaderContexts ClassLoaderContextMap ClassLoaderContexts ClassLoaderContextMap
Archs []android.ArchType Archs []android.ArchType
DexPreoptImagesDeps []android.OutputPaths DexPreoptImagesDeps []android.OutputPaths
DexPreoptImageLocations []string DexPreoptImageLocationsOnHost []string // boot image location on host (file path without the arch subdirectory)
PreoptBootClassPathDexFiles android.Paths // file paths of boot class path files PreoptBootClassPathDexFiles android.Paths // file paths of boot class path files
PreoptBootClassPathDexLocations []string // virtual locations of boot class path files PreoptBootClassPathDexLocations []string // virtual locations of boot class path files

View File

@ -328,7 +328,7 @@ func dexpreoptCommand(ctx android.PathContext, globalSoong *GlobalSoongConfig, g
Flag("--runtime-arg").FlagWithList("-Xbootclasspath-locations:", module.PreoptBootClassPathDexLocations, ":"). Flag("--runtime-arg").FlagWithList("-Xbootclasspath-locations:", module.PreoptBootClassPathDexLocations, ":").
Flag("${class_loader_context_arg}"). Flag("${class_loader_context_arg}").
Flag("${stored_class_loader_context_arg}"). Flag("${stored_class_loader_context_arg}").
FlagWithArg("--boot-image=", strings.Join(module.DexPreoptImageLocations, ":")).Implicits(module.DexPreoptImagesDeps[archIdx].Paths()). FlagWithArg("--boot-image=", strings.Join(module.DexPreoptImageLocationsOnHost, ":")).Implicits(module.DexPreoptImagesDeps[archIdx].Paths()).
FlagWithInput("--dex-file=", module.DexPath). FlagWithInput("--dex-file=", module.DexPath).
FlagWithArg("--dex-location=", dexLocationArg). FlagWithArg("--dex-location=", dexLocationArg).
FlagWithOutput("--oat-file=", odexPath).ImplicitOutput(vdexPath). FlagWithOutput("--oat-file=", odexPath).ImplicitOutput(vdexPath).

View File

@ -48,7 +48,7 @@ func testModuleConfig(ctx android.PathContext, name, partition string) *ModuleCo
ClassLoaderContexts: nil, ClassLoaderContexts: nil,
Archs: []android.ArchType{android.Arm}, Archs: []android.ArchType{android.Arm},
DexPreoptImagesDeps: []android.OutputPaths{android.OutputPaths{}}, DexPreoptImagesDeps: []android.OutputPaths{android.OutputPaths{}},
DexPreoptImageLocations: []string{}, DexPreoptImageLocationsOnHost: []string{},
PreoptBootClassPathDexFiles: nil, PreoptBootClassPathDexFiles: nil,
PreoptBootClassPathDexLocations: nil, PreoptBootClassPathDexLocations: nil,
PreoptExtractedApk: false, PreoptExtractedApk: false,

View File

@ -180,11 +180,11 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
for _, target := range targets { for _, target := range targets {
archs = append(archs, target.Arch.ArchType) archs = append(archs, target.Arch.ArchType)
variant := bootImage.getVariant(target) variant := bootImage.getVariant(target)
images = append(images, variant.images) images = append(images, variant.imagePathOnHost)
imagesDeps = append(imagesDeps, variant.imagesDeps) imagesDeps = append(imagesDeps, variant.imagesDeps)
} }
// The image locations for all Android variants are identical. // The image locations for all Android variants are identical.
imageLocations := bootImage.getAnyAndroidVariant().imageLocations() hostImageLocations := bootImage.getAnyAndroidVariant().imageLocations()
var profileClassListing android.OptionalPath var profileClassListing android.OptionalPath
var profileBootListing android.OptionalPath var profileBootListing android.OptionalPath
@ -224,9 +224,9 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
ProvidesUsesLibrary: providesUsesLib, ProvidesUsesLibrary: providesUsesLib,
ClassLoaderContexts: d.classLoaderContexts, ClassLoaderContexts: d.classLoaderContexts,
Archs: archs, Archs: archs,
DexPreoptImagesDeps: imagesDeps, DexPreoptImagesDeps: imagesDeps,
DexPreoptImageLocations: imageLocations, DexPreoptImageLocationsOnHost: hostImageLocations,
PreoptBootClassPathDexFiles: dexFiles.Paths(), PreoptBootClassPathDexFiles: dexFiles.Paths(),
PreoptBootClassPathDexLocations: dexLocations, PreoptBootClassPathDexLocations: dexLocations,

View File

@ -242,7 +242,7 @@ type bootImageConfig struct {
symbolsDir android.OutputPath symbolsDir android.OutputPath
// Subdirectory where the image files are installed. // Subdirectory where the image files are installed.
installSubdir string installDirOnHost string
// A list of (location, jar) pairs for the Java modules in this image. // A list of (location, jar) pairs for the Java modules in this image.
modules android.ConfiguredJarList modules android.ConfiguredJarList
@ -273,8 +273,8 @@ type bootImageVariant struct {
dexLocationsDeps []string // for the dependency images and in this image dexLocationsDeps []string // for the dependency images and in this image
// Paths to image files. // Paths to image files.
images android.OutputPath // first image file imagePathOnHost android.OutputPath // first image file
imagesDeps android.OutputPaths // all files imagesDeps android.OutputPaths // all files
// Only for extensions, paths to the primary boot images. // Only for extensions, paths to the primary boot images.
primaryImages android.OutputPath primaryImages android.OutputPath
@ -365,7 +365,7 @@ func (image *bootImageVariant) imageLocations() (imageLocations []string) {
if image.extends != nil { if image.extends != nil {
imageLocations = image.extends.getVariant(image.target).imageLocations() imageLocations = image.extends.getVariant(image.target).imageLocations()
} }
return append(imageLocations, dexpreopt.PathToLocation(image.images, image.target.Arch.ArchType)) return append(imageLocations, dexpreopt.PathToLocation(image.imagePathOnHost, image.target.Arch.ArchType))
} }
func dexpreoptBootJarsFactory() android.SingletonModule { func dexpreoptBootJarsFactory() android.SingletonModule {
@ -656,9 +656,9 @@ func buildBootImageVariant(ctx android.SingletonContext, image *bootImageVariant
arch := image.target.Arch.ArchType arch := image.target.Arch.ArchType
os := image.target.Os.String() // We need to distinguish host-x86 and device-x86. os := image.target.Os.String() // We need to distinguish host-x86 and device-x86.
symbolsDir := image.symbolsDir.Join(ctx, os, image.installSubdir, arch.String()) symbolsDir := image.symbolsDir.Join(ctx, os, image.installDirOnHost, arch.String())
symbolsFile := symbolsDir.Join(ctx, image.stem+".oat") symbolsFile := symbolsDir.Join(ctx, image.stem+".oat")
outputDir := image.dir.Join(ctx, os, image.installSubdir, arch.String()) outputDir := image.dir.Join(ctx, os, image.installDirOnHost, arch.String())
outputPath := outputDir.Join(ctx, image.stem+".oat") outputPath := outputDir.Join(ctx, image.stem+".oat")
oatLocation := dexpreopt.PathToLocation(outputPath, arch) oatLocation := dexpreopt.PathToLocation(outputPath, arch)
imagePath := outputPath.ReplaceExtension(ctx, "art") imagePath := outputPath.ReplaceExtension(ctx, "art")
@ -753,7 +753,7 @@ func buildBootImageVariant(ctx android.SingletonContext, image *bootImageVariant
cmd.Textf(`|| ( echo %s ; false )`, proptools.ShellEscape(failureMessage)) cmd.Textf(`|| ( echo %s ; false )`, proptools.ShellEscape(failureMessage))
installDir := filepath.Join("/", image.installSubdir, arch.String()) installDir := filepath.Join("/", image.installDirOnHost, arch.String())
var vdexInstalls android.RuleBuilderInstalls var vdexInstalls android.RuleBuilderInstalls
var unstrippedInstalls android.RuleBuilderInstalls var unstrippedInstalls android.RuleBuilderInstalls
@ -1036,7 +1036,7 @@ func (d *dexpreoptBootJars) MakeVars(ctx android.MakeVarsContext) {
} }
sfx := variant.name + suffix + "_" + variant.target.Arch.ArchType.String() sfx := variant.name + suffix + "_" + variant.target.Arch.ArchType.String()
ctx.Strict("DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_"+sfx, variant.vdexInstalls.String()) ctx.Strict("DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_"+sfx, variant.vdexInstalls.String())
ctx.Strict("DEXPREOPT_IMAGE_"+sfx, variant.images.String()) ctx.Strict("DEXPREOPT_IMAGE_"+sfx, variant.imagePathOnHost.String())
ctx.Strict("DEXPREOPT_IMAGE_DEPS_"+sfx, strings.Join(variant.imagesDeps.Strings(), " ")) ctx.Strict("DEXPREOPT_IMAGE_DEPS_"+sfx, strings.Join(variant.imagesDeps.Strings(), " "))
ctx.Strict("DEXPREOPT_IMAGE_BUILT_INSTALLED_"+sfx, variant.installs.String()) ctx.Strict("DEXPREOPT_IMAGE_BUILT_INSTALLED_"+sfx, variant.installs.String())
ctx.Strict("DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_"+sfx, variant.unstrippedInstalls.String()) ctx.Strict("DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_"+sfx, variant.unstrippedInstalls.String())

View File

@ -84,26 +84,26 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
artModules := global.ArtApexJars artModules := global.ArtApexJars
frameworkModules := global.BootJars.RemoveList(artModules) frameworkModules := global.BootJars.RemoveList(artModules)
artSubdir := "apex/art_boot_images/javalib" artDirOnHost := "apex/art_boot_images/javalib"
frameworkSubdir := "system/framework" frameworkSubdir := "system/framework"
// ART config for the primary boot image in the ART apex. // ART config for the primary boot image in the ART apex.
// It includes the Core Libraries. // It includes the Core Libraries.
artCfg := bootImageConfig{ artCfg := bootImageConfig{
name: artBootImageName, name: artBootImageName,
stem: "boot", stem: "boot",
installSubdir: artSubdir, installDirOnHost: artDirOnHost,
modules: artModules, modules: artModules,
} }
// Framework config for the boot image extension. // Framework config for the boot image extension.
// It includes framework libraries and depends on the ART config. // It includes framework libraries and depends on the ART config.
frameworkCfg := bootImageConfig{ frameworkCfg := bootImageConfig{
extends: &artCfg, extends: &artCfg,
name: frameworkBootImageName, name: frameworkBootImageName,
stem: "boot", stem: "boot",
installSubdir: frameworkSubdir, installDirOnHost: frameworkSubdir,
modules: frameworkModules, modules: frameworkModules,
} }
configs := map[string]*bootImageConfig{ configs := map[string]*bootImageConfig{
@ -130,11 +130,11 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
// Create target-specific variants. // Create target-specific variants.
for _, target := range targets { for _, target := range targets {
arch := target.Arch.ArchType arch := target.Arch.ArchType
imageDir := c.dir.Join(ctx, target.Os.String(), c.installSubdir, arch.String()) imageDir := c.dir.Join(ctx, target.Os.String(), c.installDirOnHost, arch.String())
variant := &bootImageVariant{ variant := &bootImageVariant{
bootImageConfig: c, bootImageConfig: c,
target: target, target: target,
images: imageDir.Join(ctx, imageName), imagePathOnHost: imageDir.Join(ctx, imageName),
imagesDeps: c.moduleFiles(ctx, imageDir, ".art", ".oat", ".vdex"), imagesDeps: c.moduleFiles(ctx, imageDir, ".art", ".oat", ".vdex"),
dexLocations: c.modules.DevicePaths(ctx.Config(), target.Os), dexLocations: c.modules.DevicePaths(ctx.Config(), target.Os),
} }
@ -148,7 +148,7 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
// specific to the framework config // specific to the framework config
frameworkCfg.dexPathsDeps = append(artCfg.dexPathsDeps, frameworkCfg.dexPathsDeps...) frameworkCfg.dexPathsDeps = append(artCfg.dexPathsDeps, frameworkCfg.dexPathsDeps...)
for i := range targets { for i := range targets {
frameworkCfg.variants[i].primaryImages = artCfg.variants[i].images frameworkCfg.variants[i].primaryImages = artCfg.variants[i].imagePathOnHost
frameworkCfg.variants[i].dexLocationsDeps = append(artCfg.variants[i].dexLocations, frameworkCfg.variants[i].dexLocationsDeps...) frameworkCfg.variants[i].dexLocationsDeps = append(artCfg.variants[i].dexLocations, frameworkCfg.variants[i].dexLocationsDeps...)
} }