Auto-generate dexpreopt boot image module
Add prebuilt modules that installs bootjar dexpreopt files generated by
soong, for example `dexpreopt_bootjar.boot_arm64` installs .art / .oat /
.vdex, etc for the framework boot image ("boot") for primary arch
("arm64").
Bug: 159196136
Test: TH built artifacts noop
Test: Check device boot images are installed
Test: ./prebuilts/build-tools/linux-x86/bin/ninja -f out/combined-aosp_arm64.ninja -t browse
Test: Check that generated dependency graph is sane
Test: Check that bootjar dexpreopt bits are listed in `m dump-files`
Change-Id: Ia30b37be9be972c5e28b5840923801ea7237a237
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index e4c84e0..05f700d 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -94,16 +94,18 @@
boot_jars := $(foreach pair,$(PRODUCT_BOOT_JARS), $(call word-colon,2,$(pair)))
ifneq ($(filter $(LOCAL_MODULE),$(boot_jars)),) # is_boot_jar
ifeq (true,$(WITH_DEXPREOPT))
- # For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
- # We use this installed_odex trick to get boot.art installed.
- installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
- # Append the odex for the 2nd arch if we have one.
- installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
- ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
- # Make sure to install the .odex and .vdex when you run "make <module_name>"
- $(my_all_targets): $(installed_odex)
- # Copy $(LOCAL_BUILT_MODULE) and its dependencies when installing boot.art
- $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE): $(LOCAL_BUILT_MODULE)
+ # $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE) contains modules that installs
+ # all of bootjars' dexpreopt files (.art, .oat, .vdex, ...)
+ # Add them to the required list so they are installed alongside this module.
+ ALL_MODULES.$(my_register_name).REQUIRED_FROM_TARGET += \
+ $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE) \
+ $(2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE)
+ # Copy $(LOCAL_BUILT_MODULE) and its dependencies when installing boot.art
+ # so that dependencies of $(LOCAL_BUILT_MODULE) (which may include
+ # jacoco-report-classes.jar) are copied for every build.
+ $(foreach m,$(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE) $(2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE), \
+ $(eval $(call add-dependency,$(firstword $(call module-installed-files,$(m))),$(LOCAL_BUILT_MODULE))) \
+ )
endif
endif # is_boot_jar