summaryrefslogtreecommitdiff
path: root/java/dexpreopt_bootjars.go
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2023-05-12 14:54:12 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-05-12 14:54:12 +0000
commit8ad11c769702ad612873d565b51cb15d28486e72 (patch)
treeacff01cb4973d47899685e18ff955982b56e5b76 /java/dexpreopt_bootjars.go
parent8922cd21b60d0a794832e582417af6b0fa548b1b (diff)
parenta0a45671a680944d4f45a8f47a9307424b7ca63e (diff)
Dexpreopt ART jars and framework jars together. am: 5f5a17fd6b am: a0a45671a6
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23208462 Change-Id: I28df1bfaa1bea200204c6efa930c3cee4175c72f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'java/dexpreopt_bootjars.go')
-rw-r--r--java/dexpreopt_bootjars.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 792fa6396..f477f404e 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -295,6 +295,11 @@ type bootImageConfig struct {
// The "--single-image" argument.
singleImage bool
+
+ // Profiles imported from other boot image configs. Each element must represent a
+ // `bootclasspath_fragment` of an APEX (i.e., the `name` field of each element must refer to the
+ // `image_name` property of a `bootclasspath_fragment`).
+ profileImports []*bootImageConfig
}
// Target-dependent description of a boot image.
@@ -711,6 +716,34 @@ func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, p
cmd.FlagWithInput("--profile-file=", profile)
}
+ fragments := make(map[string]commonBootclasspathFragment)
+ ctx.VisitDirectDepsWithTag(bootclasspathFragmentDepTag, func(child android.Module) {
+ fragment := child.(commonBootclasspathFragment)
+ if fragment.getImageName() != nil && android.IsModulePreferred(child) {
+ fragments[*fragment.getImageName()] = fragment
+ }
+ })
+
+ for _, profileImport := range image.profileImports {
+ fragment := fragments[profileImport.name]
+ if fragment == nil {
+ ctx.ModuleErrorf("Boot image config '%[1]s' imports profile from '%[2]s', but a "+
+ "bootclasspath_fragment with image name '%[2]s' doesn't exist or is not added as a "+
+ "dependency of '%[1]s'",
+ image.name,
+ profileImport.name)
+ return bootImageVariantOutputs{}
+ }
+ if fragment.getProfilePath() == nil {
+ ctx.ModuleErrorf("Boot image config '%[1]s' imports profile from '%[2]s', but '%[2]s' "+
+ "doesn't provide a profile",
+ image.name,
+ profileImport.name)
+ return bootImageVariantOutputs{}
+ }
+ cmd.FlagWithInput("--profile-file=", fragment.getProfilePath())
+ }
+
dirtyImageFile := "frameworks/base/config/dirty-image-objects"
dirtyImagePath := android.ExistentPathForSource(ctx, dirtyImageFile)
if dirtyImagePath.Valid() {