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
|
|
|
#
|
|
|
|
####################################
|
|
|
|
|
2013-11-15 08:44:56 +01:00
|
|
|
# list of boot classpath jars for dexpreopt
|
2014-01-07 23:31:49 +01:00
|
|
|
DEXPREOPT_BOOT_JARS := $(subst $(space),:,$(PRODUCT_BOOT_JARS))
|
|
|
|
DEXPREOPT_BOOT_JARS_MODULES := $(PRODUCT_BOOT_JARS)
|
2013-07-24 02:57:38 +02:00
|
|
|
PRODUCT_BOOTCLASSPATH := $(subst $(space),:,$(foreach m,$(DEXPREOPT_BOOT_JARS_MODULES),/system/framework/$(m).jar))
|
2010-09-18 01:36:06 +02:00
|
|
|
|
2014-08-05 15:51:08 +02:00
|
|
|
PRODUCT_SYSTEM_SERVER_CLASSPATH := $(subst $(space),:,$(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),/system/framework/$(m).jar))
|
|
|
|
|
2010-09-18 01:36:06 +02:00
|
|
|
DEXPREOPT_BUILD_DIR := $(OUT_DIR)
|
2013-11-15 08:44:56 +01:00
|
|
|
DEXPREOPT_PRODUCT_DIR_FULL_PATH := $(PRODUCT_OUT)/dex_bootjars
|
|
|
|
DEXPREOPT_PRODUCT_DIR := $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(DEXPREOPT_PRODUCT_DIR_FULL_PATH))
|
2010-09-18 01:36:06 +02:00
|
|
|
DEXPREOPT_BOOT_JAR_DIR := system/framework
|
2013-11-15 08:44:56 +01:00
|
|
|
DEXPREOPT_BOOT_JAR_DIR_FULL_PATH := $(DEXPREOPT_PRODUCT_DIR_FULL_PATH)/$(DEXPREOPT_BOOT_JAR_DIR)
|
2010-09-29 20:54:15 +02:00
|
|
|
|
2014-12-08 23:46:29 +01:00
|
|
|
# The default value for LOCAL_DEX_PREOPT
|
|
|
|
DEX_PREOPT_DEFAULT ?= true
|
|
|
|
|
2016-06-16 23:47:10 +02:00
|
|
|
# The default filter for which files go into the system_other image (if it is
|
|
|
|
# being used). To bundle everything one should set this to '%'
|
|
|
|
SYSTEM_OTHER_ODEX_FILTER ?= app/% priv-app/%
|
|
|
|
|
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
|
|
|
|
2015-12-15 10:53:05 +01:00
|
|
|
# The default values for pre-opting: always preopt PIC.
|
|
|
|
# Conditional to building on linux, as dex2oat currently does not work on darwin.
|
2016-03-11 00:07:27 +01:00
|
|
|
ifeq ($(HOST_OS),linux)
|
|
|
|
WITH_DEXPREOPT ?= true
|
2016-03-11 00:34:46 +01:00
|
|
|
ifeq (eng,$(TARGET_BUILD_VARIANT))
|
2018-01-18 16:47:23 +01:00
|
|
|
# Don't strip for quick development turnarounds.
|
|
|
|
DEX_PREOPT_DEFAULT := nostripping
|
|
|
|
# For an eng build only pre-opt the boot image and system server. This gives reasonable performance
|
|
|
|
# and still allows a simple workflow: building in frameworks/base and syncing.
|
2017-08-28 23:19:35 +02:00
|
|
|
WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= true
|
2015-12-18 10:58:22 +01:00
|
|
|
endif
|
2018-01-18 16:47:23 +01:00
|
|
|
# Add mini-debug-info to the boot classpath unless explicitly asked not to.
|
2016-04-29 23:34:10 +02:00
|
|
|
ifneq (false,$(WITH_DEXPREOPT_DEBUG_INFO))
|
|
|
|
PRODUCT_DEX_PREOPT_BOOT_FLAGS += --generate-mini-debug-info
|
|
|
|
endif
|
2018-03-10 03:03:16 +01:00
|
|
|
|
|
|
|
# Non eng linux builds must have preopt enabled so that system server doesn't run as interpreter
|
|
|
|
# only. b/74209329
|
|
|
|
ifeq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
|
|
|
|
ifneq (true,$(WITH_DEXPREOPT))
|
|
|
|
ifneq (true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY))
|
|
|
|
$(call pretty-error, DEXPREOPT must be enabled for user and userdebug builds)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2015-12-15 10:53:05 +01:00
|
|
|
endif
|
|
|
|
|
2016-03-11 19:32:01 +01:00
|
|
|
GLOBAL_DEXPREOPT_FLAGS :=
|
|
|
|
|
2013-11-15 08:44:56 +01:00
|
|
|
# Special rules for building stripped boot jars that override java_library.mk rules
|
2010-09-18 01:36:06 +02:00
|
|
|
|
|
|
|
# $(1): boot jar module name
|
2013-11-15 08:44:56 +01:00
|
|
|
define _dexpreopt-boot-jar-remove-classes.dex
|
|
|
|
_dbj_jar_no_dex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1)_nodex.jar
|
|
|
|
_dbj_src_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar
|
2010-09-18 01:36:06 +02:00
|
|
|
|
2017-10-06 22:55:48 +02:00
|
|
|
$(call dexpreopt-copy-jar,$$(_dbj_src_jar),$$(_dbj_jar_no_dex),$(DEX_PREOPT_DEFAULT))
|
2010-09-18 01:36:06 +02:00
|
|
|
|
2013-11-15 08:44:56 +01:00
|
|
|
_dbj_jar_no_dex :=
|
|
|
|
_dbj_src_jar :=
|
2010-09-18 01:36:06 +02:00
|
|
|
endef
|
|
|
|
|
2013-11-15 08:44:56 +01:00
|
|
|
$(foreach b,$(DEXPREOPT_BOOT_JARS_MODULES),$(eval $(call _dexpreopt-boot-jar-remove-classes.dex,$(b))))
|
2010-09-18 01:36:06 +02:00
|
|
|
|
2013-11-15 08:44:56 +01:00
|
|
|
include $(BUILD_SYSTEM)/dex_preopt_libart.mk
|
2010-09-18 01:36:06 +02:00
|
|
|
|
2013-11-15 08:44:56 +01:00
|
|
|
# Define dexpreopt-one-file based on current default runtime.
|
2014-05-13 22:57:28 +02:00
|
|
|
# $(1): the input .jar or .apk file
|
|
|
|
# $(2): the output .odex file
|
2013-11-15 08:44:56 +01:00
|
|
|
define dexpreopt-one-file
|
2014-05-13 22:57:28 +02:00
|
|
|
$(call dex2oat-one-file,$(1),$(2))
|
2013-11-15 08:44:56 +01:00
|
|
|
endef
|
2013-10-31 19:44:47 +01:00
|
|
|
|
2014-10-06 15:53:59 +02:00
|
|
|
DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS := $(DEX2OAT_DEPENDENCY)
|
2014-05-13 22:57:28 +02:00
|
|
|
DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
|
|
|
|
ifdef TARGET_2ND_ARCH
|
|
|
|
$(TARGET_2ND_ARCH_VAR_PREFIX)DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
|
|
|
|
endif # TARGET_2ND_ARCH
|