2010-09-18 07:36:06 +08:00
|
|
|
####################################
|
2013-11-15 15:44:56 +08:00
|
|
|
# dexpreopt support - typically used on user builds to run dexopt (for Dalvik) or dex2oat (for ART) ahead of time
|
2010-09-18 07:36:06 +08:00
|
|
|
#
|
|
|
|
####################################
|
|
|
|
|
2013-11-15 15:44:56 +08:00
|
|
|
# list of boot classpath jars for dexpreopt
|
2014-01-08 06:31:49 +08:00
|
|
|
DEXPREOPT_BOOT_JARS := $(subst $(space),:,$(PRODUCT_BOOT_JARS))
|
|
|
|
DEXPREOPT_BOOT_JARS_MODULES := $(PRODUCT_BOOT_JARS)
|
2013-07-24 08:57:38 +08:00
|
|
|
PRODUCT_BOOTCLASSPATH := $(subst $(space),:,$(foreach m,$(DEXPREOPT_BOOT_JARS_MODULES),/system/framework/$(m).jar))
|
2010-09-18 07:36:06 +08:00
|
|
|
|
2014-08-05 21:51:08 +08:00
|
|
|
PRODUCT_SYSTEM_SERVER_CLASSPATH := $(subst $(space),:,$(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),/system/framework/$(m).jar))
|
|
|
|
|
2010-09-18 07:36:06 +08:00
|
|
|
DEXPREOPT_BUILD_DIR := $(OUT_DIR)
|
2013-11-15 15:44:56 +08: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 07:36:06 +08:00
|
|
|
DEXPREOPT_BOOT_JAR_DIR := system/framework
|
2013-11-15 15:44:56 +08:00
|
|
|
DEXPREOPT_BOOT_JAR_DIR_FULL_PATH := $(DEXPREOPT_PRODUCT_DIR_FULL_PATH)/$(DEXPREOPT_BOOT_JAR_DIR)
|
2010-09-30 02:54:15 +08:00
|
|
|
|
2014-12-09 06:46:29 +08:00
|
|
|
# The default value for LOCAL_DEX_PREOPT
|
|
|
|
DEX_PREOPT_DEFAULT ?= true
|
|
|
|
|
2010-09-18 07:36:06 +08:00
|
|
|
# $(1): the .jar or .apk to remove classes.dex
|
|
|
|
define dexpreopt-remove-classes.dex
|
2014-07-01 01:09:56 +08:00
|
|
|
$(hide) zip --quiet --delete $(1) classes.dex; \
|
|
|
|
dex_index=2; \
|
|
|
|
while zip --quiet --delete $(1) classes$${dex_index}.dex > /dev/null; do \
|
|
|
|
let dex_index=dex_index+1; \
|
|
|
|
done
|
2010-09-18 07:36:06 +08:00
|
|
|
endef
|
|
|
|
|
2013-11-15 15:44:56 +08:00
|
|
|
# Special rules for building stripped boot jars that override java_library.mk rules
|
2010-09-18 07:36:06 +08:00
|
|
|
|
|
|
|
# $(1): boot jar module name
|
2013-11-15 15:44:56 +08: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 07:36:06 +08:00
|
|
|
|
2015-07-24 08:12:10 +08:00
|
|
|
$$(_dbj_jar_no_dex) : $$(_dbj_src_jar) | $(ACP)
|
2010-09-18 07:36:06 +08:00
|
|
|
$$(call copy-file-to-target)
|
2013-09-12 15:22:42 +08:00
|
|
|
ifneq ($(DEX_PREOPT_DEFAULT),nostripping)
|
2010-09-18 07:36:06 +08:00
|
|
|
$$(call dexpreopt-remove-classes.dex,$$@)
|
2013-09-12 15:22:42 +08:00
|
|
|
endif
|
2010-09-18 07:36:06 +08:00
|
|
|
|
2013-11-15 15:44:56 +08:00
|
|
|
_dbj_jar_no_dex :=
|
|
|
|
_dbj_src_jar :=
|
2010-09-18 07:36:06 +08:00
|
|
|
endef
|
|
|
|
|
2013-11-15 15:44:56 +08:00
|
|
|
$(foreach b,$(DEXPREOPT_BOOT_JARS_MODULES),$(eval $(call _dexpreopt-boot-jar-remove-classes.dex,$(b))))
|
2010-09-18 07:36:06 +08:00
|
|
|
|
2013-11-15 15:44:56 +08:00
|
|
|
include $(BUILD_SYSTEM)/dex_preopt_libart.mk
|
2010-09-18 07:36:06 +08:00
|
|
|
|
2013-11-15 15:44:56 +08:00
|
|
|
# Define dexpreopt-one-file based on current default runtime.
|
2014-05-14 04:57:28 +08:00
|
|
|
# $(1): the input .jar or .apk file
|
|
|
|
# $(2): the output .odex file
|
2013-11-15 15:44:56 +08:00
|
|
|
define dexpreopt-one-file
|
2014-05-14 04:57:28 +08:00
|
|
|
$(call dex2oat-one-file,$(1),$(2))
|
2013-11-15 15:44:56 +08:00
|
|
|
endef
|
2013-11-01 02:44:47 +08:00
|
|
|
|
2014-10-06 21:53:59 +08:00
|
|
|
DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS := $(DEX2OAT_DEPENDENCY)
|
2014-05-14 04:57:28 +08: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
|