2010-09-18 01:36:06 +02:00
|
|
|
####################################
|
2013-11-15 08:44:56 +01:00
|
|
|
# dexpreopt support - typically used on user builds to run dexopt (for Dalvik) or dex2oat (for ART) ahead of time
|
2010-09-18 01:36:06 +02:00
|
|
|
#
|
|
|
|
####################################
|
|
|
|
|
2018-11-17 06:26:33 +01:00
|
|
|
include $(BUILD_SYSTEM)/dex_preopt_config.mk
|
2016-06-16 23:47:10 +02:00
|
|
|
|
2017-03-24 15:45:59 +01:00
|
|
|
# Method returning whether the install path $(1) should be for system_other.
|
2017-06-16 19:24:54 +02:00
|
|
|
# Under SANITIZE_LITE, we do not want system_other. Just put things under /data/asan.
|
|
|
|
ifeq ($(SANITIZE_LITE),true)
|
|
|
|
install-on-system-other =
|
|
|
|
else
|
2017-06-12 16:19:16 +02:00
|
|
|
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)))))
|
2017-06-16 19:24:54 +02:00
|
|
|
endif
|
2017-03-24 15:45:59 +01:00
|
|
|
|
2019-04-05 18:49:56 +02:00
|
|
|
# We want to install the profile even if we are not using preopt since it is required to generate
|
|
|
|
# the image on the device.
|
|
|
|
ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED),$(PRODUCT_OUT))
|
|
|
|
|
2019-02-22 16:33:23 +01:00
|
|
|
# Install boot images. Note that there can be multiple.
|
2020-02-11 14:46:45 +01:00
|
|
|
my_boot_image_arch := TARGET_ARCH
|
|
|
|
my_boot_image_out := $(PRODUCT_OUT)
|
|
|
|
my_boot_image_syms := $(TARGET_OUT_UNSTRIPPED)
|
2020-07-01 14:16:07 +02:00
|
|
|
DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE := \
|
|
|
|
$(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(strip \
|
|
|
|
$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk) \
|
|
|
|
$(my_boot_image_module)))
|
2020-02-11 14:46:45 +01:00
|
|
|
ifdef TARGET_2ND_ARCH
|
|
|
|
my_boot_image_arch := TARGET_2ND_ARCH
|
2020-07-01 14:16:07 +02:00
|
|
|
2ND_DEFAULT_DEX_PREOPT_INSTALLED_IMAGE_MODULE := \
|
|
|
|
$(foreach my_boot_image_name,$(DEXPREOPT_IMAGE_NAMES),$(strip \
|
|
|
|
$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk) \
|
|
|
|
$(my_boot_image_module)))
|
2020-02-11 14:46:45 +01:00
|
|
|
endif
|
|
|
|
# Install boot images for testing on host. We exclude framework image as it is not part of art manifest.
|
|
|
|
my_boot_image_arch := HOST_ARCH
|
|
|
|
my_boot_image_out := $(HOST_OUT)
|
|
|
|
my_boot_image_syms := $(HOST_OUT)/symbols
|
2020-07-01 14:16:07 +02:00
|
|
|
HOST_BOOT_IMAGE_MODULE := \
|
|
|
|
$(foreach my_boot_image_name,art_host,$(strip \
|
|
|
|
$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk) \
|
|
|
|
$(my_boot_image_module)))
|
|
|
|
HOST_BOOT_IMAGE := $(call module-installed-files,$(HOST_BOOT_IMAGE_MODULE))
|
2020-02-11 14:46:45 +01:00
|
|
|
ifdef HOST_2ND_ARCH
|
|
|
|
my_boot_image_arch := HOST_2ND_ARCH
|
2020-07-01 14:16:07 +02:00
|
|
|
2ND_HOST_BOOT_IMAGE_MODULE := \
|
|
|
|
$(foreach my_boot_image_name,art_host,$(strip \
|
|
|
|
$(eval include $(BUILD_SYSTEM)/dex_preopt_libart.mk) \
|
|
|
|
$(my_boot_image_module)))
|
|
|
|
2ND_HOST_BOOT_IMAGE := $(call module-installed-files,$(2ND_HOST_BOOT_IMAGE_MODULE))
|
2020-02-11 14:46:45 +01:00
|
|
|
endif
|
|
|
|
my_boot_image_arch :=
|
|
|
|
my_boot_image_out :=
|
|
|
|
my_boot_image_syms :=
|
2020-07-01 14:16:07 +02:00
|
|
|
my_boot_image_module :=
|
2010-09-18 01:36:06 +02:00
|
|
|
|
2019-04-16 22:05:42 +02:00
|
|
|
# Build the boot.zip which contains the boot jars and their compilation output
|
|
|
|
# We can do this only if preopt is enabled and if the product uses libart config (which sets the
|
|
|
|
# default properties for preopting).
|
|
|
|
ifeq ($(WITH_DEXPREOPT), true)
|
2019-05-02 00:34:47 +02:00
|
|
|
ifeq ($(PRODUCT_USES_DEFAULT_ART_CONFIG), true)
|
2019-04-16 22:05:42 +02:00
|
|
|
|
|
|
|
boot_zip := $(PRODUCT_OUT)/boot.zip
|
2019-02-20 21:39:57 +01:00
|
|
|
bootclasspath_jars := $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES)
|
2022-11-04 16:51:07 +01:00
|
|
|
|
|
|
|
# TODO remove system_server_jars usages from boot.zip and depend directly on system_server.zip file.
|
2022-12-19 17:05:28 +01:00
|
|
|
|
|
|
|
# Use "/system" path for JARs with "platform:" prefix.
|
|
|
|
# These JARs counterintuitively use "platform" prefix but they will
|
|
|
|
# be actually installed to /system partition.
|
|
|
|
platform_system_server_jars = $(filter platform:%, $(PRODUCT_SYSTEM_SERVER_JARS))
|
2021-05-04 17:14:02 +02:00
|
|
|
system_server_jars := \
|
2022-12-19 17:05:28 +01:00
|
|
|
$(foreach m,$(platform_system_server_jars),\
|
2021-05-04 17:14:02 +02:00
|
|
|
$(PRODUCT_OUT)/system/framework/$(call word-colon,2,$(m)).jar)
|
2018-05-10 20:33:27 +02:00
|
|
|
|
2022-12-19 17:05:28 +01:00
|
|
|
# For the remaining system server JARs use the partition signified by the prefix.
|
|
|
|
# For example, prefix "system_ext:" will use "/system_ext" path.
|
|
|
|
other_system_server_jars = $(filter-out $(platform_system_server_jars), $(PRODUCT_SYSTEM_SERVER_JARS))
|
|
|
|
system_server_jars += \
|
|
|
|
$(foreach m,$(other_system_server_jars),\
|
|
|
|
$(PRODUCT_OUT)/$(call word-colon,1,$(m))/framework/$(call word-colon,2,$(m)).jar)
|
|
|
|
|
2023-06-09 18:44:50 +02:00
|
|
|
# Infix can be 'art' (ART image for testing), 'boot' (primary), or 'mainline' (mainline extension).
|
|
|
|
# Soong creates a set of variables for Make, one or each boot image. The only reason why the ART
|
|
|
|
# image is exposed to Make is testing (art gtests) and benchmarking (art golem benchmarks). Install
|
|
|
|
# rules that use those variables are in dex_preopt_libart.mk. Here for dexpreopt purposes the infix
|
|
|
|
# is always 'boot' or 'mainline'.
|
|
|
|
DEXPREOPT_INFIX := $(if $(filter true,$(DEX_PREOPT_WITH_UPDATABLE_BCP)),mainline,boot)
|
|
|
|
|
|
|
|
# The input variables are written by build/soong/java/dexpreopt_bootjars.go. Examples can be found
|
|
|
|
# at the bottom of build/soong/java/dexpreopt_config_testing.go.
|
|
|
|
dexpreopt_root_dir := $(dir $(patsubst %/,%,$(dir $(firstword $(bootclasspath_jars)))))
|
|
|
|
booclasspath_arg := $(subst $(space),:,$(patsubst $(dexpreopt_root_dir)%,%,$(DEXPREOPT_BOOTCLASSPATH_DEX_FILES)))
|
|
|
|
booclasspath_locations_arg := $(subst $(space),:,$(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS))
|
|
|
|
boot_images := $(subst :,$(space),$(DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICE$(DEXPREOPT_INFIX)))
|
|
|
|
boot_image_arg := $(subst $(space),:,$(patsubst /%,%,$(boot_images)))
|
2023-06-19 21:16:21 +02:00
|
|
|
dex2oat_extra_args := $(if $(filter true,$(ENABLE_UFFD_GC)),--runtime-arg -Xgc:CMC)
|
2023-06-09 18:44:50 +02:00
|
|
|
|
2023-06-12 12:18:12 +02:00
|
|
|
boot_zip_metadata_txt := $(dir $(boot_zip))boot_zip/METADATA.txt
|
2023-06-09 18:44:50 +02:00
|
|
|
$(boot_zip_metadata_txt):
|
|
|
|
rm -f $@
|
|
|
|
echo "booclasspath = $(booclasspath_arg)" >> $@
|
|
|
|
echo "booclasspath-locations = $(booclasspath_locations_arg)" >> $@
|
|
|
|
echo "boot-image = $(boot_image_arg)" >> $@
|
2023-06-19 21:16:21 +02:00
|
|
|
echo "extra-args = $(dex2oat_extra_args)" >> $@
|
2023-06-09 18:44:50 +02:00
|
|
|
|
|
|
|
$(call dist-for-goals, droidcore, $(boot_zip_metadata_txt))
|
|
|
|
|
2019-04-16 22:05:42 +02:00
|
|
|
$(boot_zip): PRIVATE_BOOTCLASSPATH_JARS := $(bootclasspath_jars)
|
|
|
|
$(boot_zip): PRIVATE_SYSTEM_SERVER_JARS := $(system_server_jars)
|
2023-06-09 18:44:50 +02:00
|
|
|
$(boot_zip): $(bootclasspath_jars) $(system_server_jars) $(SOONG_ZIP) $(MERGE_ZIPS) $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art) $(DEXPREOPT_IMAGE_ZIP_mainline) $(boot_zip_metadata_txt)
|
2019-04-16 22:05:42 +02:00
|
|
|
@echo "Create boot package: $@"
|
2018-05-10 20:33:27 +02:00
|
|
|
rm -f $@
|
2019-04-16 22:05:42 +02:00
|
|
|
$(SOONG_ZIP) -o $@.tmp \
|
2019-02-20 21:39:57 +01:00
|
|
|
-C $(dir $(firstword $(PRIVATE_BOOTCLASSPATH_JARS)))/.. $(addprefix -f ,$(PRIVATE_BOOTCLASSPATH_JARS)) \
|
2023-06-09 18:44:50 +02:00
|
|
|
-C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_SYSTEM_SERVER_JARS)) \
|
2023-06-12 12:18:12 +02:00
|
|
|
-j -f $(boot_zip_metadata_txt)
|
2023-06-09 18:44:50 +02:00
|
|
|
$(MERGE_ZIPS) $@ $@.tmp $(DEXPREOPT_IMAGE_ZIP_boot) $(DEXPREOPT_IMAGE_ZIP_art) $(DEXPREOPT_IMAGE_ZIP_mainline)
|
2019-04-16 22:05:42 +02:00
|
|
|
rm -f $@.tmp
|
2018-05-10 20:33:27 +02:00
|
|
|
|
2019-04-16 22:05:42 +02:00
|
|
|
$(call dist-for-goals, droidcore, $(boot_zip))
|
|
|
|
|
2023-03-18 08:02:44 +01:00
|
|
|
ifneq (,$(filter true,$(ART_MODULE_BUILD_FROM_SOURCE) $(MODULE_BUILD_FROM_SOURCE)))
|
2022-11-04 16:51:07 +01:00
|
|
|
# Build the system_server.zip which contains the Apex system server jars and standalone system server jars
|
|
|
|
system_server_zip := $(PRODUCT_OUT)/system_server.zip
|
|
|
|
apex_system_server_jars := \
|
|
|
|
$(foreach m,$(PRODUCT_APEX_SYSTEM_SERVER_JARS),\
|
|
|
|
$(PRODUCT_OUT)/apex/$(call word-colon,1,$(m))/javalib/$(call word-colon,2,$(m)).jar)
|
|
|
|
|
|
|
|
apex_standalone_system_server_jars := \
|
|
|
|
$(foreach m,$(PRODUCT_APEX_STANDALONE_SYSTEM_SERVER_JARS),\
|
|
|
|
$(PRODUCT_OUT)/apex/$(call word-colon,1,$(m))/javalib/$(call word-colon,2,$(m)).jar)
|
|
|
|
|
|
|
|
standalone_system_server_jars := \
|
|
|
|
$(foreach m,$(PRODUCT_STANDALONE_SYSTEM_SERVER_JARS),\
|
|
|
|
$(PRODUCT_OUT)/apex/$(call word-colon,1,$(m))/javalib/$(call word-colon,2,$(m)).jar)
|
|
|
|
|
|
|
|
$(system_server_zip): PRIVATE_SYSTEM_SERVER_JARS := $(system_server_jars)
|
|
|
|
$(system_server_zip): PRIVATE_APEX_SYSTEM_SERVER_JARS := $(apex_system_server_jars)
|
|
|
|
$(system_server_zip): PRIVATE_APEX_STANDALONE_SYSTEM_SERVER_JARS := $(apex_standalone_system_server_jars)
|
|
|
|
$(system_server_zip): PRIVATE_STANDALONE_SYSTEM_SERVER_JARS := $(standalone_system_server_jars)
|
|
|
|
$(system_server_zip): $(system_server_jars) $(apex_system_server_jars) $(apex_standalone_system_server_jars) $(standalone_system_server_jars) $(SOONG_ZIP)
|
|
|
|
@echo "Create system server package: $@"
|
|
|
|
rm -f $@
|
|
|
|
$(SOONG_ZIP) -o $@ \
|
|
|
|
-C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_SYSTEM_SERVER_JARS)) \
|
|
|
|
-C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_APEX_SYSTEM_SERVER_JARS)) \
|
|
|
|
-C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_APEX_STANDALONE_SYSTEM_SERVER_JARS)) \
|
|
|
|
-C $(PRODUCT_OUT) $(addprefix -f ,$(PRIVATE_STANDALONE_SYSTEM_SERVER_JARS))
|
|
|
|
|
|
|
|
$(call dist-for-goals, droidcore, $(system_server_zip))
|
|
|
|
|
2023-03-18 08:02:44 +01:00
|
|
|
endif #ART_MODULE_BUILD_FROM_SOURCE || MODULE_BUILD_FROM_SOURCE
|
2019-05-02 00:34:47 +02:00
|
|
|
endif #PRODUCT_USES_DEFAULT_ART_CONFIG
|
2019-04-16 22:05:42 +02:00
|
|
|
endif #WITH_DEXPREOPT
|