Merge "Use dx.jar directly"

am: c68434c971

Change-Id: Ief2c88d3ba0e93c7eb7bb9db0ac2b0a0b886bcea
This commit is contained in:
Colin Cross 2017-07-17 20:45:31 +00:00 committed by android-build-merger
commit 4828fcad41
4 changed files with 20 additions and 13 deletions

View File

@ -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

View File

@ -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), \

View File

@ -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)

View File

@ -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