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

@ -132,7 +132,7 @@ type ModuleConfig struct {
Archs []android.ArchType
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
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("${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).
FlagWithArg("--dex-location=", dexLocationArg).
FlagWithOutput("--oat-file=", odexPath).ImplicitOutput(vdexPath).

View File

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

View File

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

View File

@ -242,7 +242,7 @@ type bootImageConfig struct {
symbolsDir android.OutputPath
// Subdirectory where the image files are installed.
installSubdir string
installDirOnHost string
// A list of (location, jar) pairs for the Java modules in this image.
modules android.ConfiguredJarList
@ -273,7 +273,7 @@ type bootImageVariant struct {
dexLocationsDeps []string // for the dependency images and in this image
// Paths to image files.
images android.OutputPath // first image file
imagePathOnHost android.OutputPath // first image file
imagesDeps android.OutputPaths // all files
// Only for extensions, paths to the primary boot images.
@ -365,7 +365,7 @@ func (image *bootImageVariant) imageLocations() (imageLocations []string) {
if image.extends != nil {
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 {
@ -656,9 +656,9 @@ func buildBootImageVariant(ctx android.SingletonContext, image *bootImageVariant
arch := image.target.Arch.ArchType
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")
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")
oatLocation := dexpreopt.PathToLocation(outputPath, arch)
imagePath := outputPath.ReplaceExtension(ctx, "art")
@ -753,7 +753,7 @@ func buildBootImageVariant(ctx android.SingletonContext, image *bootImageVariant
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 unstrippedInstalls android.RuleBuilderInstalls
@ -1036,7 +1036,7 @@ func (d *dexpreoptBootJars) MakeVars(ctx android.MakeVarsContext) {
}
sfx := variant.name + suffix + "_" + variant.target.Arch.ArchType.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_BUILT_INSTALLED_"+sfx, variant.installs.String())
ctx.Strict("DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_"+sfx, variant.unstrippedInstalls.String())

View File

@ -84,7 +84,7 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
artModules := global.ArtApexJars
frameworkModules := global.BootJars.RemoveList(artModules)
artSubdir := "apex/art_boot_images/javalib"
artDirOnHost := "apex/art_boot_images/javalib"
frameworkSubdir := "system/framework"
// ART config for the primary boot image in the ART apex.
@ -92,7 +92,7 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
artCfg := bootImageConfig{
name: artBootImageName,
stem: "boot",
installSubdir: artSubdir,
installDirOnHost: artDirOnHost,
modules: artModules,
}
@ -102,7 +102,7 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
extends: &artCfg,
name: frameworkBootImageName,
stem: "boot",
installSubdir: frameworkSubdir,
installDirOnHost: frameworkSubdir,
modules: frameworkModules,
}
@ -130,11 +130,11 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
// Create target-specific variants.
for _, target := range targets {
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{
bootImageConfig: c,
target: target,
images: imageDir.Join(ctx, imageName),
imagePathOnHost: imageDir.Join(ctx, imageName),
imagesDeps: c.moduleFiles(ctx, imageDir, ".art", ".oat", ".vdex"),
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
frameworkCfg.dexPathsDeps = append(artCfg.dexPathsDeps, frameworkCfg.dexPathsDeps...)
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...)
}