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. 21my_boot_image_arch := TARGET_ARCH 22my_boot_image_out := $(PRODUCT_OUT) 23my_boot_image_syms := $(TARGET_OUT_UNSTRIPPED) 24DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE := \ 25 $(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(strip \ 26 $(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk) \ 27 $(my_boot_image_module))) 28ifdef TARGET_2ND_ARCH 29 my_boot_image_arch := TARGET_2ND_ARCH 30 2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE := \ 31 $(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(strip \ 32 $(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk) \ 33 $(my_boot_image_module))) 34endif 35# Install boot images for testing on host. We exclude framework image as it is not part of art manifest. 36my_boot_image_arch := HOST_ARCH 37my_boot_image_out := $(HOST_OUT) 38my_boot_image_syms := $(HOST_OUT)/symbols 39HOST_BOOT_IMAGE_MODULE := \ 40 $(foreach my_boot_image_name,art_host,$(strip \ 41 $(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk) \ 42 $(my_boot_image_module))) 43HOST_BOOT_IMAGE := $(call module-installed-files,$(HOST_BOOT_IMAGE_MODULE)) 44ifdef HOST_2ND_ARCH 45 my_boot_image_arch := HOST_2ND_ARCH 46 2ND_HOST_BOOT_IMAGE_MODULE := \ 47 $(foreach my_boot_image_name,art_host,$(strip \ 48 $(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk) \ 49 $(my_boot_image_module))) 50 2ND_HOST_BOOT_IMAGE := $(call module-installed-files,$(2ND_HOST_BOOT_IMAGE_MODULE)) 51endif 52my_boot_image_arch := 53my_boot_image_out := 54my_boot_image_syms := 55my_boot_image_module := 56 57# Build the boot.zip which contains the boot jars and their compilation output 58# We can do this only if preopt is enabled and if the product uses libart config (which sets the 59# default properties for preopting). 60ifeq ($(WITH_DEXPREOPT), true) 61ifeq ($(PRODUCT_USES_DEFAULT_ART_CONFIG), true) 62 63boot_zip := $(PRODUCT_OUT)/boot.zip 64bootclasspath_jars := $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES) 65system_server_jars := $(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),$(PRODUCT_OUT)/system/framework/$(m).jar) 66 67$(boot_zip): PRIVATE_BOOTCLASSPATH_JARS := $(bootclasspath_jars) 68$(boot_zip): PRIVATE_SYSTEM_SERVER_JARS := $(system_server_jars) 69$(boot_zip): $(bootclasspath_jars) $(system_server_jars) $(SOONG_ZIP) $(MERGE_ZIPS) $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art) 70 @echo "Create boot package: $@" 71 rm -f $@ 72 $(SOONG_ZIP) -o $@.tmp \ 73 -C $(dir $(firstword $(PRIVATE_BOOTCLASSPATH_JARS)))/.. $(addprefix -f ,$(PRIVATE_BOOTCLASSPATH_JARS)) \ 74 -C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_SYSTEM_SERVER_JARS)) 75 $(MERGE_ZIPS) $@ $@.tmp $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art) 76 rm -f $@.tmp 77 78$(call dist-for-goals, droidcore, $(boot_zip)) 79 80endif #PRODUCT_USES_DEFAULT_ART_CONFIG 81endif #WITH_DEXPREOPT 82