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
|
|
|
#
|
|
|
|
####################################
|
|
|
|
|
2014-03-20 20:13:10 +01:00
|
|
|
ifneq ($(DALVIK_VM_LIB),)
|
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
|
|
|
|
|
|
|
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
|
|
|
|
2010-09-18 01:36:06 +02:00
|
|
|
# $(1): the .jar or .apk to remove classes.dex
|
|
|
|
define dexpreopt-remove-classes.dex
|
|
|
|
$(hide) $(AAPT) remove $(1) classes.dex
|
|
|
|
endef
|
|
|
|
|
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
|
|
|
|
2013-11-15 08:44:56 +01:00
|
|
|
$$(_dbj_jar_no_dex) : $$(_dbj_src_jar) | $(ACP) $(AAPT)
|
2010-09-18 01:36:06 +02:00
|
|
|
$$(call copy-file-to-target)
|
2013-09-12 09:22:42 +02:00
|
|
|
ifneq ($(DEX_PREOPT_DEFAULT),nostripping)
|
2010-09-18 01:36:06 +02:00
|
|
|
$$(call dexpreopt-remove-classes.dex,$$@)
|
2013-09-12 09:22:42 +02:00
|
|
|
endif
|
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
|
|
|
# Conditionally include Dalvik support.
|
|
|
|
ifeq ($(DALVIK_VM_LIB),libdvm.so)
|
|
|
|
include $(BUILD_SYSTEM)/dex_preopt_libdvm.mk
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Unconditionally include ART support because its used run dex2oat on the host for tests.
|
|
|
|
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
|
|
|
ifeq ($(DALVIK_VM_LIB),libdvm.so)
|
|
|
|
define dexpreopt-one-file
|
2014-05-13 22:57:28 +02:00
|
|
|
$(call dexopt-one-file,$(1),$(2))
|
2010-09-18 01:36:06 +02:00
|
|
|
endef
|
|
|
|
|
2013-11-15 08:44:56 +01:00
|
|
|
DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS := $(DEXOPT_DEPENDENCY)
|
|
|
|
DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $(DEXPREOPT_BOOT_ODEXS)
|
|
|
|
else
|
|
|
|
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-03-25 12:14:26 +01:00
|
|
|
DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS := $(DEX2OATD_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
|
|
|
|
endif # DALVIK_VM_LIB
|
2014-03-20 20:13:10 +01:00
|
|
|
else
|
|
|
|
$(warning No DALVIK_VM_LIB, disable dexpreopt.)
|
|
|
|
WITH_DEXPREOPT := false
|
|
|
|
endif # DALVIK_VM_LIB is defined.
|