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
|
|
|
|
|
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.
|
2015-12-18 10:58:22 +01:00
|
|
|
# Conditional to building a non-eng build, as it currently negatively affects
|
|
|
|
# some development workflows.
|
|
|
|
ifneq ($(TARGET_BUILD_VARIANT),eng)
|
|
|
|
ifeq ($(HOST_OS),linux)
|
|
|
|
WITH_DEXPREOPT_PIC ?= true
|
|
|
|
WITH_DEXPREOPT ?= true
|
|
|
|
endif
|
2015-12-15 10:53:05 +01:00
|
|
|
endif
|
|
|
|
|
2010-09-18 01:36:06 +02:00
|
|
|
# $(1): the .jar or .apk to remove classes.dex
|
|
|
|
define dexpreopt-remove-classes.dex
|
2014-06-30 19:09:56 +02: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 01:36:06 +02:00
|
|
|
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
|
|
|
|
2015-07-24 02:12:10 +02:00
|
|
|
$$(_dbj_jar_no_dex) : $$(_dbj_src_jar) | $(ACP)
|
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
|
|
|
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
|