blob: de7dcdd5b4c83b0cab4c39de4b052c88fcd338da [file] [log] [blame]
Brian Carlstromced4bff2013-11-14 23:44:56 -08001####################################
2# dexpreopt support for ART
3#
4####################################
5
Brian Carlstromced4bff2013-11-14 23:44:56 -08006########################################################################
7# The full system boot classpath
8
Neil Fuller9fb70172018-08-28 13:18:25 +01009LIBART_TARGET_BOOT_JARS := $(DEXPREOPT_BOOT_JARS_MODULES)
Nicolas Geoffray6ce12f52019-01-15 11:46:32 +000010LIBART_TARGET_BOOT_DEX_LOCATIONS := $(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS)
11LIBART_TARGET_BOOT_DEX_FILES := $(foreach mod,$(NON_UPDATABLE_BOOT_MODULES),$(call intermediates-dir-for,JAVA_LIBRARIES,$(mod),,COMMON)/javalib.jar)
Brian Carlstromced4bff2013-11-14 23:44:56 -080012
Nicolas Geoffrayf084e782019-01-23 16:07:02 +000013# Copy the files to a location Soong dex preopt will look at.
14$(foreach mod,$(LIBART_TARGET_BOOT_JARS),$(eval $(call copy-one-file,$(call intermediates-dir-for,JAVA_LIBRARIES,$(mod),,COMMON)/javalib.jar,$(DEXPREOPT_BOOT_JARS_INPUT_PATH)/$(mod).jar)))
15
Colin Cross52dcb2f2016-03-08 13:21:49 -080016# dex preopt on the bootclasspath produces multiple files. The first dex file
17# is converted into to boot.art (to match the legacy assumption that boot.art
18# exists), and the rest are converted to boot-<name>.art.
19# In addition, each .art file has an associated .oat file.
Vladimir Markoe47795b2018-09-26 12:57:21 +010020LIBART_TARGET_BOOT_ART_EXTRA_FILES := $(foreach jar,$(wordlist 2,999,$(LIBART_TARGET_BOOT_JARS)),boot-$(jar).art boot-$(jar).oat)
21LIBART_TARGET_BOOT_ART_EXTRA_FILES += boot.oat
bowen_lai4570fdb2017-08-16 16:28:05 +080022LIBART_TARGET_BOOT_ART_VDEX_FILES := $(foreach jar,$(wordlist 2,999,$(LIBART_TARGET_BOOT_JARS)),boot-$(jar).vdex)
23LIBART_TARGET_BOOT_ART_VDEX_FILES += boot.vdex
Colin Cross52dcb2f2016-03-08 13:21:49 -080024
Mathieu Chartiera61acf62017-06-28 18:23:37 -070025# If we use a boot image profile.
26my_use_profile_for_boot_image := $(PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE)
27ifeq (,$(my_use_profile_for_boot_image))
Mathieu Chartier8fd29b32017-10-24 15:22:57 -070028# If not set, set the default to true if we are not a PDK build. PDK builds
29# can't build the profile since they don't have frameworks/base.
30ifneq (true,$(TARGET_BUILD_PDK))
Mathieu Chartierce944942017-08-28 18:42:02 -070031my_use_profile_for_boot_image := true
Mathieu Chartiera61acf62017-06-28 18:23:37 -070032endif
Mathieu Chartier8fd29b32017-10-24 15:22:57 -070033endif
Dan Willemsen406418d2018-06-19 23:03:34 -070034ifeq (,$(strip $(LIBART_TARGET_BOOT_DEX_FILES)))
35my_use_profile_for_boot_image := false
36endif
Mathieu Chartiera61acf62017-06-28 18:23:37 -070037
38ifeq (true,$(my_use_profile_for_boot_image))
39
Shibin George9dd9e682018-07-02 16:21:49 +053040boot_image_profiles := $(PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION)
41
42ifeq (,$(boot_image_profiles))
Mathieu Chartiera61acf62017-06-28 18:23:37 -070043# If not set, use the default.
Shibin George9dd9e682018-07-02 16:21:49 +053044boot_image_profiles := frameworks/base/config/boot-image-profile.txt
Mathieu Chartiera61acf62017-06-28 18:23:37 -070045endif
46
Shibin George9dd9e682018-07-02 16:21:49 +053047# Location of text based profile for the boot image.
48my_boot_image_profile_location := $(PRODUCT_OUT)/dex_bootjars/boot-image-profile.txt
49
50$(my_boot_image_profile_location): $(boot_image_profiles)
51 @echo 'Generating $@ for profman'
52 @rm -rf $@
53 $(hide) cat $^ > $@
54
Mathieu Chartiera61acf62017-06-28 18:23:37 -070055# Code to create the boot image profile, not in dex_preopt_libart_boot.mk since the profile is the same for all archs.
56my_out_boot_image_profile_location := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.prof
57$(my_out_boot_image_profile_location): PRIVATE_PROFILE_INPUT_LOCATION := $(my_boot_image_profile_location)
58$(my_out_boot_image_profile_location): $(PROFMAN) $(LIBART_TARGET_BOOT_DEX_FILES) $(my_boot_image_profile_location)
59 @echo "target profman: $@"
60 @mkdir -p $(dir $@)
61 ANDROID_LOG_TAGS="*:e" $(PROFMAN) \
62 --create-profile-from=$(PRIVATE_PROFILE_INPUT_LOCATION) \
63 $(addprefix --apk=,$(LIBART_TARGET_BOOT_DEX_FILES)) \
64 $(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \
65 --reference-profile-file=$@
66
67# We want to install the profile even if we are not using preopt since it is required to generate
68# the image on the device.
69my_installed_profile := $(TARGET_OUT)/etc/boot-image.prof
70$(eval $(call copy-one-file,$(my_out_boot_image_profile_location),$(my_installed_profile)))
71ALL_DEFAULT_INSTALLED_MODULES += $(my_installed_profile)
72
73endif
74
bowen_lai4570fdb2017-08-16 16:28:05 +080075LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES := $(addprefix $(PRODUCT_OUT)/$(DEXPREOPT_BOOT_JAR_DIR)/,$(LIBART_TARGET_BOOT_ART_VDEX_FILES))
76
Ying Wangb9aa5d42014-05-13 13:57:28 -070077my_2nd_arch_prefix :=
78include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
Brian Carlstromced4bff2013-11-14 23:44:56 -080079
Ying Wang87538e42016-03-16 19:53:19 -070080ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
Ying Wangb9aa5d42014-05-13 13:57:28 -070081ifdef TARGET_2ND_ARCH
82my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
83include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
Ying Wangb9aa5d42014-05-13 13:57:28 -070084endif
Ying Wang87538e42016-03-16 19:53:19 -070085endif
Brian Carlstromced4bff2013-11-14 23:44:56 -080086
bowen_lai4570fdb2017-08-16 16:28:05 +080087# Copy shared vdex to the directory and create corresponding symlinks in primary and secondary arch.
88$(LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES) : PRIMARY_ARCH_DIR := $(dir $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE))
89$(LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES) : SECOND_ARCH_DIR := $(dir $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE))
90$(LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES) : $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
91 @echo "Install: $@"
92 @mkdir -p $(dir $@)
93 @rm -f $@
94 $(hide) cp "$(dir $<)$(notdir $@)" "$@"
95 # Make symlink for both the archs. In the case its single arch the symlink will just get overridden.
96 @mkdir -p $(PRIMARY_ARCH_DIR)
97 $(hide) ln -sf /$(DEXPREOPT_BOOT_JAR_DIR)/$(notdir $@) $(PRIMARY_ARCH_DIR)$(notdir $@)
98 @mkdir -p $(SECOND_ARCH_DIR)
99 $(hide) ln -sf /$(DEXPREOPT_BOOT_JAR_DIR)/$(notdir $@) $(SECOND_ARCH_DIR)$(notdir $@)
100
101my_2nd_arch_prefix :=