From cd20d5980c348e5b767bf87d1eaceed1d5d0dbe7 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 6 Jul 2017 13:42:00 -0700 Subject: [PATCH] Refactor prebuilt tools Put the prebuilt and non-prebuilt tools selections into the two clauses of an if block to simplify the next patch. Test: m -j checkbuild Change-Id: Idd01bc81a2b619f7fc23df7566a01b46598433a3 --- core/config.mk | 100 +++++++++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 53 deletions(-) diff --git a/core/config.mk b/core/config.mk index aa6ed9b4fc..f839d3d651 100644 --- a/core/config.mk +++ b/core/config.mk @@ -494,39 +494,53 @@ ALLOW_MISSING_DEPENDENCIES := true endif .KATI_READONLY := ALLOW_MISSING_DEPENDENCIES -# -# Tools that are prebuilts for TARGET_BUILD_APPS -# prebuilt_sdk_tools := prebuilts/sdk/tools prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin -AIDL := $(HOST_OUT_EXECUTABLES)/aidl -AAPT := $(HOST_OUT_EXECUTABLES)/aapt -AAPT2 := $(HOST_OUT_EXECUTABLES)/aapt2 -ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign -SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX) -SIGNAPK_JNI_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES) -LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc -BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat -DEPMOD := $(HOST_OUT_EXECUTABLES)/depmod +USE_PREBUILT_SDK_TOOLS_IN_PLACE := true -#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 +# +# Tools that are prebuilts for TARGET_BUILD_APPS +# +ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK))) + AIDL := $(HOST_OUT_EXECUTABLES)/aidl + AAPT := $(HOST_OUT_EXECUTABLES)/aapt + AAPT2 := $(HOST_OUT_EXECUTABLES)/aapt2 + 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 + MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses + ZIPALIGN := $(prebuilt_sdk_tools_bin)/zipalign + SIGNAPK_JAR := $(prebuilt_sdk_tools)/lib/signapk$(COMMON_JAVA_PACKAGE_SUFFIX) + SIGNAPK_JNI_LIBRARY_PATH := $(prebuilt_sdk_tools)/$(HOST_OS)/lib64 +endif # TARGET_BUILD_APPS || TARGET_BUILD_PDK + +ifeq (,$(TARGET_BUILD_APPS)) + # Use RenderScript prebuilts for unbundled builds but not PDK builds + LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc + BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat else -DX := $(DX_ALT_JAR) -DX_COMMAND := $(JAVA) -Xms16M -Xmx2048M -jar $(DX) -endif + LLVM_RS_CC := $(prebuilt_sdk_tools_bin)/llvm-rs-cc + BCC_COMPAT := $(prebuilt_sdk_tools_bin)/bcc_compat +endif # TARGET_BUILD_PDK -MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses - -SOONG_ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/soong_zip -ZIP2ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/zip2zip -FILESLIST := $(SOONG_HOST_OUT_EXECUTABLES)/fileslist - -SOONG_JAVAC_WRAPPER := $(SOONG_HOST_OUT_EXECUTABLES)/soong_javac_wrapper +prebuilt_sdk_tools := +prebuilt_sdk_tools_bin := # Always use prebuilts for ckati and makeparallel prebuilt_build_tools := prebuilts/build-tools @@ -535,38 +549,18 @@ prebuilt_build_tools_bin := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/bin else prebuilt_build_tools_bin := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/asan/bin endif + ACP := $(prebuilt_build_tools_bin)/acp CKATI := $(prebuilt_build_tools_bin)/ckati +DEPMOD := $(HOST_OUT_EXECUTABLES)/depmod +FILESLIST := $(SOONG_HOST_OUT_EXECUTABLES)/fileslist IJAR := $(prebuilt_build_tools_bin)/ijar MAKEPARALLEL := $(prebuilt_build_tools_bin)/makeparallel +SOONG_JAVAC_WRAPPER := $(SOONG_HOST_OUT_EXECUTABLES)/soong_javac_wrapper +SOONG_ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/soong_zip +ZIP2ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/zip2zip ZIPTIME := $(prebuilt_build_tools_bin)/ziptime -USE_PREBUILT_SDK_TOOLS_IN_PLACE := true - -# Override the definitions above for unbundled and PDK builds -ifneq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK))) -AIDL := $(prebuilt_sdk_tools_bin)/aidl -AAPT := $(prebuilt_sdk_tools_bin)/aapt -AAPT2 := $(prebuilt_sdk_tools_bin)/aapt2 -ZIPALIGN := $(prebuilt_sdk_tools_bin)/zipalign -SIGNAPK_JAR := $(prebuilt_sdk_tools)/lib/signapk$(COMMON_JAVA_PACKAGE_SUFFIX) -# Use 64-bit libraries unconditionally because 32-bit JVMs are no longer supported -SIGNAPK_JNI_LIBRARY_PATH := $(prebuilt_sdk_tools)/$(HOST_OS)/lib64 - -DX := $(prebuilt_sdk_tools)/dx -DX_COMMAND := $(DX) -JXms16M -JXmx2048M -MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses - -# Don't use prebuilts in PDK -ifneq ($(TARGET_BUILD_PDK),true) -LLVM_RS_CC := $(prebuilt_sdk_tools_bin)/llvm-rs-cc -BCC_COMPAT := $(prebuilt_sdk_tools_bin)/bcc_compat -endif # TARGET_BUILD_PDK -endif # TARGET_BUILD_APPS || TARGET_BUILD_PDK -prebuilt_sdk_tools := -prebuilt_sdk_tools_bin := - - # --------------------------------------------------------------- # Generic tools. JACK := $(HOST_OUT_EXECUTABLES)/jack