Expand the dexpreopt image dependencies to entire image

Instead of just depending on the main .art file (boot.art, etc), also
expose the dependencies to the .oat/.vdex files (boot.oat/boot.vdex),
and all of the module files that get implicitly loading (boot-ext.*,
boot-framework.*, etc)

This is necessary for RBE, where the rule only gets the files that it
depends upon.

Test: treehugger
Test: build a system image with RBE
Change-Id: I0c7051f18582f1891d3398b46763b1521e4326c8
This commit is contained in:
Dan Willemsen
2019-06-13 21:44:53 +00:00
parent ff60a73d89
commit 0f41678d00
6 changed files with 85 additions and 47 deletions

View File

@@ -121,8 +121,9 @@ type ModuleConfig struct {
UsesLibraries []string
LibraryPaths map[string]android.Path
Archs []android.ArchType
DexPreoptImages []android.Path
Archs []android.ArchType
DexPreoptImages []android.Path
DexPreoptImagesDeps []android.Paths
PreoptBootClassPathDexFiles android.Paths // file paths of boot class path files
PreoptBootClassPathDexLocations []string // virtual locations of boot class path files
@@ -257,6 +258,9 @@ func LoadModuleConfig(ctx android.PathContext, path string) (ModuleConfig, error
config.ModuleConfig.StripInputPath = constructPath(ctx, config.StripInputPath)
config.ModuleConfig.StripOutputPath = constructWritablePath(ctx, config.StripOutputPath)
// 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))
return config.ModuleConfig, nil
}

View File

@@ -125,7 +125,8 @@ func GenerateDexpreoptRule(ctx android.PathContext,
for i, arch := range module.Archs {
image := module.DexPreoptImages[i]
dexpreoptCommand(ctx, global, module, rule, arch, profile, image, appImage, generateDM)
imageDeps := module.DexPreoptImagesDeps[i]
dexpreoptCommand(ctx, global, module, rule, arch, profile, image, imageDeps, appImage, generateDM)
}
}
}
@@ -190,7 +191,7 @@ func profileCommand(ctx android.PathContext, global GlobalConfig, module ModuleC
}
func dexpreoptCommand(ctx android.PathContext, global GlobalConfig, module ModuleConfig, rule *android.RuleBuilder,
arch android.ArchType, profile, bootImage android.Path, appImage, generateDM bool) {
arch android.ArchType, profile, bootImage android.Path, bootImageDeps android.Paths, appImage, generateDM bool) {
// HACK: make soname in Soong-generated .odex files match Make.
base := filepath.Base(module.DexLocation)
@@ -353,7 +354,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).Implicit(bootImage).
FlagWithArg("--boot-image=", bootImageLocation).Implicits(bootImageDeps).
FlagWithInput("--dex-file=", module.DexPath).
FlagWithArg("--dex-location=", dexLocationArg).
FlagWithOutput("--oat-file=", odexPath).ImplicitOutput(vdexPath).

View File

@@ -38,6 +38,7 @@ func testModuleConfig(ctx android.PathContext) ModuleConfig {
LibraryPaths: nil,
Archs: []android.ArchType{android.Arm},
DexPreoptImages: android.Paths{android.PathForTesting("system/framework/arm/boot.art")},
DexPreoptImagesDeps: []android.Paths{android.Paths{}},
PreoptBootClassPathDexFiles: nil,
PreoptBootClassPathDexLocations: nil,
PreoptExtractedApk: false,