| Ying Wang | e7874c4 | 2010-09-17 16:36:06 -0700 | [diff] [blame] | 1 | #################################### | 
| Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 2 | # dexpreopt support - typically used on user builds to run dexopt (for Dalvik) or dex2oat (for ART) ahead of time | 
| Ying Wang | e7874c4 | 2010-09-17 16:36:06 -0700 | [diff] [blame] | 3 | # | 
|  | 4 | #################################### | 
|  | 5 |  | 
| Colin Cross | 6db5b0e | 2018-11-16 21:26:33 -0800 | [diff] [blame] | 6 | include $(BUILD_SYSTEM)/dex_preopt_config.mk | 
| Alex Light | 4e358ab | 2016-06-16 14:47:10 -0700 | [diff] [blame] | 7 |  | 
| Nicolas Geoffray | cdd4343 | 2017-03-24 14:45:59 +0000 | [diff] [blame] | 8 | # Method returning whether the install path $(1) should be for system_other. | 
| Andreas Gampe | 4ed21d1 | 2017-06-16 10:24:54 -0700 | [diff] [blame] | 9 | # Under SANITIZE_LITE, we do not want system_other. Just put things under /data/asan. | 
|  | 10 | ifeq ($(SANITIZE_LITE),true) | 
|  | 11 | install-on-system-other = | 
|  | 12 | else | 
| Nicolas Geoffray | 4a0ad4a | 2017-06-12 15:19:16 +0100 | [diff] [blame] | 13 | install-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))))) | 
| Andreas Gampe | 4ed21d1 | 2017-06-16 10:24:54 -0700 | [diff] [blame] | 14 | endif | 
| Nicolas Geoffray | cdd4343 | 2017-03-24 14:45:59 +0000 | [diff] [blame] | 15 |  | 
| Nicolas Geoffray | 7e8ca9a | 2019-04-05 17:49:56 +0100 | [diff] [blame] | 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. | 
|  | 18 | ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED),$(PRODUCT_OUT)) | 
|  | 19 |  | 
| Nicolas Geoffray | 269bc74 | 2019-02-22 15:33:23 +0000 | [diff] [blame] | 20 | # Install boot images. Note that there can be multiple. | 
| David Srbecky | 6dd11ec | 2020-02-11 13:46:45 +0000 | [diff] [blame] | 21 | my_boot_image_arch := TARGET_ARCH | 
|  | 22 | my_boot_image_out := $(PRODUCT_OUT) | 
|  | 23 | my_boot_image_syms := $(TARGET_OUT_UNSTRIPPED) | 
|  | 24 | my_boot_image_root := DEFAULT_DEX_PREOPT_INSTALLED_IMAGE | 
| Nicolas Geoffray | 269bc74 | 2019-02-22 15:33:23 +0000 | [diff] [blame] | 25 | DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := | 
| Nicolas Geoffray | 269bc74 | 2019-02-22 15:33:23 +0000 | [diff] [blame] | 26 | $(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk)) | 
| David Srbecky | 6dd11ec | 2020-02-11 13:46:45 +0000 | [diff] [blame] | 27 | ifdef TARGET_2ND_ARCH | 
|  | 28 | my_boot_image_arch := TARGET_2ND_ARCH | 
|  | 29 | my_boot_image_root := 2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE | 
|  | 30 | 2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := | 
|  | 31 | $(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk)) | 
|  | 32 | endif | 
|  | 33 | # Install boot images for testing on host. We exclude framework image as it is not part of art manifest. | 
|  | 34 | my_boot_image_arch := HOST_ARCH | 
|  | 35 | my_boot_image_out := $(HOST_OUT) | 
|  | 36 | my_boot_image_syms := $(HOST_OUT)/symbols | 
|  | 37 | my_boot_image_root := HOST_BOOT_IMAGE | 
|  | 38 | HOST_BOOT_IMAGE := | 
|  | 39 | $(foreach my_boot_image_name,art_host,$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk)) | 
|  | 40 | ifdef HOST_2ND_ARCH | 
|  | 41 | my_boot_image_arch := HOST_2ND_ARCH | 
|  | 42 | my_boot_image_root := 2ND_HOST_BOOT_IMAGE | 
|  | 43 | 2ND_HOST_BOOT_IMAGE := | 
|  | 44 | $(foreach my_boot_image_name,art_host,$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk)) | 
|  | 45 | endif | 
|  | 46 | my_boot_image_arch := | 
|  | 47 | my_boot_image_out := | 
|  | 48 | my_boot_image_syms := | 
|  | 49 | my_boot_image_root := | 
| Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 50 |  | 
| Calin Juravle | 6bfdcda | 2019-04-16 13:05:42 -0700 | [diff] [blame] | 51 | # Build the boot.zip which contains the boot jars and their compilation output | 
|  | 52 | # We can do this only if preopt is enabled and if the product uses libart config (which sets the | 
|  | 53 | # default properties for preopting). | 
|  | 54 | ifeq ($(WITH_DEXPREOPT), true) | 
| Calin Juravle | cdff6b1 | 2019-05-01 15:34:47 -0700 | [diff] [blame] | 55 | ifeq ($(PRODUCT_USES_DEFAULT_ART_CONFIG), true) | 
| Calin Juravle | 6bfdcda | 2019-04-16 13:05:42 -0700 | [diff] [blame] | 56 |  | 
|  | 57 | boot_zip := $(PRODUCT_OUT)/boot.zip | 
| Colin Cross | d8badf5 | 2019-02-20 12:39:57 -0800 | [diff] [blame] | 58 | bootclasspath_jars := $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES) | 
|  | 59 | system_server_jars := $(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),$(PRODUCT_OUT)/system/framework/$(m).jar) | 
| Calin Juravle | 8955a99 | 2018-05-10 11:33:27 -0700 | [diff] [blame] | 60 |  | 
| Calin Juravle | 6bfdcda | 2019-04-16 13:05:42 -0700 | [diff] [blame] | 61 | $(boot_zip): PRIVATE_BOOTCLASSPATH_JARS := $(bootclasspath_jars) | 
|  | 62 | $(boot_zip): PRIVATE_SYSTEM_SERVER_JARS := $(system_server_jars) | 
| Calin Juravle | abdea21 | 2019-12-04 16:50:17 -0800 | [diff] [blame] | 63 | $(boot_zip): $(bootclasspath_jars) $(system_server_jars) $(SOONG_ZIP) $(MERGE_ZIPS) $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art) | 
| Calin Juravle | 6bfdcda | 2019-04-16 13:05:42 -0700 | [diff] [blame] | 64 | @echo "Create boot package: $@" | 
| Calin Juravle | 8955a99 | 2018-05-10 11:33:27 -0700 | [diff] [blame] | 65 | rm -f $@ | 
| Calin Juravle | 6bfdcda | 2019-04-16 13:05:42 -0700 | [diff] [blame] | 66 | $(SOONG_ZIP) -o $@.tmp \ | 
| Colin Cross | d8badf5 | 2019-02-20 12:39:57 -0800 | [diff] [blame] | 67 | -C $(dir $(firstword $(PRIVATE_BOOTCLASSPATH_JARS)))/.. $(addprefix -f ,$(PRIVATE_BOOTCLASSPATH_JARS)) \ | 
|  | 68 | -C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_SYSTEM_SERVER_JARS)) | 
| Calin Juravle | abdea21 | 2019-12-04 16:50:17 -0800 | [diff] [blame] | 69 | $(MERGE_ZIPS) $@ $@.tmp $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art) | 
| Calin Juravle | 6bfdcda | 2019-04-16 13:05:42 -0700 | [diff] [blame] | 70 | rm -f $@.tmp | 
| Calin Juravle | 8955a99 | 2018-05-10 11:33:27 -0700 | [diff] [blame] | 71 |  | 
| Calin Juravle | 6bfdcda | 2019-04-16 13:05:42 -0700 | [diff] [blame] | 72 | $(call dist-for-goals, droidcore, $(boot_zip)) | 
|  | 73 |  | 
| Calin Juravle | cdff6b1 | 2019-05-01 15:34:47 -0700 | [diff] [blame] | 74 | endif  #PRODUCT_USES_DEFAULT_ART_CONFIG | 
| Calin Juravle | 6bfdcda | 2019-04-16 13:05:42 -0700 | [diff] [blame] | 75 | endif  #WITH_DEXPREOPT |