Support dx generating multiple dex files.

Dx is now capable of generating multiple dex file in one run.
This capability is not compatible with --output=*.dex so this CL
changes the --output argument to be a directory. This CL also
includes the packaging of the multiple dex files when dx generates
more than one dex file.

(cherry picked from commit 8ffe9c3e79)

Conflicts:
        core/java.mk

Change-Id: I1ddc91b416de5929d4d4b41824c6012b32f94deb
This commit is contained in:
Yohann Roussel 2013-08-20 17:05:27 +02:00
parent 15d0066488
commit e019dfd721
2 changed files with 9 additions and 10 deletions

View File

@ -1671,9 +1671,10 @@ endef
define transform-classes.jar-to-dex
@echo "target Dex: $(PRIVATE_MODULE)"
@mkdir -p $(dir $@)
$(hide) rm -f $(dir $@)/classes*.dex
$(hide) $(DX) \
$(if $(findstring windows,$(HOST_OS)),,-JXms16M -JXmx2048M) \
--dex --output=$@ \
--dex --output=$(dir $@) \
$(incremental_dex) \
$(if $(NO_OPTIMIZE_DX), \
--no-optimize) \
@ -1743,11 +1744,7 @@ endef
#TODO: update the manifest to point to the dex file
define add-dex-to-package
$(if $(filter classes.dex,$(notdir $(PRIVATE_DEX_FILE))),\
$(hide) zip -qj $@ $(PRIVATE_DEX_FILE),\
$(hide) _adtp_classes_dex=$(dir $(PRIVATE_DEX_FILE))classes.dex; \
cp $(PRIVATE_DEX_FILE) $$_adtp_classes_dex && \
zip -qj $@ $$_adtp_classes_dex && rm -f $$_adtp_classes_dex)
$(hide) zip -qj $@ $(dir $(PRIVATE_DEX_FILE))/classes*.dex
endef
# Add java resources added by the current module.

View File

@ -72,10 +72,10 @@ intermediates.COMMON := $(call local-intermediates-dir,COMMON)
# Choose leaf name for the compiled jar file.
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
full_classes_compiled_jar_leaf := classes-no-debug-var.jar
built_dex_intermediate_leaf := classes-no-local.dex
built_dex_intermediate_leaf := no-local
else
full_classes_compiled_jar_leaf := classes-full-debug.jar
built_dex_intermediate_leaf := classes-with-local.dex
built_dex_intermediate_leaf := with-local
endif
ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
@ -96,7 +96,7 @@ emma_intermediates_dir := $(intermediates.COMMON)/emma_out
# only the output directory can be changed
full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(jarjar_leaf)
full_classes_proguard_jar := $(intermediates.COMMON)/$(proguard_jar_leaf)
built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf)
built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf)/classes.dex
full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
ifeq ($(LOCAL_MODULE_CLASS)$(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),APPS)
@ -470,7 +470,9 @@ $(built_dex_intermediate): $(full_classes_proguard_jar) $(DX)
$(transform-classes.jar-to-dex)
$(built_dex): $(built_dex_intermediate) | $(ACP)
@echo Copying: $@
$(hide) $(ACP) -fp $< $@
$(hide) mkdir -p $(dir $@)
$(hide) rm -f $(dir $@)/classes*.dex
$(hide) $(ACP) -fp $(dir $<)/classes*.dex $(dir $@)
ifneq ($(GENERATE_DEX_DEBUG),)
$(install-dex-debug)
endif