From abfa40776f126c1c2ef5b070ef59a5a9a30807a9 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 9 Oct 2017 15:46:15 -0700 Subject: [PATCH] Add hostdex support for soong When LOCAL_IS_HOST_MODULE is set LOCAL_BUILT_MODULE is the same as common_javalib.jar, and dexpreopting shouldn't be enabled. Bug: 67600882 Test: m -j checkbuild Change-Id: I7397fa430ebc18d5cb6ba71b06e343180f09ae08 --- core/soong_java_prebuilt.mk | 38 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk index 8226d5085..b251d7c6b 100644 --- a/core/soong_java_prebuilt.mk +++ b/core/soong_java_prebuilt.mk @@ -35,30 +35,34 @@ endif endif # TURBINE_DISABLED != false ifdef LOCAL_SOONG_DEX_JAR - $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar))) + ifndef LOCAL_IS_HOST_MODULE + $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar))) - # defines built_odex along with rule to install odex - include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk + # defines built_odex along with rule to install odex + include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk - ifdef LOCAL_DEX_PREOPT - ifneq ($(dexpreopt_boot_jar_module),) # boot jar - # boot jar's rules are defined in dex_preopt.mk - dexpreopted_boot_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module)_nodex.jar - $(eval $(call copy-one-file,$(dexpreopted_boot_jar),$(LOCAL_BUILT_MODULE))) + ifdef LOCAL_DEX_PREOPT + ifneq ($(dexpreopt_boot_jar_module),) # boot jar + # boot jar's rules are defined in dex_preopt.mk + dexpreopted_boot_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module)_nodex.jar + $(eval $(call copy-one-file,$(dexpreopted_boot_jar),$(LOCAL_BUILT_MODULE))) - # For libart boot jars, we don't have .odex files. - else # ! boot jar - $(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE) - # Use pattern rule - we may have multiple built odex files. + # For libart boot jars, we don't have .odex files. + else # ! boot jar + $(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE) + # Use pattern rule - we may have multiple built odex files. $(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar) @echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)" $(call dexpreopt-one-file,$<,$@) - $(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_DEX_PREOPT))) - endif # ! boot jar - else # LOCAL_DEX_PREOPT - $(eval $(call copy-one-file,$(common_javalib.jar),$(LOCAL_BUILT_MODULE))) - endif # LOCAL_DEX_PREOPT + $(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_DEX_PREOPT))) + endif # ! boot jar + else # LOCAL_DEX_PREOPT + $(eval $(call copy-one-file,$(common_javalib.jar),$(LOCAL_BUILT_MODULE))) + endif # LOCAL_DEX_PREOPT + else # LOCAL_IS_HOST_MODULE + $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(LOCAL_BUILT_MODULE))) + endif java-dex : $(LOCAL_BUILT_MODULE) else