Move dexpreopt image selection out of dexpreopt_gen

Instead of passing both the module and global dexpreopt image
selection into dexpreopt_gen, determine the correct dexpreopt
image in Make.  This allows the Make dexpreopt rule to only
depend on the necessary boot images, preventing an order-only
dependency on the 32-bit boot image for a 64-bit only module.

Also stop using the boot image "location" as an input, only
track the real path, which will be converted to the "location"
that dex2oat expects when constructing the command line in
dexpreopt_gen.

Removes support for the unused LOCAL_DEX_PREOPT_IMAGE_LOCATION
variable.

Test: m checkbuild
Change-Id: I2e3e1d30fdfed92fb08e6cc1c9515edf8d99c7f0
This commit is contained in:
Colin Cross 2019-02-08 21:37:12 -08:00
parent 010df4b471
commit 87378f1888
3 changed files with 10 additions and 14 deletions

View file

@ -55,7 +55,6 @@ LOCAL_CXX_STL := default
LOCAL_DEX_PREOPT_APP_IMAGE:=
LOCAL_DEX_PREOPT_FLAGS:=
LOCAL_DEX_PREOPT_GENERATE_PROFILE:=
LOCAL_DEX_PREOPT_IMAGE_LOCATION:=
LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING:=
LOCAL_DEX_PREOPT:= # '',true,false,nostripping
LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG:=

View file

@ -147,10 +147,10 @@ ifeq ($(WRITE_SOONG_VARIABLES),true)
$(call add_json_str, Dex2oatXms, $(DEX2OAT_XMS))
$(call add_json_str, EmptyDirectory, $(OUT_DIR)/empty)
$(call add_json_map, DefaultDexPreoptImageLocation)
$(call add_json_str, $(TARGET_ARCH), $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION))
$(call add_json_map, DefaultDexPreoptImage)
$(call add_json_str, $(TARGET_ARCH), $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME))
ifdef TARGET_2ND_ARCH
$(call add_json_str, $(TARGET_2ND_ARCH), $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION))
$(call add_json_str, $(TARGET_2ND_ARCH), $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME))
endif
$(call end_json_map)
@ -208,12 +208,5 @@ DEXPREOPT_GEN_DEPS := \
DEXPREOPT_GEN_DEPS += $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES)
DEXPREOPT_GEN_DEPS += $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
ifdef TARGET_2ND_ARCH
ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
DEXPREOPT_GEN_DEPS += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
endif
endif
DEXPREOPT_STRIP_DEPS := \
$(ZIP2ZIP) \

View file

@ -117,6 +117,7 @@ ifeq (,$(LOCAL_ENFORCE_USES_LIBRARIES))
endif
my_dexpreopt_archs :=
my_dexpreopt_images :=
ifdef LOCAL_DEX_PREOPT
ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
@ -139,11 +140,13 @@ ifdef LOCAL_DEX_PREOPT
# #################################################
# Odex for the 1st arch
my_dexpreopt_archs += $(TARGET_ARCH)
my_dexpreopt_images += $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
# Odex for the 2nd arch
ifdef TARGET_2ND_ARCH
ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
ifneq (first,$(my_module_multilib))
my_dexpreopt_archs += $(TARGET_2ND_ARCH)
my_dexpreopt_images += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
endif # my_module_multilib is not first.
endif # TARGET_TRANSLATE_2ND_ARCH not true
endif # TARGET_2ND_ARCH
@ -153,11 +156,13 @@ ifdef LOCAL_DEX_PREOPT
# Save the module multilib since setup_one_odex modifies it.
my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
my_dexpreopt_archs += $(TARGET_$(my_2nd_arch_prefix)ARCH)
my_dexpreopt_images += $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
ifdef TARGET_2ND_ARCH
ifeq ($(my_module_multilib),both)
# The non-preferred arch
my_2nd_arch_prefix := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),,$(TARGET_2ND_ARCH_VAR_PREFIX))
my_dexpreopt_archs += $(TARGET_$(my_2nd_arch_prefix)ARCH)
my_dexpreopt_images += $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
endif # LOCAL_MULTILIB is both
endif # TARGET_2ND_ARCH
endif # LOCAL_MODULE_CLASS
@ -194,7 +199,7 @@ ifdef LOCAL_DEX_PREOPT
$(call add_json_str, $(lib), $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/javalib.jar))
$(call end_json_map)
$(call add_json_list, Archs, $(my_dexpreopt_archs))
$(call add_json_str, DexPreoptImageLocation, $(LOCAL_DEX_PREOPT_IMAGE_LOCATION))
$(call add_json_list, DexPreoptImages, $(my_dexpreopt_images))
$(call add_json_bool, PreoptExtractedApk, $(my_preopt_for_extracted_apk))
$(call add_json_bool, NoCreateAppImage, $(filter false,$(LOCAL_DEX_PREOPT_APP_IMAGE)))
$(call add_json_bool, ForceCreateAppImage, $(filter true,$(LOCAL_DEX_PREOPT_APP_IMAGE)))
@ -234,8 +239,7 @@ ifdef LOCAL_DEX_PREOPT
my_dexpreopt_deps += \
$(foreach lib,$(sort $(LOCAL_USES_LIBRARIES) $(LOCAL_OPTIONAL_USES_LIBRARIES) org.apache.http.legacy android.hidl.base-V1.0-java android.hidl.manager-V1.0-java),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/javalib.jar)
my_dexpreopt_deps += $(LOCAL_DEX_PREOPT_IMAGE_LOCATION)
# TODO: default boot images
my_dexpreopt_deps += $(my_dexpreopt_images)
$(my_dexpreopt_zip): PRIVATE_MODULE := $(LOCAL_MODULE)
$(my_dexpreopt_zip): $(my_dexpreopt_deps)