aboutsummaryrefslogtreecommitdiffstats
path: root/dexpreopt
diff options
context:
space:
mode:
Diffstat (limited to 'dexpreopt')
-rw-r--r--dexpreopt/config.go13
-rw-r--r--dexpreopt/dexpreopt.go23
-rw-r--r--dexpreopt/dexpreopt_test.go3
3 files changed, 18 insertions, 21 deletions
diff --git a/dexpreopt/config.go b/dexpreopt/config.go
index 35c2b44a..83e36737 100644
--- a/dexpreopt/config.go
+++ b/dexpreopt/config.go
@@ -41,7 +41,7 @@ type GlobalConfig struct {
BootJars []string // modules for jars that form the boot class path
UpdatableBootJars []string // jars within apex that form the boot class path
- ArtApexJars []string // modules for jars that are in the ART APEX
+ ArtApexJars []string // modules for jars that are in the ART APEX
SystemServerJars []string // jars that form the system server
SystemServerApps []string // apps that are loaded into system server
@@ -117,9 +117,10 @@ type ModuleConfig struct {
UsesLibraries []string
LibraryPaths map[string]android.Path
- Archs []android.ArchType
- DexPreoptImages []android.Path
- DexPreoptImagesDeps []android.Paths
+ Archs []android.ArchType
+ DexPreoptImages []android.Path
+ DexPreoptImagesDeps []android.OutputPaths
+ DexPreoptImageLocations []string
PreoptBootClassPathDexFiles android.Paths // file paths of boot class path files
PreoptBootClassPathDexLocations []string // virtual locations of boot class path files
@@ -225,6 +226,7 @@ func LoadModuleConfig(ctx android.PathContext, path string) (ModuleConfig, error
ProfileClassListing string
LibraryPaths map[string]string
DexPreoptImages []string
+ DexPreoptImageLocations []string
PreoptBootClassPathDexFiles []string
}
@@ -242,10 +244,11 @@ func LoadModuleConfig(ctx android.PathContext, path string) (ModuleConfig, error
config.ModuleConfig.ProfileClassListing = android.OptionalPathForPath(constructPath(ctx, config.ProfileClassListing))
config.ModuleConfig.LibraryPaths = constructPathMap(ctx, config.LibraryPaths)
config.ModuleConfig.DexPreoptImages = constructPaths(ctx, config.DexPreoptImages)
+ config.ModuleConfig.DexPreoptImageLocations = config.DexPreoptImageLocations
config.ModuleConfig.PreoptBootClassPathDexFiles = constructPaths(ctx, config.PreoptBootClassPathDexFiles)
// This needs to exist, but dependencies are already handled in Make, so we don't need to pass them through JSON.
- config.ModuleConfig.DexPreoptImagesDeps = make([]android.Paths, len(config.ModuleConfig.DexPreoptImages))
+ config.ModuleConfig.DexPreoptImagesDeps = make([]android.OutputPaths, len(config.ModuleConfig.DexPreoptImages))
return config.ModuleConfig, nil
}
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index f3bf2ff8..40986c34 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -86,10 +86,8 @@ func GenerateDexpreoptRule(ctx android.PathContext,
generateDM := shouldGenerateDM(module, global)
- for i, arch := range module.Archs {
- image := module.DexPreoptImages[i]
- imageDeps := module.DexPreoptImagesDeps[i]
- dexpreoptCommand(ctx, global, module, rule, arch, profile, image, imageDeps, appImage, generateDM)
+ for archIdx, _ := range module.Archs {
+ dexpreoptCommand(ctx, global, module, rule, archIdx, profile, appImage, generateDM)
}
}
}
@@ -193,7 +191,9 @@ func bootProfileCommand(ctx android.PathContext, global GlobalConfig, module Mod
}
func dexpreoptCommand(ctx android.PathContext, global GlobalConfig, module ModuleConfig, rule *android.RuleBuilder,
- arch android.ArchType, profile, bootImage android.Path, bootImageDeps android.Paths, appImage, generateDM bool) {
+ archIdx int, profile android.WritablePath, appImage bool, generateDM bool) {
+
+ arch := module.Archs[archIdx]
// HACK: make soname in Soong-generated .odex files match Make.
base := filepath.Base(module.DexLocation)
@@ -222,13 +222,6 @@ func dexpreoptCommand(ctx android.PathContext, global GlobalConfig, module Modul
invocationPath := odexPath.ReplaceExtension(ctx, "invocation")
- // bootImage is .../dex_bootjars/system/framework/arm64/boot.art, but dex2oat wants
- // .../dex_bootjars/system/framework/boot.art on the command line
- var bootImageLocation string
- if bootImage != nil {
- bootImageLocation = PathToLocation(bootImage, arch)
- }
-
// The class loader context using paths in the build
var classLoaderContextHost android.Paths
@@ -356,7 +349,7 @@ func dexpreoptCommand(ctx android.PathContext, global GlobalConfig, module Modul
Flag("--runtime-arg").FlagWithList("-Xbootclasspath-locations:", module.PreoptBootClassPathDexLocations, ":").
Flag("${class_loader_context_arg}").
Flag("${stored_class_loader_context_arg}").
- FlagWithArg("--boot-image=", bootImageLocation).Implicits(bootImageDeps).
+ FlagWithArg("--boot-image=", strings.Join(module.DexPreoptImageLocations, ":")).Implicits(module.DexPreoptImagesDeps[archIdx].Paths()).
FlagWithInput("--dex-file=", module.DexPath).
FlagWithArg("--dex-location=", dexLocationArg).
FlagWithOutput("--oat-file=", odexPath).ImplicitOutput(vdexPath).
@@ -555,9 +548,9 @@ func SplitApexJarPair(apexJarValue string) (string, string) {
}
// Expected format for apexJarValue = <apex name>:<jar name>
-func GetJarLocationFromApexJarPair(apexJarValue string) (string) {
+func GetJarLocationFromApexJarPair(apexJarValue string) string {
apex, jar := SplitApexJarPair(apexJarValue)
- return filepath.Join("/apex", apex, "javalib", jar + ".jar")
+ return filepath.Join("/apex", apex, "javalib", jar+".jar")
}
func contains(l []string, s string) bool {
diff --git a/dexpreopt/dexpreopt_test.go b/dexpreopt/dexpreopt_test.go
index 6f8120ee..254be0aa 100644
--- a/dexpreopt/dexpreopt_test.go
+++ b/dexpreopt/dexpreopt_test.go
@@ -49,7 +49,8 @@ func testModuleConfig(ctx android.PathContext, name, partition string) ModuleCon
LibraryPaths: nil,
Archs: []android.ArchType{android.Arm},
DexPreoptImages: android.Paths{android.PathForTesting("system/framework/arm/boot.art")},
- DexPreoptImagesDeps: []android.Paths{android.Paths{}},
+ DexPreoptImagesDeps: []android.OutputPaths{android.OutputPaths{}},
+ DexPreoptImageLocations: []string{},
PreoptBootClassPathDexFiles: nil,
PreoptBootClassPathDexLocations: nil,
PreoptExtractedApk: false,