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.
Change-Id: I1ddc91b416de5929d4d4b41824c6012b32f94deb
diff --git a/core/definitions.mk b/core/definitions.mk
index ecb638b..f63ca16 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1589,9 +1589,10 @@
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) \
@@ -1651,11 +1652,7 @@
#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.