diff --git a/core/config.mk b/core/config.mk index 998899e13..34f2c44e2 100644 --- a/core/config.mk +++ b/core/config.mk @@ -492,7 +492,16 @@ LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat DEPMOD := $(HOST_OUT_EXECUTABLES)/depmod +#TODO: use a smaller -Xmx value for most libraries; +# only core.jar and framework.jar need a heap this big. +ifndef DX_ALT_JAR DX := $(HOST_OUT_EXECUTABLES)/dx +DX_COMMAND := $(DX) -JXms16M -JXmx2048M +else +DX := $(DX_ALT_JAR) +DX_COMMAND := java -Xms16M -Xmx2048M -jar $(DX) +endif + MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses SOONG_ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/soong_zip diff --git a/core/definitions.mk b/core/definitions.mk index 593c14c33..5c39ecaee 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2554,14 +2554,11 @@ $(hide) java -jar $(DESUGAR) \ endef -#TODO: use a smaller -Xmx value for most libraries; -# only core.jar and framework.jar need a heap this big. define transform-classes.jar-to-dex @echo "target Dex: $(PRIVATE_MODULE)" @mkdir -p $(dir $@) $(hide) rm -f $(dir $@)classes*.dex -$(hide) $(DX) \ - -JXms16M -JXmx2048M \ +$(hide) $(DX_COMMAND) \ --dex --output=$(dir $@) \ --min-sdk-version=$(call codename-or-sdk-to-sdk,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \ $(if $(NO_OPTIMIZE_DX), \