From a73ea16f9537246c0303ec919ab0b7fe2789a294 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 15 Mar 2018 16:26:08 -0700 Subject: [PATCH] Replace extract_srcjars.sh with zipsync Use zipsync instead of extract_srcjars.sh. Also fixes an issue where unzipping a resource zip would ignore anything that wasn't a *.java file. Bug: 73885582 Test: m checkbuild Change-Id: I1c25f65afa196614879071c8655866febebac185 Merged-In: I1c25f65afa196614879071c8655866febebac185 (cherry picked from commit 3f99cd5933952e08f2fc085f98b4d8eac7ae5ada) --- core/aapt2.mk | 2 +- core/definitions.mk | 10 ++++------ core/droiddoc.mk | 11 +++++------ core/host_dalvik_java_library.mk | 2 +- core/host_java_library.mk | 2 +- core/java.mk | 2 +- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/core/aapt2.mk b/core/aapt2.mk index 895bd371f..7d9d8ceb8 100644 --- a/core/aapt2.mk +++ b/core/aapt2.mk @@ -52,7 +52,7 @@ endif ifneq ($(my_generated_res_zips),) my_zipped_resources_flata := $(my_compiled_res_base_dir)/zip_res.flata $(my_zipped_resources_flata): PRIVATE_SOURCE_RES_ZIPS := $(my_generated_res_zips) -$(my_zipped_resources_flata) : $(my_generated_res_deps) $(AAPT2) $(EXTRACT_SRCJARS) +$(my_zipped_resources_flata) : $(my_generated_res_deps) $(AAPT2) $(ZIPSYNC) @echo "AAPT2 compile $@ <- $(PRIVATE_SOURCE_RES_ZIPS)" $(call aapt2-compile-resource-zips) diff --git a/core/definitions.mk b/core/definitions.mk index 96f6c5906..e6bd19424 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2082,9 +2082,7 @@ endef # TODO(b/74574557): use aapt2 compile --zip if it gets implemented define aapt2-compile-resource-zips @mkdir -p $(dir $@) -rm -rf $@.contents -mkdir -p $@.contents -$(EXTRACT_SRCJARS) $@.contents $@.list $(PRIVATE_SOURCE_RES_ZIPS) +$(ZIPSYNC) -d $@.contents -l $@.list $(PRIVATE_SOURCE_RES_ZIPS) $(hide) $(AAPT2) compile -o $@ --dir $@.tmp $(PRIVATE_AAPT2_CFLAGS) --legacy endef @@ -2237,11 +2235,11 @@ endef # $(2): classpath_libs define compile-java $(hide) rm -f $@ -$(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(PRIVATE_ANNO_INTERMEDIATES_DIR) $(if $(PRIVATE_SRCJARS),$(PRIVATE_SRCJAR_INTERMEDIATES_DIR)) +$(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(PRIVATE_ANNO_INTERMEDIATES_DIR) $(hide) mkdir -p $(dir $@) -$(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(PRIVATE_ANNO_INTERMEDIATES_DIR) $(if $(PRIVATE_SRCJARS),$(PRIVATE_SRCJAR_INTERMEDIATES_DIR)) +$(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(PRIVATE_ANNO_INTERMEDIATES_DIR) $(if $(PRIVATE_SRCJARS),\ - $(EXTRACT_SRCJARS) $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) $(PRIVATE_SRCJAR_LIST_FILE) $(PRIVATE_SRCJARS)) + $(ZIPSYNC) -d $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) -l $(PRIVATE_SRCJAR_LIST_FILE) -f "*.java" $(PRIVATE_SRCJARS)) $(hide) if [ -s $(PRIVATE_JAVA_SOURCE_LIST) $(if $(PRIVATE_SRCJARS),-o -s $(PRIVATE_SRCJAR_LIST_FILE) )] ; then \ $(SOONG_JAVAC_WRAPPER) $(JAVAC_WRAPPER) $(1) -encoding UTF-8 \ $(if $(findstring true,$(PRIVATE_WARNINGS_ENABLE)),$(xlint_unchecked),) \ diff --git a/core/droiddoc.mk b/core/droiddoc.mk index 81154814b..b174f31a4 100644 --- a/core/droiddoc.mk +++ b/core/droiddoc.mk @@ -189,15 +189,15 @@ $(full_target): \ $(droiddoc) \ $(html_dir_files) \ $(full_java_libs) \ - $(EXTRACT_SRCJARS) \ + $(ZIPSYNC) \ $(LOCAL_SRCJARS) \ $(LOCAL_ADDITIONAL_DEPENDENCIES) @echo Docs droiddoc: $(PRIVATE_OUT_DIR) $(hide) mkdir -p $(dir $@) - $(hide) rm -rf $(PRIVATE_STUB_OUT_DIR) $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) + $(hide) rm -rf $(PRIVATE_STUB_OUT_DIR) $(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \ $(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR)) - $(EXTRACT_SRCJARS) $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) $(PRIVATE_SRCJAR_LIST_FILE) $(PRIVATE_SRCJARS) + $(ZIPSYNC) -d $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) -l $(PRIVATE_SRCJAR_LIST_FILE) -f "*.java" $(PRIVATE_SRCJARS) $(hide) ( \ $(JAVADOC) \ -encoding UTF-8 \ @@ -243,13 +243,12 @@ else # For OpenJDK 8 we can use -bootclasspath to define the core libraries code. $(full_target): PRIVATE_BOOTCLASSPATH_ARG := $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) endif -$(full_target): $(full_src_files) $(LOCAL_GENERATED_SOURCES) $(full_java_libs) $(EXTRACT_SRCJARS) $(LOCAL_SRCJARS) $(LOCAL_ADDITIONAL_DEPENDENCIES) +$(full_target): $(full_src_files) $(LOCAL_GENERATED_SOURCES) $(full_java_libs) $(ZIPSYNC) $(LOCAL_SRCJARS) $(LOCAL_ADDITIONAL_DEPENDENCIES) @echo Docs javadoc: $(PRIVATE_OUT_DIR) @mkdir -p $(dir $@) - rm -rf $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) $(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \ $(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR)) - $(EXTRACT_SRCJARS) $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) $(PRIVATE_SRCJAR_LIST_FILE) $(PRIVATE_SRCJARS) + $(ZIPSYNC) -d $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) -l $(PRIVATE_SRCJAR_LIST_FILE) -f "*.java" $(PRIVATE_SRCJARS) $(hide) ( \ $(JAVADOC) \ -encoding UTF-8 \ diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk index fc5b75c0c..1ef0ccb17 100644 --- a/core/host_dalvik_java_library.mk +++ b/core/host_dalvik_java_library.mk @@ -99,7 +99,7 @@ $(full_classes_compiled_jar): \ $(annotation_processor_deps) \ $(NORMALIZE_PATH) \ $(JAR_ARGS) \ - $(EXTRACT_SRCJARS) \ + $(ZIPSYNC) \ | $(SOONG_JAVAC_WRAPPER) $(transform-host-java-to-dalvik-package) diff --git a/core/host_java_library.mk b/core/host_java_library.mk index 462ff6a75..32295ab19 100644 --- a/core/host_java_library.mk +++ b/core/host_java_library.mk @@ -86,7 +86,7 @@ $(full_classes_compiled_jar): \ $(NORMALIZE_PATH) \ $(ZIPTIME) \ $(JAR_ARGS) \ - $(EXTRACT_SRCJARS) \ + $(ZIPSYNC) \ | $(SOONG_JAVAC_WRAPPER) $(transform-host-java-to-package) $(remove-timestamps-from-package) diff --git a/core/java.mk b/core/java.mk index efe99f8bb..019a989ee 100644 --- a/core/java.mk +++ b/core/java.mk @@ -461,7 +461,7 @@ $(full_classes_compiled_jar): \ $(annotation_processor_deps) \ $(NORMALIZE_PATH) \ $(JAR_ARGS) \ - $(EXTRACT_SRCJARS) \ + $(ZIPSYNC) \ | $(SOONG_JAVAC_WRAPPER) @echo "Target Java: $@ $(call compile-java,$(TARGET_JAVAC),$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES))