aboutsummaryrefslogtreecommitdiffstats
path: root/java/dexpreopt_config.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2019-05-08 15:18:22 -0700
committerColin Cross <ccross@android.com>2019-05-08 22:26:14 +0000
commitc11e0c5a39d71301cafe8cd5efd4c5f204c78d70 (patch)
treef4efd1b3f7e8ebaf3d72835be768dfc3507b7171 /java/dexpreopt_config.go
parent082640d6ee836bd440b7bf7794d8cf520b1e089f (diff)
downloadbuild_soong-c11e0c5a39d71301cafe8cd5efd4c5f204c78d70.tar.gz
build_soong-c11e0c5a39d71301cafe8cd5efd4c5f204c78d70.tar.bz2
build_soong-c11e0c5a39d71301cafe8cd5efd4c5f204c78d70.zip
Fix dangling rules on aosp_cf_x86_phone
aosp_cf_x86_phone uses SecondArchIsTranslated, which was leaving a dangling rule from the oatdump rules to out/soong/vsoc_x86/dex_bootjars/system/framework/arm/boot.art. Consolidate the code to select targets for dexpreopting and use it in more places to prevent references to boot images that were not generated. Test: m checkbuild Change-Id: Ia4945a99ff5e575e759299106559c85f38489acc
Diffstat (limited to 'java/dexpreopt_config.go')
-rw-r--r--java/dexpreopt_config.go27
1 files changed, 25 insertions, 2 deletions
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index a0b1ea59..270fcb47 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -72,6 +72,23 @@ func systemServerClasspath(ctx android.PathContext) []string {
var systemServerClasspathKey = android.NewOnceKey("systemServerClasspath")
+// dexpreoptTargets returns the list of targets that are relevant to dexpreopting, which excludes architectures
+// supported through native bridge.
+func dexpreoptTargets(ctx android.PathContext) []android.Target {
+ var targets []android.Target
+ for i, target := range ctx.Config().Targets[android.Android] {
+ if ctx.Config().SecondArchIsTranslated() && i > 0 {
+ break
+ }
+
+ if target.NativeBridge == android.NativeBridgeDisabled {
+ targets = append(targets, target)
+ }
+ }
+
+ return targets
+}
+
// defaultBootImageConfig returns the bootImageConfig that will be used to dexpreopt modules. It is computed once the
// first time it is called for any ctx.Config(), and returns the same slice for all future calls with the same
// ctx.Config().
@@ -113,7 +130,9 @@ func defaultBootImageConfig(ctx android.PathContext) bootImageConfig {
images := make(map[android.ArchType]android.OutputPath)
zip := dir.Join(ctx, "boot.zip")
- for _, target := range ctx.Config().Targets[android.Android] {
+ targets := dexpreoptTargets(ctx)
+
+ for _, target := range targets {
images[target.Arch.ArchType] = dir.Join(ctx,
"system/framework", target.Arch.ArchType.String()).Join(ctx, "boot.art")
}
@@ -126,6 +145,7 @@ func defaultBootImageConfig(ctx android.PathContext) bootImageConfig {
dir: dir,
symbolsDir: symbolsDir,
images: images,
+ targets: targets,
zip: zip,
}
}).(bootImageConfig)
@@ -168,7 +188,9 @@ func apexBootImageConfig(ctx android.PathContext) bootImageConfig {
symbolsDir := android.PathForOutput(ctx, ctx.Config().DeviceName(), "dex_apexjars_unstripped")
images := make(map[android.ArchType]android.OutputPath)
- for _, target := range ctx.Config().Targets[android.Android] {
+ targets := dexpreoptTargets(ctx)
+
+ for _, target := range targets {
images[target.Arch.ArchType] = dir.Join(ctx,
"system/framework", target.Arch.ArchType.String(), "apex.art")
}
@@ -180,6 +202,7 @@ func apexBootImageConfig(ctx android.PathContext) bootImageConfig {
dexPaths: bootDexPaths,
dir: dir,
symbolsDir: symbolsDir,
+ targets: targets,
images: images,
}
}).(bootImageConfig)