diff --git a/core/config.mk b/core/config.mk index 8f1f09073..e7b02de37 100644 --- a/core/config.mk +++ b/core/config.mk @@ -499,6 +499,11 @@ prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin USE_PREBUILT_SDK_TOOLS_IN_PLACE := true +# TODO(ccross): remove this once the build server no longer references it +ifdef DX_ALT_JAR +DX_JAR := DX_ALT_JAR +endif + # # Tools that are prebuilts for TARGET_BUILD_APPS # @@ -506,24 +511,16 @@ ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK))) AIDL := $(HOST_OUT_EXECUTABLES)/aidl AAPT := $(HOST_OUT_EXECUTABLES)/aapt AAPT2 := $(HOST_OUT_EXECUTABLES)/aapt2 + DX_JAR ?= $(HOST_OUT_JAVA_LIBRARIES)/dx.jar MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX) SIGNAPK_JNI_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES) ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign - - 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 else # TARGET_BUILD_APPS || TARGET_BUILD_PDK AIDL := $(prebuilt_sdk_tools_bin)/aidl AAPT := $(prebuilt_sdk_tools_bin)/aapt AAPT2 := $(prebuilt_sdk_tools_bin)/aapt2 - DX := $(prebuilt_sdk_tools)/dx - DX_COMMAND := $(DX) -JXms16M -JXmx2048M + DX_JAR ?= $(prebuilt_sdk_tools)/lib/dx.jar MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses ZIPALIGN := $(prebuilt_sdk_tools_bin)/zipalign SIGNAPK_JAR := $(prebuilt_sdk_tools)/lib/signapk$(COMMON_JAVA_PACKAGE_SUFFIX) @@ -561,6 +558,16 @@ SOONG_ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/soong_zip ZIP2ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/zip2zip ZIPTIME := $(prebuilt_build_tools_bin)/ziptime +# DX can be overriden on the command line +ifndef DX +#TODO: use a smaller -Xmx value for most libraries; +# only core.jar and framework.jar need a heap this big. +DX := $(JAVA) -Xms16M -Xmx2048M -jar $(DX_JAR) +DX_DEPS := $(DX_JAR) +else +DX_DEPS ?= $(DX) +endif + # --------------------------------------------------------------- # Generic tools. JACK := $(HOST_OUT_EXECUTABLES)/jack diff --git a/core/definitions.mk b/core/definitions.mk index 330d36033..b4bd698ee 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2559,7 +2559,7 @@ define transform-classes.jar-to-dex @echo "target Dex: $(PRIVATE_MODULE)" @mkdir -p $(dir $@) $(hide) rm -f $(dir $@)classes*.dex -$(hide) $(DX_COMMAND) \ +$(hide) $(DX) \ --dex --output=$(dir $@) \ --min-sdk-version=$(call codename-or-sdk-to-sdk,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \ $(if $(NO_OPTIMIZE_DX), \ diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk index 4f3069fb5..94ce5b338 100644 --- a/core/host_dalvik_java_library.mk +++ b/core/host_dalvik_java_library.mk @@ -136,7 +136,7 @@ $(LOCAL_BUILT_MODULE) : $(full_classes_jar) else # !LOCAL_IS_STATIC_JAVA_LIBRARY $(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON) $(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS) -$(built_dex): $(full_classes_jar) $(DX) +$(built_dex): $(full_classes_jar) $(DX_DEPS) $(transform-classes.jar-to-dex) $(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex) diff --git a/core/java.mk b/core/java.mk index 8fde7c2c3..04587e2a3 100644 --- a/core/java.mk +++ b/core/java.mk @@ -669,7 +669,7 @@ $(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS) ifeq ($(LOCAL_EMMA_INSTRUMENT),true) $(built_dex_intermediate): PRIVATE_DX_FLAGS += --no-locals endif -$(built_dex_intermediate): $(full_classes_jar) $(DX) +$(built_dex_intermediate): $(full_classes_jar) $(DX_DEPS) $(transform-classes.jar-to-dex) endif # LOCAL_JACK_ENABLED is disabled