From b88011768decee557d6e5a99564d96c569d39604 Mon Sep 17 00:00:00 2001 From: Nan Zhang Date: Wed, 20 Sep 2017 14:56:48 -0700 Subject: [PATCH] Move private_manifest file insertion to jars merging phase. By doing this, the change of private_manifest file won't trigger Javac to re-run during re-build. Bug: b/65455145 Test: m clean && m -j32 Change-Id: Ib90d56daf0be5f31b51e07b7714a933bc5cf4496 --- core/definitions.mk | 7 +------ core/host_dalvik_java_library.mk | 11 ++++++----- core/host_java_library.mk | 7 +++++-- core/java.mk | 12 ++++++------ 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/core/definitions.mk b/core/definitions.mk index a19fc2427..962c0f208 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2269,12 +2269,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)))) -$(if $(PRIVATE_JAR_MANIFEST), \ - $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \ - $(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf && \ - $(JAR) -cfm $@ $(dir $@)/manifest.mf, \ - $(hide) $(JAR) -cf $@) \ - $(call jar-args-sorted-files-in-directory,$(PRIVATE_CLASS_INTERMEDIATES_DIR)) +$(hide) $(JAR) -cf $@ $(call jar-args-sorted-files-in-directory,$(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 e42f499a8..81fddd959 100644 --- a/core/host_dalvik_java_library.mk +++ b/core/host_dalvik_java_library.mk @@ -112,7 +112,6 @@ $(full_classes_compiled_jar): \ $(java_source_list_file) \ $(java_sources_deps) \ $(full_java_header_libs) \ - $(jar_manifest_file) \ $(annotation_processor_deps) \ $(NORMALIZE_PATH) \ $(JAR_ARGS) \ @@ -125,7 +124,6 @@ $(full_classes_turbine_jar): \ $(java_source_list_file) \ $(java_sources_deps) \ $(full_java_header_libs) \ - $(jar_manifest_file) \ $(NORMALIZE_PATH) \ $(JAR_ARGS) \ $(ZIPTIME) \ @@ -149,10 +147,13 @@ $(eval $(call copy-one-file,$(full_classes_header_jarjar),$(full_classes_header_ $(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) - $(MERGE_ZIPS) -j \ - $(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,-stripDir META-INF -zipToNotStrip $<) \ - $@ $< $(call reverse-list,$(PRIVATE_STATIC_JAVA_LIBRARIES)) + $(if $(PRIVATE_JAR_MANIFEST), $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \ + $(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf) + $(MERGE_ZIPS) -j $(if $(PRIVATE_JAR_MANIFEST),-m $(dir $@)/manifest.mf) \ + $(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/host_java_library.mk b/core/host_java_library.mk index 55b6684cb..03dc67c33 100644 --- a/core/host_java_library.mk +++ b/core/host_java_library.mk @@ -82,7 +82,6 @@ $(full_classes_compiled_jar): \ $(java_source_list_file) \ $(java_sources_deps) \ $(full_java_libs) \ - $(jar_manifest_file) \ $(annotation_processor_deps) \ $(NORMALIZE_PATH) \ $(ZIPTIME) \ @@ -95,8 +94,12 @@ javac-check : $(full_classes_compiled_jar) javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar) $(full_classes_combined_jar): $(full_classes_compiled_jar) \ + $(jar_manifest_file) \ $(full_static_java_libs) | $(MERGE_ZIPS) - $(MERGE_ZIPS) -j -stripDir META-INF -zipToNotStrip $< $@ $< $(call reverse-list,$(PRIVATE_STATIC_JAVA_LIBRARIES)) + $(if $(PRIVATE_JAR_MANIFEST), $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \ + $(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf) + $(MERGE_ZIPS) -j $(if $(PRIVATE_JAR_MANIFEST),-m $(dir $@)/manifest.mf) \ + -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 1e63d48da..f661f062e 100644 --- a/core/java.mk +++ b/core/java.mk @@ -476,7 +476,6 @@ $(full_classes_compiled_jar): \ $(java_source_list_file) \ $(java_sources_deps) \ $(full_java_header_libs) \ - $(jar_manifest_file) \ $(layers_file) \ $(annotation_processor_deps) \ $(NORMALIZE_PATH) \ @@ -490,8 +489,6 @@ $(full_classes_turbine_jar): \ $(java_source_list_file) \ $(java_sources_deps) \ $(full_java_header_libs) \ - $(jar_manifest_file) \ - $(layers_file) \ $(NORMALIZE_PATH) \ $(JAR_ARGS) \ $(ZIPTIME) \ @@ -518,10 +515,13 @@ javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar) $(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) - $(MERGE_ZIPS) -j \ - $(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,-stripDir META-INF -zipToNotStrip $<) \ - $@ $< $(call reverse-list,$(PRIVATE_STATIC_JAVA_LIBRARIES)) + $(if $(PRIVATE_JAR_MANIFEST), $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \ + $(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf) + $(MERGE_ZIPS) -j $(if $(PRIVATE_JAR_MANIFEST),-m $(dir $@)/manifest.mf) \ + $(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,-stripDir META-INF -zipToNotStrip $<) \ + $@ $< $(call reverse-list,$(PRIVATE_STATIC_JAVA_LIBRARIES)) ifdef LOCAL_JAR_PROCESSOR # LOCAL_JAR_PROCESSOR_ARGS must be evaluated here to set up the rule-local