From a596909342e7751f3c710efc26f2c5fe5a84ced0 Mon Sep 17 00:00:00 2001 From: Jeongik Cha Date: Fri, 7 May 2021 18:53:21 +0900 Subject: [PATCH] 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 --- dexpreopt/config.go | 6 +++--- dexpreopt/dexpreopt.go | 2 +- dexpreopt/dexpreopt_test.go | 2 +- java/dexpreopt.go | 10 +++++----- java/dexpreopt_bootjars.go | 16 ++++++++-------- java/dexpreopt_config.go | 26 +++++++++++++------------- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/dexpreopt/config.go b/dexpreopt/config.go index 8a656ed51..7a4186137 100644 --- a/dexpreopt/config.go +++ b/dexpreopt/config.go @@ -130,9 +130,9 @@ type ModuleConfig struct { ProvidesUsesLibrary string // library name (usually the same as module name) ClassLoaderContexts ClassLoaderContextMap - Archs []android.ArchType - DexPreoptImagesDeps []android.OutputPaths - DexPreoptImageLocations []string + Archs []android.ArchType + DexPreoptImagesDeps []android.OutputPaths + 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 diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go index 3848205d8..84e486fc8 100644 --- a/dexpreopt/dexpreopt.go +++ b/dexpreopt/dexpreopt.go @@ -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). diff --git a/dexpreopt/dexpreopt_test.go b/dexpreopt/dexpreopt_test.go index bb4e80e1a..4ee61b6b0 100644 --- a/dexpreopt/dexpreopt_test.go +++ b/dexpreopt/dexpreopt_test.go @@ -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, diff --git a/java/dexpreopt.go b/java/dexpreopt.go index 0020a2d92..ef3ca2c35 100644 --- a/java/dexpreopt.go +++ b/java/dexpreopt.go @@ -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 @@ -224,9 +224,9 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr ProvidesUsesLibrary: providesUsesLib, ClassLoaderContexts: d.classLoaderContexts, - Archs: archs, - DexPreoptImagesDeps: imagesDeps, - DexPreoptImageLocations: imageLocations, + Archs: archs, + DexPreoptImagesDeps: imagesDeps, + DexPreoptImageLocationsOnHost: hostImageLocations, PreoptBootClassPathDexFiles: dexFiles.Paths(), PreoptBootClassPathDexLocations: dexLocations, diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index f85e1c97e..19d10756a 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -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,8 +273,8 @@ type bootImageVariant struct { dexLocationsDeps []string // for the dependency images and in this image // Paths to image files. - images android.OutputPath // first image file - imagesDeps android.OutputPaths // all files + imagePathOnHost android.OutputPath // first image file + imagesDeps android.OutputPaths // all files // Only for extensions, paths to the primary boot images. primaryImages android.OutputPath @@ -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()) diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go index 0ab650287..9eb3f4924 100644 --- a/java/dexpreopt_config.go +++ b/java/dexpreopt_config.go @@ -84,26 +84,26 @@ 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. // It includes the Core Libraries. artCfg := bootImageConfig{ - name: artBootImageName, - stem: "boot", - installSubdir: artSubdir, - modules: artModules, + name: artBootImageName, + stem: "boot", + installDirOnHost: artDirOnHost, + modules: artModules, } // Framework config for the boot image extension. // It includes framework libraries and depends on the ART config. frameworkCfg := bootImageConfig{ - extends: &artCfg, - name: frameworkBootImageName, - stem: "boot", - installSubdir: frameworkSubdir, - modules: frameworkModules, + extends: &artCfg, + name: frameworkBootImageName, + stem: "boot", + installDirOnHost: frameworkSubdir, + modules: frameworkModules, } configs := map[string]*bootImageConfig{ @@ -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...) }