1####################################
2# dexpreopt support - typically used on user builds to run dexopt (for Dalvik) or dex2oat (for ART) ahead of time
3#
4####################################
5
6include $(BUILD_SYSTEM)/dex_preopt_config.mk
7
8# Method returning whether the install path $(1) should be for system_other.
9# Under SANITIZE_LITE, we do not want system_other. Just put things under /data/asan.
10ifeq ($(SANITIZE_LITE),true)
11install-on-system-other =
12else
13install-on-system-other = $(filter-out $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(basename $(notdir $(filter $(foreach f,$(SYSTEM_OTHER_ODEX_FILTER),$(TARGET_OUT)/$(f)),$(1)))))
14endif
15
16# We want to install the profile even if we are not using preopt since it is required to generate
17# the image on the device.
18ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED),$(PRODUCT_OUT))
19
20# Install boot images. Note that there can be multiple.
21DEFAULT_DEX_PREOPT_INSTALLED_IMAGE :=
22$(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE :=
23$(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk))
24
25# Build the boot.zip which contains the boot jars and their compilation output
26# We can do this only if preopt is enabled and if the product uses libart config (which sets the
27# default properties for preopting).
28ifeq ($(WITH_DEXPREOPT), true)
29ifeq ($(PRODUCT_USES_DEFAULT_ART_CONFIG), true)
30
31boot_zip := $(PRODUCT_OUT)/boot.zip
32bootclasspath_jars := $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES)
33system_server_jars := $(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),$(PRODUCT_OUT)/system/framework/$(m).jar)
34
35$(boot_zip): PRIVATE_BOOTCLASSPATH_JARS := $(bootclasspath_jars)
36$(boot_zip): PRIVATE_SYSTEM_SERVER_JARS := $(system_server_jars)
37$(boot_zip): $(bootclasspath_jars) $(system_server_jars) $(SOONG_ZIP) $(MERGE_ZIPS) $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art)
38	@echo "Create boot package: $@"
39	rm -f $@
40	$(SOONG_ZIP) -o $@.tmp \
41	  -C $(dir $(firstword $(PRIVATE_BOOTCLASSPATH_JARS)))/.. $(addprefix -f ,$(PRIVATE_BOOTCLASSPATH_JARS)) \
42	  -C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_SYSTEM_SERVER_JARS))
43	$(MERGE_ZIPS) $@ $@.tmp $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art)
44	rm -f $@.tmp
45
46$(call dist-for-goals, droidcore, $(boot_zip))
47
48endif  #PRODUCT_USES_DEFAULT_ART_CONFIG
49endif  #WITH_DEXPREOPT
50