From 7d61116cc1b636a0a19d1b7f0451f6c2fbb78516 Mon Sep 17 00:00:00 2001 From: Kousik Kumar Date: Thu, 16 Apr 2020 12:43:40 -0700 Subject: [PATCH] Use soong_zip instead of jar to generate .jar files in javac actions This is to make the jar-output deterministic so that we can get cache-hits for r8/d8 actions from RBE. Change-Id: I911ee702fa5dabfe7122e82b21f78c811a0c960d Test: m droid checkbuild --- core/definitions.mk | 2 +- core/host_dalvik_java_library.mk | 1 + core/host_java_library.mk | 1 + core/java.mk | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/definitions.mk b/core/definitions.mk index b714bdb02..b3e2a3b83 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2093,7 +2093,7 @@ $(if $(PRIVATE_JAR_PACKAGES), \ $(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) rm -rf \ $(foreach pkg, $(PRIVATE_JAR_EXCLUDE_PACKAGES), \ $(PRIVATE_CLASS_INTERMEDIATES_DIR)/$(subst .,/,$(pkg)))) -$(hide) $(JAR) -cf $@ $(call jar-args-sorted-files-in-directory,$(PRIVATE_CLASS_INTERMEDIATES_DIR)) +$(hide) $(SOONG_ZIP) -jar -o $@ -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) -D $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@)) endef diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk index 5021510a2..da329788e 100644 --- a/core/host_dalvik_java_library.mk +++ b/core/host_dalvik_java_library.mk @@ -99,6 +99,7 @@ $(full_classes_compiled_jar): \ $(NORMALIZE_PATH) \ $(JAR_ARGS) \ $(ZIPSYNC) \ + $(SOONG_ZIP) \ | $(SOONG_JAVAC_WRAPPER) $(transform-host-java-to-dalvik-package) diff --git a/core/host_java_library.mk b/core/host_java_library.mk index 8998d525e..f9abe9bc4 100644 --- a/core/host_java_library.mk +++ b/core/host_java_library.mk @@ -90,6 +90,7 @@ $(full_classes_compiled_jar): \ $(ZIPTIME) \ $(JAR_ARGS) \ $(ZIPSYNC) \ + $(SOONG_ZIP) \ | $(SOONG_JAVAC_WRAPPER) $(transform-host-java-to-package) $(remove-timestamps-from-package) diff --git a/core/java.mk b/core/java.mk index 44e005d8d..6798efa6a 100644 --- a/core/java.mk +++ b/core/java.mk @@ -296,6 +296,7 @@ $(full_classes_compiled_jar): \ $(NORMALIZE_PATH) \ $(JAR_ARGS) \ $(ZIPSYNC) \ + $(SOONG_ZIP) \ | $(SOONG_JAVAC_WRAPPER) @echo "Target Java: $@ $(call compile-java,$(TARGET_JAVAC),$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES))