forked from openkylin/platform_build
am 8a3f514d: Merge "Split the rules to build the odex file"
* commit '8a3f514d44e2c1d4920126b3edd47f7a7616b732': Split the rules to build the odex file
This commit is contained in:
commit
a72e6f80e4
|
@ -1679,10 +1679,10 @@ endef
|
|||
# so we need to give it something.
|
||||
define create-empty-package
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) touch $(dir $@)/dummy
|
||||
$(hide) touch $(dir $@)dummy
|
||||
$(hide) (cd $(dir $@) && jar cf $(notdir $@) dummy)
|
||||
$(hide) zip -qd $@ dummy
|
||||
$(hide) rm $(dir $@)/dummy
|
||||
$(hide) rm $(dir $@)dummy
|
||||
endef
|
||||
|
||||
#TODO: we kinda want to build different asset packages for
|
||||
|
|
|
@ -103,11 +103,10 @@ else
|
|||
my_dex_preopt_image_location := $($(LOCAL_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION)
|
||||
endif
|
||||
my_dex_preopt_image_filename := $(call get-image-file-path,$($(LOCAL_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH),$(my_dex_preopt_image_location))
|
||||
# $(built_odex) is byproduct of $(LOCAL_BUILT_MODULE)
|
||||
$(LOCAL_BUILT_MODULE) $(built_odex): PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
|
||||
$(LOCAL_BUILT_MODULE) $(built_odex): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
|
||||
$(LOCAL_BUILT_MODULE) $(built_odex): PRIVATE_DEX_PREOPT_IMAGE_LOCATION := $(my_dex_preopt_image_location)
|
||||
$(LOCAL_BUILT_MODULE) $(built_odex) : $($(LOCAL_2ND_ARCH_VAR_PREFIX)DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT) \
|
||||
$(built_odex): PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
|
||||
$(built_odex): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
|
||||
$(built_odex): PRIVATE_DEX_PREOPT_IMAGE_LOCATION := $(my_dex_preopt_image_location)
|
||||
$(built_odex) : $($(LOCAL_2ND_ARCH_VAR_PREFIX)DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT) \
|
||||
$(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS) \
|
||||
$(my_dex_preopt_image_filename)
|
||||
installed_odex := $(call get-odex-file-path,$($(LOCAL_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH),$(LOCAL_INSTALLED_MODULE))
|
||||
|
@ -116,13 +115,11 @@ endif # libart
|
|||
endif # boot jar
|
||||
|
||||
ifdef built_odex
|
||||
# We need $(LOCAL_BUILT_MODULE) in the deps to enforce reinstallation
|
||||
# even if $(built_odex) is byproduct of $(LOCAL_BUILT_MODULE), such as in package.mk.
|
||||
# Use pattern rule - we may have multiple installed odex files.
|
||||
# Ugly syntax - See the definition get-odex-file-path.
|
||||
$(installed_odex) : $(dir $(LOCAL_INSTALLED_MODULE))%/$(notdir $(word 1,$(installed_odex))) \
|
||||
: $(dir $(LOCAL_BUILT_MODULE))%/$(notdir $(word 1,$(built_odex))) \
|
||||
$(LOCAL_BUILT_MODULE) | $(ACP)
|
||||
| $(ACP)
|
||||
@echo "Install: $@"
|
||||
$(copy-file-to-target)
|
||||
endif
|
||||
|
|
|
@ -336,12 +336,6 @@ $(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\
|
|||
|
||||
# Define the rule to build the actual package.
|
||||
$(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN)
|
||||
ifdef LOCAL_DEX_PREOPT
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_BUILT_ODEX := $(built_odex)
|
||||
|
||||
# built_odex is byproduct of LOCAL_BUILT_MODULE without its own build recipe.
|
||||
$(built_odex) : $(LOCAL_BUILT_MODULE)
|
||||
endif
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries)
|
||||
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abi)
|
||||
ifneq ($(TARGET_BUILD_APPS),)
|
||||
|
@ -371,7 +365,6 @@ ifneq ($(extra_jar_args),)
|
|||
endif
|
||||
$(sign-package)
|
||||
ifdef LOCAL_DEX_PREOPT
|
||||
$(call dexpreopt-one-file,$@,$(PRIVATE_BUILT_ODEX))
|
||||
ifneq (nostripping,$(LOCAL_DEX_PREOPT))
|
||||
$(call dexpreopt-remove-classes.dex,$@)
|
||||
endif
|
||||
|
@ -379,6 +372,18 @@ endif
|
|||
@# Alignment must happen after all other zip operations.
|
||||
$(align-package)
|
||||
|
||||
###############################
|
||||
## Rule to build the odex file
|
||||
ifdef LOCAL_DEX_PREOPT
|
||||
$(built_odex): PRIVATE_DEX_FILE := $(built_dex)
|
||||
$(built_odex) : $(built_dex)
|
||||
$(create-empty-package)
|
||||
$(add-dex-to-package)
|
||||
$(hide) mv $@ $@.input
|
||||
$(call dexpreopt-one-file,$@.input,$@)
|
||||
$(hide) rm $@.input
|
||||
endif
|
||||
|
||||
# Save information about this package
|
||||
PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
|
||||
PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources)
|
||||
|
|
|
@ -162,11 +162,6 @@ LOCAL_DEX_PREOPT := false
|
|||
# defines built_odex along with rule to install odex
|
||||
include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
|
||||
#######################################
|
||||
ifdef LOCAL_DEX_PREOPT
|
||||
$(built_module): PRIVATE_BUILT_ODEX := $(built_odex)
|
||||
# built_odex is byproduct of LOCAL_BUILT_MODULE without its own build recipe.
|
||||
$(built_odex) : $(LOCAL_BUILT_MODULE)
|
||||
endif # LOCAL_DEX_PREOPT
|
||||
# Sign and align non-presigned .apks.
|
||||
$(built_module) : $(my_prebuilt_src_file) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR)
|
||||
$(transform-prebuilt-to-target)
|
||||
|
@ -177,10 +172,19 @@ ifneq ($(LOCAL_CERTIFICATE),PRESIGNED)
|
|||
$(sign-package)
|
||||
endif
|
||||
ifdef LOCAL_DEX_PREOPT
|
||||
$(call dexpreopt-one-file,$@,$(PRIVATE_BUILT_ODEX))
|
||||
ifneq (nostripping,$(LOCAL_DEX_PREOPT))
|
||||
$(call dexpreopt-remove-classes.dex,$@)
|
||||
endif
|
||||
endif
|
||||
$(align-package)
|
||||
|
||||
###############################
|
||||
## Rule to build the odex file
|
||||
ifdef LOCAL_DEX_PREOPT
|
||||
$(built_odex) : $(my_prebuilt_src_file)
|
||||
$(call dexpreopt-one-file,$<,$@)
|
||||
endif
|
||||
|
||||
else # LOCAL_MODULE_CLASS != APPS
|
||||
ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
|
||||
$(built_module) : $(my_prebuilt_src_file)
|
||||
|
|
Loading…
Reference in New Issue