Merge "Ensure primary boot image files are created before they are used" am: a11b8707f1

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1731413

Change-Id: I4d5c86d67488e8892ccf0c7237177040448703ef
This commit is contained in:
Paul Duffin
2021-06-14 08:19:18 +00:00
committed by Automerger Merge Worker
2 changed files with 25 additions and 5 deletions

View File

@@ -278,11 +278,22 @@ type bootImageVariant struct {
// Paths to image files.
imagePathOnHost android.OutputPath // first image file path on host
imagePathOnDevice string // first image file path on device
imagesDeps android.OutputPaths // all files
// Only for extensions, paths to the primary boot images.
// All the files that constitute this image variant, i.e. .art, .oat and .vdex files.
imagesDeps android.OutputPaths
// The path to the primary image variant's imagePathOnHost field, where primary image variant
// means the image variant that this extends.
//
// This is only set for a variant of an image that extends another image.
primaryImages android.OutputPath
// The paths to the primary image variant's imagesDeps field, where primary image variant
// means the image variant that this extends.
//
// This is only set for a variant of an image that extends another image.
primaryImagesDeps android.Paths
// Rules which should be used in make to install the outputs.
installs android.RuleBuilderInstalls
vdexInstalls android.RuleBuilderInstalls
@@ -588,7 +599,15 @@ func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, p
cmd.
Flag("--runtime-arg").FlagWithInputList("-Xbootclasspath:", image.dexPathsDeps.Paths(), ":").
Flag("--runtime-arg").FlagWithList("-Xbootclasspath-locations:", image.dexLocationsDeps, ":").
FlagWithArg("--boot-image=", dexpreopt.PathToLocation(artImage, arch)).Implicit(artImage)
// Add the path to the first file in the boot image with the arch specific directory removed,
// dex2oat will reconstruct the path to the actual file when it needs it. As the actual path
// to the file cannot be passed to the command make sure to add the actual path as an Implicit
// dependency to ensure that it is built before the command runs.
FlagWithArg("--boot-image=", dexpreopt.PathToLocation(artImage, arch)).Implicit(artImage).
// Similarly, the dex2oat tool will automatically find the paths to other files in the base
// boot image so make sure to add them as implicit dependencies to ensure that they are built
// before this command is run.
Implicits(image.primaryImagesDeps)
} else {
// It is a primary image, so it needs a base address.
cmd.FlagWithArg("--base=", ctx.Config().LibartImgDeviceBaseAddress())

View File

@@ -125,6 +125,7 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
frameworkCfg.dexPathsDeps = append(artCfg.dexPathsDeps, frameworkCfg.dexPathsDeps...)
for i := range targets {
frameworkCfg.variants[i].primaryImages = artCfg.variants[i].imagePathOnHost
frameworkCfg.variants[i].primaryImagesDeps = artCfg.variants[i].imagesDeps.Paths()
frameworkCfg.variants[i].dexLocationsDeps = append(artCfg.variants[i].dexLocations, frameworkCfg.variants[i].dexLocationsDeps...)
}