diff --git a/core/definitions.mk b/core/definitions.mk index 1f5c5ce4d..aa2a2a95a 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1997,26 +1997,6 @@ define dump-words-to-file @$(call emit-line,$(wordlist 13001,13500,$(1)),$(2)) @$(if $(wordlist 13501,13502,$(1)),$(error Too many words ($(words $(1))))) endef - -# For a list of jar files, unzip them to a specified directory, -# but make sure that no META-INF files come along for the ride, -# unless PRIVATE_DONT_DELETE_JAR_META_INF is set. -# -# $(1): files to unzip -# $(2): destination directory -define unzip-jar-files - $(hide) for f in $(1); \ - do \ - if [ ! -f $$f ]; then \ - echo Missing file $$f; \ - exit 1; \ - fi; \ - unzip -qo $$f -d $(2); \ - rm -f $(2)/module-info.class; \ - done - $(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,$(hide) rm -rf $(2)/META-INF) -endef - # Return jar arguments to compress files in a given directory # $(1): directory # diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk index 2a251e84e..1545f63cc 100644 --- a/core/host_dalvik_java_library.mk +++ b/core/host_dalvik_java_library.mk @@ -104,7 +104,6 @@ $(full_classes_compiled_jar): \ ifneq ($(TURBINE_ENABLED),false) $(full_classes_turbine_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags) -$(full_classes_turbine_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF) $(full_classes_turbine_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS) $(full_classes_turbine_jar): \ $(java_source_list_file) \ diff --git a/core/host_java_library.mk b/core/host_java_library.mk index c8d2ee78c..f7bf337c6 100644 --- a/core/host_java_library.mk +++ b/core/host_java_library.mk @@ -95,13 +95,15 @@ javac-check : $(full_classes_compiled_jar) javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar) .PHONY: javac-check-$(LOCAL_MODULE) +$(full_classes_combined_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF) $(full_classes_combined_jar): $(full_classes_compiled_jar) \ $(jar_manifest_file) \ $(full_static_java_libs) | $(MERGE_ZIPS) $(if $(PRIVATE_JAR_MANIFEST), $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \ $(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf) $(MERGE_ZIPS) -j --ignore-duplicates $(if $(PRIVATE_JAR_MANIFEST),-m $(dir $@)/manifest.mf) \ - -stripDir META-INF -zipToNotStrip $< $@ $< $(call reverse-list,$(PRIVATE_STATIC_JAVA_LIBRARIES)) + $(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,-stripDir META-INF -zipToNotStrip $<) \ + $@ $< $(call reverse-list,$(PRIVATE_STATIC_JAVA_LIBRARIES)) # Run jarjar if necessary, otherwise just copy the file. ifneq ($(strip $(LOCAL_JARJAR_RULES)),) diff --git a/core/java.mk b/core/java.mk index 66431e952..3433a160f 100644 --- a/core/java.mk +++ b/core/java.mk @@ -244,7 +244,6 @@ ifneq ($(TURBINE_ENABLED),false) $(full_classes_turbine_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags) $(full_classes_turbine_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS) -$(full_classes_turbine_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF) $(full_classes_turbine_jar): \ $(java_source_list_file) \ $(java_sources_deps) \ @@ -278,7 +277,6 @@ $(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annota $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES) $(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES) $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(LOCAL_JAR_EXCLUDE_PACKAGES) -$(full_classes_compiled_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF) $(full_classes_compiled_jar): PRIVATE_JAVA_SOURCE_LIST := $(java_source_list_file) $(full_classes_compiled_jar): PRIVATE_ALL_JAVA_HEADER_LIBRARIES := $(full_java_header_libs) $(full_classes_compiled_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)