2013-11-15 07:44:56 +00:00
|
|
|
# dexpreopt_odex_install.mk is used to define odex creation rules for JARs and APKs
|
|
|
|
# This file depends on variables set in base_rules.mk
|
|
|
|
# Output variables: LOCAL_DEX_PREOPT, built_odex, dexpreopt_boot_jar_module
|
|
|
|
|
|
|
|
# Setting LOCAL_DEX_PREOPT based on WITH_DEXPREOPT, LOCAL_DEX_PREOPT, etc
|
|
|
|
LOCAL_DEX_PREOPT := $(strip $(LOCAL_DEX_PREOPT))
|
|
|
|
ifneq (true,$(WITH_DEXPREOPT))
|
|
|
|
LOCAL_DEX_PREOPT :=
|
|
|
|
else # WITH_DEXPREOPT=true
|
|
|
|
ifeq (,$(TARGET_BUILD_APPS)) # TARGET_BUILD_APPS empty
|
2014-01-04 00:24:56 +00:00
|
|
|
ifndef LOCAL_DEX_PREOPT # LOCAL_DEX_PREOPT undefined
|
2014-07-09 17:57:32 +00:00
|
|
|
ifneq ($(filter $(TARGET_OUT)/%,$(my_module_path)),) # Installed to system.img.
|
|
|
|
ifeq (,$(LOCAL_APK_LIBRARIES)) # LOCAL_APK_LIBRARIES empty
|
2014-10-08 01:07:23 +00:00
|
|
|
# If we have product-specific config for this module?
|
|
|
|
ifeq (disable,$(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG))
|
|
|
|
LOCAL_DEX_PREOPT := false
|
|
|
|
else
|
|
|
|
LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
|
|
|
|
endif
|
2014-07-09 17:57:32 +00:00
|
|
|
else # LOCAL_APK_LIBRARIES not empty
|
|
|
|
LOCAL_DEX_PREOPT := nostripping
|
|
|
|
endif # LOCAL_APK_LIBRARIES not empty
|
|
|
|
endif # Installed to system.img.
|
2014-01-04 00:24:56 +00:00
|
|
|
endif # LOCAL_DEX_PREOPT undefined
|
2013-11-15 07:44:56 +00:00
|
|
|
endif # TARGET_BUILD_APPS empty
|
|
|
|
endif # WITH_DEXPREOPT=true
|
|
|
|
ifeq (false,$(LOCAL_DEX_PREOPT))
|
|
|
|
LOCAL_DEX_PREOPT :=
|
|
|
|
endif
|
|
|
|
ifdef LOCAL_UNINSTALLABLE_MODULE
|
|
|
|
LOCAL_DEX_PREOPT :=
|
|
|
|
endif
|
2014-10-08 21:48:07 +00:00
|
|
|
ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file))) # contains no java code
|
2013-11-15 07:44:56 +00:00
|
|
|
LOCAL_DEX_PREOPT :=
|
|
|
|
endif
|
2014-08-05 00:09:41 +00:00
|
|
|
# if WITH_DEXPREOPT_BOOT_IMG_ONLY=true and module is not in boot class path skip
|
|
|
|
ifeq (true,$(WITH_DEXPREOPT_BOOT_IMG_ONLY))
|
|
|
|
ifeq ($(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE)),)
|
|
|
|
LOCAL_DEX_PREOPT :=
|
|
|
|
endif
|
|
|
|
endif
|
2016-06-16 21:47:10 +00:00
|
|
|
# if installing into system, and odex are being installed into system_other, don't strip
|
|
|
|
ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
|
|
|
|
ifeq ($(LOCAL_DEX_PREOPT),true)
|
|
|
|
ifneq ($(filter $(foreach f,$(SYSTEM_OTHER_ODEX_FILTER),$(TARGET_OUT)/$(f)),$(my_module_path)),)
|
|
|
|
LOCAL_DEX_PREOPT := nostripping
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2013-11-15 07:44:56 +00:00
|
|
|
|
|
|
|
built_odex :=
|
2016-08-25 12:50:15 +00:00
|
|
|
built_vdex :=
|
2017-02-09 02:30:31 +00:00
|
|
|
built_art :=
|
2013-11-15 07:44:56 +00:00
|
|
|
installed_odex :=
|
2016-08-25 12:50:15 +00:00
|
|
|
installed_vdex :=
|
2017-02-09 02:30:31 +00:00
|
|
|
installed_art :=
|
2014-05-19 20:03:36 +00:00
|
|
|
built_installed_odex :=
|
2016-08-25 12:50:15 +00:00
|
|
|
built_installed_vdex :=
|
2017-02-09 02:30:31 +00:00
|
|
|
built_installed_art :=
|
|
|
|
|
2013-11-15 07:44:56 +00:00
|
|
|
ifdef LOCAL_DEX_PREOPT
|
|
|
|
dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE))
|
|
|
|
ifdef dexpreopt_boot_jar_module
|
|
|
|
# For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
|
|
|
|
# We use this installed_odex trick to get boot.art installed.
|
|
|
|
installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
|
2014-05-13 20:57:28 +00:00
|
|
|
# Append the odex for the 2nd arch if we have one.
|
|
|
|
installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
|
2013-11-15 07:44:56 +00:00
|
|
|
else # boot jar
|
2014-05-13 20:57:28 +00:00
|
|
|
ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
|
2015-03-10 00:17:51 +00:00
|
|
|
# For a Java library, by default we build odex for both 1st arch and 2nd arch.
|
|
|
|
# But it can be overridden with "LOCAL_MULTILIB := first".
|
|
|
|
ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
|
|
|
|
# For system server jars, we build for only "first".
|
|
|
|
my_module_multilib := first
|
|
|
|
else
|
|
|
|
my_module_multilib := $(LOCAL_MULTILIB)
|
|
|
|
endif
|
2014-05-13 20:57:28 +00:00
|
|
|
# #################################################
|
|
|
|
# Odex for the 1st arch
|
2014-09-13 18:26:39 +00:00
|
|
|
my_2nd_arch_prefix :=
|
|
|
|
include $(BUILD_SYSTEM)/setup_one_odex.mk
|
2014-05-13 20:57:28 +00:00
|
|
|
# #################################################
|
|
|
|
# Odex for the 2nd arch
|
|
|
|
ifdef TARGET_2ND_ARCH
|
2016-04-20 18:53:39 +00:00
|
|
|
ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
|
2015-03-10 00:17:51 +00:00
|
|
|
ifneq (first,$(my_module_multilib))
|
2014-09-13 18:26:39 +00:00
|
|
|
my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
|
|
|
|
include $(BUILD_SYSTEM)/setup_one_odex.mk
|
2015-03-10 00:17:51 +00:00
|
|
|
endif # my_module_multilib is not first.
|
2016-04-20 18:53:39 +00:00
|
|
|
endif # TARGET_TRANSLATE_2ND_ARCH not true
|
2014-05-13 20:57:28 +00:00
|
|
|
endif # TARGET_2ND_ARCH
|
|
|
|
# #################################################
|
|
|
|
else # must be APPS
|
2014-09-13 18:26:39 +00:00
|
|
|
# The preferred arch
|
|
|
|
my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
|
|
|
|
include $(BUILD_SYSTEM)/setup_one_odex.mk
|
2014-09-15 18:45:52 +00:00
|
|
|
ifdef TARGET_2ND_ARCH
|
2014-09-13 18:26:39 +00:00
|
|
|
ifeq ($(LOCAL_MULTILIB),both)
|
|
|
|
# The non-preferred arch
|
|
|
|
my_2nd_arch_prefix := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),,$(TARGET_2ND_ARCH_VAR_PREFIX))
|
|
|
|
include $(BUILD_SYSTEM)/setup_one_odex.mk
|
|
|
|
endif # LOCAL_MULTILIB is both
|
2014-09-15 18:45:52 +00:00
|
|
|
endif # TARGET_2ND_ARCH
|
2014-05-13 20:57:28 +00:00
|
|
|
endif # LOCAL_MODULE_CLASS
|
2014-09-15 18:45:52 +00:00
|
|
|
endif # boot jar
|
2013-11-15 07:44:56 +00:00
|
|
|
|
2016-03-11 18:32:01 +00:00
|
|
|
built_odex := $(strip $(built_odex))
|
2016-08-25 12:50:15 +00:00
|
|
|
built_vdex := $(strip $(built_vdex))
|
2017-02-09 02:30:31 +00:00
|
|
|
built_art := $(strip $(built_art))
|
2016-03-11 18:32:01 +00:00
|
|
|
installed_odex := $(strip $(installed_odex))
|
2016-08-25 12:50:15 +00:00
|
|
|
installed_vdex := $(strip $(installed_vdex))
|
2017-02-09 02:30:31 +00:00
|
|
|
installed_art := $(strip $(installed_art))
|
2016-03-11 18:32:01 +00:00
|
|
|
|
2013-11-15 07:44:56 +00:00
|
|
|
ifdef built_odex
|
2017-03-03 19:17:36 +00:00
|
|
|
|
|
|
|
ifndef LOCAL_DEX_PREOPT_GENERATE_PROFILE
|
|
|
|
ifeq (true,$(WITH_DEX_PREOPT_GENERATE_PROFILE))
|
|
|
|
LOCAL_DEX_PREOPT_GENERATE_PROFILE := true
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
|
|
|
|
ifndef LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING
|
|
|
|
$(call pretty-error,Must have specified class listing (LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING))
|
|
|
|
endif
|
|
|
|
my_built_profile := $(dir $(LOCAL_BUILT_MODULE))/profile.prof
|
|
|
|
my_dex_location := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
|
|
|
|
$(built_odex): $(my_built_profile)
|
|
|
|
$(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS := --profile-file=$(my_built_profile)
|
2017-03-20 20:54:41 +00:00
|
|
|
$(my_built_profile): PRIVATE_BUILT_MODULE := $(LOCAL_BUILT_MODULE)
|
2017-03-03 19:17:36 +00:00
|
|
|
$(my_built_profile): PRIVATE_DEX_LOCATION := $(my_dex_location)
|
|
|
|
$(my_built_profile): PRIVATE_SOURCE_CLASSES := $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)
|
|
|
|
$(my_built_profile): $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)
|
|
|
|
$(my_built_profile): $(PROFMAN)
|
2017-03-20 20:54:41 +00:00
|
|
|
$(my_built_profile): $(LOCAL_BUILT_MODULE)
|
2017-03-03 19:17:36 +00:00
|
|
|
$(my_built_profile):
|
|
|
|
$(hide) mkdir -p $(dir $@)
|
|
|
|
ANDROID_LOG_TAGS="*:e" $(PROFMAN) \
|
|
|
|
--create-profile-from=$(PRIVATE_SOURCE_CLASSES) \
|
2017-03-20 20:54:41 +00:00
|
|
|
--apk=$(PRIVATE_BUILT_MODULE) \
|
2017-03-03 19:17:36 +00:00
|
|
|
--dex-location=$(PRIVATE_DEX_LOCATION) \
|
|
|
|
--reference-profile-file=$@
|
|
|
|
else
|
|
|
|
$(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS :=
|
|
|
|
endif
|
|
|
|
|
2014-10-08 01:07:23 +00:00
|
|
|
ifndef LOCAL_DEX_PREOPT_FLAGS
|
|
|
|
LOCAL_DEX_PREOPT_FLAGS := $(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG)
|
|
|
|
ifndef LOCAL_DEX_PREOPT_FLAGS
|
|
|
|
LOCAL_DEX_PREOPT_FLAGS := $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)
|
|
|
|
endif
|
|
|
|
endif
|
2017-03-22 12:36:05 +00:00
|
|
|
|
|
|
|
# Jars of system server, and apps loaded into system server should be
|
|
|
|
# compiled with the 'speed' compiler filter.
|
|
|
|
ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS) $(PRODUCT_SYSTEM_SERVER_APPS),$(LOCAL_MODULE)))
|
|
|
|
LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed
|
|
|
|
endif
|
|
|
|
|
2014-10-08 01:07:23 +00:00
|
|
|
$(built_odex): PRIVATE_DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS)
|
2016-08-25 12:50:15 +00:00
|
|
|
$(built_vdex): $(built_odex)
|
2017-02-09 02:30:31 +00:00
|
|
|
$(built_art): $(built_odex)
|
2013-11-15 07:44:56 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Add the installed_odex to the list of installed files for this module.
|
2014-05-19 20:03:36 +00:00
|
|
|
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
|
2016-08-25 12:50:15 +00:00
|
|
|
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_vdex)
|
2017-02-09 02:30:31 +00:00
|
|
|
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_art)
|
2014-05-19 20:03:36 +00:00
|
|
|
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_odex)
|
2016-08-25 12:50:15 +00:00
|
|
|
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_vdex)
|
2017-02-09 02:30:31 +00:00
|
|
|
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_art)
|
2014-05-19 20:03:36 +00:00
|
|
|
|
2016-03-11 18:32:01 +00:00
|
|
|
# Record dex-preopt config.
|
|
|
|
DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT := $(LOCAL_DEX_PREOPT)
|
|
|
|
DEXPREOPT.$(LOCAL_MODULE).MULTILIB := $(LOCAL_MULTILIB)
|
|
|
|
DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS)
|
|
|
|
DEXPREOPT.$(LOCAL_MODULE).PRIVILEGED_MODULE := $(LOCAL_PRIVILEGED_MODULE)
|
2017-03-21 01:31:17 +00:00
|
|
|
DEXPREOPT.$(LOCAL_MODULE).VENDOR_MODULE := $(LOCAL_VENDOR_MODULE)
|
2016-03-11 18:32:01 +00:00
|
|
|
DEXPREOPT.$(LOCAL_MODULE).TARGET_ARCH := $(LOCAL_MODULE_TARGET_ARCH)
|
|
|
|
DEXPREOPT.$(LOCAL_MODULE).INSTALLED := $(installed_odex)
|
|
|
|
DEXPREOPT.$(LOCAL_MODULE).INSTALLED_STRIPPED := $(LOCAL_INSTALLED_MODULE)
|
|
|
|
DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS) := $(sort \
|
|
|
|
$(DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS)) $(LOCAL_MODULE))
|
|
|
|
|
|
|
|
|
2016-08-25 12:50:15 +00:00
|
|
|
# Make sure to install the .odex and .vdex when you run "make <module_name>"
|
2017-02-09 02:30:31 +00:00
|
|
|
$(my_all_targets): $(installed_odex) $(installed_vdex) $(installed_art)
|
2014-01-23 00:50:21 +00:00
|
|
|
|
2013-11-15 07:44:56 +00:00
|
|
|
endif # LOCAL_DEX_PREOPT
|