blob: 20b40518d389a22180616fcbb8c8ea7785ce2ff2 [file] [log] [blame]
Ying Wange7874c42010-09-17 16:36:06 -07001####################################
Brian Carlstromced4bff2013-11-14 23:44:56 -08002# dexpreopt support - typically used on user builds to run dexopt (for Dalvik) or dex2oat (for ART) ahead of time
Ying Wange7874c42010-09-17 16:36:06 -07003#
4####################################
5
Colin Cross6db5b0e2018-11-16 21:26:33 -08006include $(BUILD_SYSTEM)/dex_preopt_config.mk
Alex Light4e358ab2016-06-16 14:47:10 -07007
Nicolas Geoffraycdd43432017-03-24 14:45:59 +00008# Method returning whether the install path $(1) should be for system_other.
Andreas Gampe4ed21d12017-06-16 10:24:54 -07009# Under SANITIZE_LITE, we do not want system_other. Just put things under /data/asan.
10ifeq ($(SANITIZE_LITE),true)
11install-on-system-other =
12else
Nicolas Geoffray4a0ad4a2017-06-12 15:19:16 +010013install-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 Gampe4ed21d12017-06-16 10:24:54 -070014endif
Nicolas Geoffraycdd43432017-03-24 14:45:59 +000015
Nicolas Geoffray7e8ca9a2019-04-05 17:49:56 +010016# 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
Nicolas Geoffray269bc742019-02-22 15:33:23 +000020# Install boot images. Note that there can be multiple.
David Srbecky6dd11ec2020-02-11 13:46:45 +000021my_boot_image_arch := TARGET_ARCH
22my_boot_image_out := $(PRODUCT_OUT)
23my_boot_image_syms := $(TARGET_OUT_UNSTRIPPED)
24my_boot_image_root := DEFAULT_DEX_PREOPT_INSTALLED_IMAGE
Nicolas Geoffray269bc742019-02-22 15:33:23 +000025DEFAULT_DEX_PREOPT_INSTALLED_IMAGE :=
Nicolas Geoffray269bc742019-02-22 15:33:23 +000026$(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk))
David Srbecky6dd11ec2020-02-11 13:46:45 +000027ifdef 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))
32endif
33# Install boot images for testing on host. We exclude framework image as it is not part of art manifest.
34my_boot_image_arch := HOST_ARCH
35my_boot_image_out := $(HOST_OUT)
36my_boot_image_syms := $(HOST_OUT)/symbols
37my_boot_image_root := HOST_BOOT_IMAGE
38HOST_BOOT_IMAGE :=
39$(foreach my_boot_image_name,art_host,$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk))
40ifdef 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))
45endif
46my_boot_image_arch :=
47my_boot_image_out :=
48my_boot_image_syms :=
49my_boot_image_root :=
Brian Carlstromced4bff2013-11-14 23:44:56 -080050
Calin Juravle6bfdcda2019-04-16 13:05:42 -070051# 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).
54ifeq ($(WITH_DEXPREOPT), true)
Calin Juravlecdff6b12019-05-01 15:34:47 -070055ifeq ($(PRODUCT_USES_DEFAULT_ART_CONFIG), true)
Calin Juravle6bfdcda2019-04-16 13:05:42 -070056
57boot_zip := $(PRODUCT_OUT)/boot.zip
Colin Crossd8badf52019-02-20 12:39:57 -080058bootclasspath_jars := $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES)
59system_server_jars := $(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),$(PRODUCT_OUT)/system/framework/$(m).jar)
Calin Juravle8955a992018-05-10 11:33:27 -070060
Calin Juravle6bfdcda2019-04-16 13:05:42 -070061$(boot_zip): PRIVATE_BOOTCLASSPATH_JARS := $(bootclasspath_jars)
62$(boot_zip): PRIVATE_SYSTEM_SERVER_JARS := $(system_server_jars)
Calin Juravleabdea212019-12-04 16:50:17 -080063$(boot_zip): $(bootclasspath_jars) $(system_server_jars) $(SOONG_ZIP) $(MERGE_ZIPS) $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art)
Calin Juravle6bfdcda2019-04-16 13:05:42 -070064 @echo "Create boot package: $@"
Calin Juravle8955a992018-05-10 11:33:27 -070065 rm -f $@
Calin Juravle6bfdcda2019-04-16 13:05:42 -070066 $(SOONG_ZIP) -o $@.tmp \
Colin Crossd8badf52019-02-20 12:39:57 -080067 -C $(dir $(firstword $(PRIVATE_BOOTCLASSPATH_JARS)))/.. $(addprefix -f ,$(PRIVATE_BOOTCLASSPATH_JARS)) \
68 -C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_SYSTEM_SERVER_JARS))
Calin Juravleabdea212019-12-04 16:50:17 -080069 $(MERGE_ZIPS) $@ $@.tmp $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art)
Calin Juravle6bfdcda2019-04-16 13:05:42 -070070 rm -f $@.tmp
Calin Juravle8955a992018-05-10 11:33:27 -070071
Calin Juravle6bfdcda2019-04-16 13:05:42 -070072$(call dist-for-goals, droidcore, $(boot_zip))
73
Calin Juravlecdff6b12019-05-01 15:34:47 -070074endif #PRODUCT_USES_DEFAULT_ART_CONFIG
Calin Juravle6bfdcda2019-04-16 13:05:42 -070075endif #WITH_DEXPREOPT