From b2c5558435b6628b6500be9f197269f95a89c983 Mon Sep 17 00:00:00 2001 From: Yohann Roussel Date: Thu, 2 Jul 2015 12:10:17 +0200 Subject: [PATCH 1/3] Clean call-jack and its callers This is possible now that we have the new Jack server. Also fix dependency from dex/jack target to jack script instead of jack.jar. (cherry picked from commit 5e50b342218fe2b9c1af20fd7da3c173bfac0499) Change-Id: I8e7aa5087ba8d73cc93140ddfca8f4ab2f505175 --- core/clear_vars.mk | 1 - core/config.mk | 21 ++------------------- core/definitions.mk | 8 ++++---- core/host_dalvik_java_library.mk | 2 +- core/host_dalvik_static_java_library.mk | 2 +- core/java.mk | 2 +- core/java_common.mk | 1 - core/prebuilt_internal.mk | 2 +- 8 files changed, 10 insertions(+), 29 deletions(-) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index fed91e8d13..e2b8516306 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -109,7 +109,6 @@ LOCAL_ADDITIONAL_JAVA_DIR:= LOCAL_ALLOW_UNDEFINED_SYMBOLS:= LOCAL_DX_FLAGS:= LOCAL_JACK_ENABLED:=$(DEFAULT_JACK_ENABLED) # '' (ie disabled), disabled, full, incremental -LOCAL_JACK_VM_ARGS := $(DEFAULT_JACK_VM_ARGS) LOCAL_JACK_EXTRA_ARGS := $(DEFAULT_JACK_EXTRA_ARGS) LOCAL_JACK_FLAGS:= LOCAL_JILL_FLAGS:= diff --git a/core/config.mk b/core/config.mk index 848a4625c3..70ff9bf72a 100644 --- a/core/config.mk +++ b/core/config.mk @@ -427,9 +427,7 @@ endif # Generic tools. JACK := $(HOST_OUT_EXECUTABLES)/jack JACK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/jack.jar -JACK_LAUNCHER_JAR := $(HOST_OUT_JAVA_LIBRARIES)/jack-launcher.jar JILL_JAR := $(HOST_OUT_JAVA_LIBRARIES)/jill.jar -JACK_MULTIDEX_DEFAULT_PREPROCESSOR := frameworks/multidex/library/resources/JACK-INF/legacyMultidexInstallation.jpp LEX := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/flex/flex-2.5.39 # The default PKGDATADIR built in the prebuilt bison is a relative path @@ -488,27 +486,12 @@ DEFAULT_JACK_ENABLED:=full else DEFAULT_JACK_ENABLED:= endif -ifneq ($(strip $(ANDROID_JACK_VM)),) -JACK_VM := $(ANDROID_JACK_VM) -else -JACK_VM := java -endif # call jack # -# $(1): vm arguments -# $(2): jack perf arguments -ifneq (,$(strip $(filter dist,$(MAKECMDGOALS)))) -JACK_SERVER_LOG_COMMAND := mkdir -p $(DIST_DIR)/logs/; SERVER_LOG=$(DIST_DIR)/logs/jack-server.log -endif +# $(1): jack perf arguments define call-jack -$(JACK_SERVER_LOG_COMMAND) JACK_VM_COMMAND="$(JACK_VM) $(1) $(JAVA_TMPDIR_ARG) -jar $(JACK_LAUNCHER_JAR) " JACK_JAR="$(JACK_JAR)" $(JACK) $(2) +$(JACK) $(1) endef -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VM_ARGS := $(DEFAULT_JACK_VM_ARGS) -ifneq ($(ANDROID_JACK_VM_ARGS),) -DEFAULT_JACK_VM_ARGS := $(ANDROID_JACK_VM_ARGS) -else -DEFAULT_JACK_VM_ARGS := -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation -endif ifneq ($(ANDROID_JACK_EXTRA_ARGS),) DEFAULT_JACK_EXTRA_ARGS := $(ANDROID_JACK_EXTRA_ARGS) else diff --git a/core/definitions.mk b/core/definitions.mk index bdc4fd3f69..c8ccf3c27b 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1877,7 +1877,7 @@ $(hide) if [ -s $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then else \ export tmpEcjArg=""; \ fi; \ -$(call call-jack,$(PRIVATE_JACK_VM_ARGS),$(PRIVATE_JACK_EXTRA_ARGS)) \ +$(call call-jack,$(PRIVATE_JACK_EXTRA_ARGS)) \ $(strip $(PRIVATE_JACK_FLAGS)) \ $(if $(NO_OPTIMIZE_DX), \ -D jack.dex.optimize="false") \ @@ -1896,7 +1896,7 @@ $(call call-jack,$(PRIVATE_JACK_VM_ARGS),$(PRIVATE_JACK_EXTRA_ARGS)) \ $(addprefix --config-jarjar ,$(strip $(PRIVATE_JARJAR_RULES))) \ $(if $(PRIVATE_JACK_PROGUARD_FLAGS),--config-proguard $@.flags) \ $$tmpEcjArg \ - || ( rm -rf $(PRIVATE_CLASSES_JACK); rm -rf $(PRIVATE_JACK_INTERMEDIATES_DIR); exit 41 ) + || ( rm -rf $(PRIVATE_CLASSES_JACK); exit 41 ) $(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/classes*.dex $(dir $@) $(hide) rm -f $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list $(if $(PRIVATE_EXTRA_JAR_ARGS),$(hide) rm -rf $@.res.tmp) @@ -1912,7 +1912,7 @@ define transform-jar-to-jack $(hide) mkdir -p $@.tmpjill.res $(hide) $(call unzip-jar-files,$<,$@.tmpjill.res) $(hide) find $@.tmpjill.res -iname "*.class" -delete - $(hide) $(call call-jack,$(PRIVATE_JACK_VM_ARGS),$(PRIVATE_JACK_EXTRA_ARGS)) \ + $(hide) $(call call-jack,$(PRIVATE_JACK_EXTRA_ARGS)) \ -D jack.import.resource.policy=keep-first \ -D jack.import.type.policy=keep-first \ --import $@.tmpjill.jack \ @@ -1956,7 +1956,7 @@ $(hide) if [ -s $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then else \ export tmpEcjArg=""; \ fi; \ -$(call call-jack,$(PRIVATE_JACK_VM_ARGS),$(PRIVATE_JACK_EXTRA_ARGS)) \ +$(call call-jack,$(PRIVATE_JACK_EXTRA_ARGS)) \ $(strip $(PRIVATE_JACK_FLAGS)) \ $(if $(NO_OPTIMIZE_DX), \ -D jack.dex.optimize="false") \ diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk index 37355b5a19..c6fbb9fb3d 100644 --- a/core/host_dalvik_java_library.mk +++ b/core/host_dalvik_java_library.mk @@ -125,7 +125,7 @@ $(built_dex): PRIVATE_CLASSES_JACK := $(full_classes_jack) $(built_dex): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS) $(built_dex): $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \ $(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_MODULE_MAKEFILE_DEP) \ - $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK_JAR) $(JACK_LAUNCHER_JAR) + $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK) @echo Building with Jack: $@ $(jack-java-to-dex) diff --git a/core/host_dalvik_static_java_library.mk b/core/host_dalvik_static_java_library.mk index 8255e5ea1c..6c2ddb5b5d 100644 --- a/core/host_dalvik_static_java_library.mk +++ b/core/host_dalvik_static_java_library.mk @@ -48,7 +48,7 @@ endif $(full_classes_jack): $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \ $(jar_manifest_file) $(layers_file) $(LOCAL_MODULE_MAKEFILE_DEP) \ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \ - $(JACK_JAR) $(JACK_LAUNCHER_JAR) + $(JACK) @echo Building with Jack: $@ $(java-to-jack) diff --git a/core/java.mk b/core/java.mk index f78bee2ffe..2cf42cb800 100644 --- a/core/java.mk +++ b/core/java.mk @@ -648,7 +648,7 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \ $(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) $(proguard_flag_files) \ $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \ - $(LOCAL_MODULE_MAKEFILE_DEP) $(JACK_JAR) $(JACK_LAUNCHER_JAR) + $(LOCAL_MODULE_MAKEFILE_DEP) $(JACK) ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true) $(full_classes_jack): $(jack_all_deps) diff --git a/core/java_common.mk b/core/java_common.mk index 6d5c2dd07c..e3d2853d2b 100644 --- a/core/java_common.mk +++ b/core/java_common.mk @@ -259,7 +259,6 @@ full_static_jack_libs := \ JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/classes.jack) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JACK_LIBRARIES := $(full_static_jack_libs) -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VM_ARGS := $(LOCAL_JACK_VM_ARGS) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_EXTRA_ARGS := $(LOCAL_JACK_EXTRA_ARGS) ifndef LOCAL_IS_HOST_MODULE diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index 034b5ece70..505bd45de2 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -313,7 +313,7 @@ endif # TARGET JAVA_LIBRARIES ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES) $(intermediates.COMMON)/classes.jack : PRIVATE_JILL_FLAGS:=$(LOCAL_JILL_FLAGS) $(intermediates.COMMON)/classes.jack : $(my_src_jar) $(LOCAL_MODULE_MAKEFILE_DEP) \ - $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JILL_JAR) $(JACK_JAR) $(JACK_LAUNCHER_JAR) + $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JILL_JAR) $(JACK) $(transform-jar-to-jack) endif # JAVA_LIBRARIES From 8998d57404b73bf4df059542df4dc52631db45c9 Mon Sep 17 00:00:00 2001 From: Yohann Roussel Date: Fri, 3 Jul 2015 15:46:51 +0200 Subject: [PATCH 2/3] Allow control of jack used for compilation Version of Jack used to compile a module can now be control from a dedicated mk located in prebuilts/sdk/tools Bug: 24564814 (cherry picked from commit b68c9a498d1e2c631eb6e8c9092d4d5775402083) Change-Id: I7809dc966026ff94b5cb2daa7e2c63762ca4768d --- core/config.mk | 6 ------ core/configure_local_jack.mk | 8 ++++++++ core/definitions.mk | 7 +++++++ core/host_dalvik_java_library.mk | 1 + core/host_dalvik_static_java_library.mk | 1 + core/java.mk | 1 + core/main.mk | 6 ++++++ 7 files changed, 24 insertions(+), 6 deletions(-) diff --git a/core/config.mk b/core/config.mk index 70ff9bf72a..8863064ad1 100644 --- a/core/config.mk +++ b/core/config.mk @@ -486,12 +486,6 @@ DEFAULT_JACK_ENABLED:=full else DEFAULT_JACK_ENABLED:= endif -# call jack -# -# $(1): jack perf arguments -define call-jack -$(JACK) $(1) -endef ifneq ($(ANDROID_JACK_EXTRA_ARGS),) DEFAULT_JACK_EXTRA_ARGS := $(ANDROID_JACK_EXTRA_ARGS) else diff --git a/core/configure_local_jack.mk b/core/configure_local_jack.mk index 98b13d22e9..d903ed981e 100644 --- a/core/configure_local_jack.mk +++ b/core/configure_local_jack.mk @@ -17,7 +17,9 @@ ifdef ANDROID_FORCE_JACK_ENABLED LOCAL_JACK_ENABLED := $(ANDROID_FORCE_JACK_ENABLED) endif + LOCAL_JACK_ENABLED := $(strip $(LOCAL_JACK_ENABLED)) + ifneq ($(LOCAL_JACK_ENABLED),full) ifneq ($(LOCAL_JACK_ENABLED),incremental) ifdef LOCAL_JACK_ENABLED @@ -28,3 +30,9 @@ endif LOCAL_JACK_ENABLED := endif endif + +ifdef $(LOCAL_MODULE).JACK_VERSION +LOCAL_JACK_VERSION := $($(LOCAL_MODULE).JACK_VERSION) +else +LOCAL_JACK_VERSION := $(JACK_DEFAULT_VERSION) +endif diff --git a/core/definitions.mk b/core/definitions.mk index c8ccf3c27b..872f7dbda5 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1777,6 +1777,13 @@ define unzip-jar-files $(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,;rm -rf $(2)/META-INF) endef +# Call jack +# +# $(1): jack extra arguments +define call-jack + JACK_VERSION=$(PRIVATE_JACK_VERSION) $(JACK) $(1) +endef + # Common definition to invoke javac on the host and target. # # Some historical notes: diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk index c6fbb9fb3d..59ecf4e198 100644 --- a/core/host_dalvik_java_library.mk +++ b/core/host_dalvik_java_library.mk @@ -123,6 +123,7 @@ endif $(built_dex): PRIVATE_CLASSES_JACK := $(full_classes_jack) $(built_dex): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS) +$(built_dex): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION) $(built_dex): $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \ $(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_MODULE_MAKEFILE_DEP) \ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK) diff --git a/core/host_dalvik_static_java_library.mk b/core/host_dalvik_static_java_library.mk index 6c2ddb5b5d..6248e1a0c1 100644 --- a/core/host_dalvik_static_java_library.mk +++ b/core/host_dalvik_static_java_library.mk @@ -35,6 +35,7 @@ include $(BUILD_SYSTEM)/host_java_library.mk # proguard is not supported # *.proto files are not supported $(full_classes_jack): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS) +$(full_classes_jack): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION) $(full_classes_jack): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES) $(full_classes_jack): \ PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc diff --git a/core/java.mk b/core/java.mk index 2cf42cb800..f9305df7ea 100644 --- a/core/java.mk +++ b/core/java.mk @@ -644,6 +644,7 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_PROGUARD_FLAGS := endif # LOCAL_PROGUARD_ENABLED defined $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION) jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \ $(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) $(proguard_flag_files) \ diff --git a/core/main.mk b/core/main.mk index 86104922ab..e20128b86f 100644 --- a/core/main.mk +++ b/core/main.mk @@ -312,6 +312,12 @@ TARGET_BUILD_JAVA_SUPPORT_LEVEL := platform # The pdk (Platform Development Kit) build include build/core/pdk_config.mk +# +# ----------------------------------------------------------------- +# Jack version configuration +include $(TOPDIR)prebuilts/sdk/tools/jack_versions.mk +include $(TOPDIR)prebuilts/sdk/tools/jack_for_module.mk + # ----------------------------------------------------------------- ### ### In this section we set up the things that are different From 6528ea30869e28ca04c48664f2315611701faa94 Mon Sep 17 00:00:00 2001 From: Yohann Roussel Date: Mon, 12 Oct 2015 18:02:51 +0200 Subject: [PATCH 3/3] Remove LOCAL_JACK_EXTRA_ARGS Use of DEFAULT_JACK_EXTRA_ARGS and LOCAL_JACK_FLAGS provides all needed support. (cherry picked from commit d2b2983cc791f90a0d052699603723335ab94f5a) Change-Id: I1cd76836792e7332bc3750408a860400b0957485 --- core/clear_vars.mk | 1 - core/definitions.mk | 9 ++++----- core/java_common.mk | 1 - 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index e2b8516306..6cf344f294 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -109,7 +109,6 @@ LOCAL_ADDITIONAL_JAVA_DIR:= LOCAL_ALLOW_UNDEFINED_SYMBOLS:= LOCAL_DX_FLAGS:= LOCAL_JACK_ENABLED:=$(DEFAULT_JACK_ENABLED) # '' (ie disabled), disabled, full, incremental -LOCAL_JACK_EXTRA_ARGS := $(DEFAULT_JACK_EXTRA_ARGS) LOCAL_JACK_FLAGS:= LOCAL_JILL_FLAGS:= LOCAL_CERTIFICATE:= diff --git a/core/definitions.mk b/core/definitions.mk index 872f7dbda5..a036a25306 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1779,9 +1779,8 @@ endef # Call jack # -# $(1): jack extra arguments define call-jack - JACK_VERSION=$(PRIVATE_JACK_VERSION) $(JACK) $(1) + JACK_VERSION=$(PRIVATE_JACK_VERSION) $(JACK) $(DEFAULT_JACK_EXTRA_ARGS) endef # Common definition to invoke javac on the host and target. @@ -1884,7 +1883,7 @@ $(hide) if [ -s $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then else \ export tmpEcjArg=""; \ fi; \ -$(call call-jack,$(PRIVATE_JACK_EXTRA_ARGS)) \ +$(call call-jack) \ $(strip $(PRIVATE_JACK_FLAGS)) \ $(if $(NO_OPTIMIZE_DX), \ -D jack.dex.optimize="false") \ @@ -1919,7 +1918,7 @@ define transform-jar-to-jack $(hide) mkdir -p $@.tmpjill.res $(hide) $(call unzip-jar-files,$<,$@.tmpjill.res) $(hide) find $@.tmpjill.res -iname "*.class" -delete - $(hide) $(call call-jack,$(PRIVATE_JACK_EXTRA_ARGS)) \ + $(hide) $(call call-jack) \ -D jack.import.resource.policy=keep-first \ -D jack.import.type.policy=keep-first \ --import $@.tmpjill.jack \ @@ -1963,7 +1962,7 @@ $(hide) if [ -s $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then else \ export tmpEcjArg=""; \ fi; \ -$(call call-jack,$(PRIVATE_JACK_EXTRA_ARGS)) \ +$(call call-jack) \ $(strip $(PRIVATE_JACK_FLAGS)) \ $(if $(NO_OPTIMIZE_DX), \ -D jack.dex.optimize="false") \ diff --git a/core/java_common.mk b/core/java_common.mk index e3d2853d2b..9d810962db 100644 --- a/core/java_common.mk +++ b/core/java_common.mk @@ -259,7 +259,6 @@ full_static_jack_libs := \ JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/classes.jack) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JACK_LIBRARIES := $(full_static_jack_libs) -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_EXTRA_ARGS := $(LOCAL_JACK_EXTRA_ARGS) ifndef LOCAL_IS_HOST_MODULE ifeq ($(LOCAL_SDK_VERSION),)