Turn missing jarjar output files into errors
Jarjar doesn't exit with a nonzero return code when there is a syntax error in a rules file and doesn't write the output file. Without a nonzero return code ninja prints a warning but continues, which leads to stale results on incremental builds where the output file already exists, or delayed errors on clean builds whre the output file didn't exist. Delete the output file before running jarjar, and then check if it exists after running jarjar. Fixes: 119516143 Test: m out/target/common/obj/JAVA_LIBRARIES/noto-emoji-compat-java_intermediates/classes-jarjar.jar Change-Id: Ib99167403948ee11f039dd4d2d7e63052bb92136
This commit is contained in:
parent
bff5273dd0
commit
a1271eb343
|
@ -2138,6 +2138,17 @@ $(hide) $(ZIPTIME) $@.tmp
|
||||||
$(hide) $(call commit-change-for-toc,$@)
|
$(hide) $(call commit-change-for-toc,$@)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# Runs jarjar on an input file. Jarjar doesn't exit with a nonzero return code
|
||||||
|
# when there is a syntax error in a rules file and doesn't write the output
|
||||||
|
# file, so removes the output file before running jarjar and check if it exists
|
||||||
|
# after running jarjar.
|
||||||
|
define transform-jarjar
|
||||||
|
echo $($(PRIVATE_PREFIX)DISPLAY) JarJar: $@
|
||||||
|
rm -f $@
|
||||||
|
$(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
|
||||||
|
[ -e $@ ] || (echo "Missing output file"; exit 1)
|
||||||
|
endef
|
||||||
|
|
||||||
# Moves $1.tmp to $1 if necessary. This is designed to be used with
|
# Moves $1.tmp to $1 if necessary. This is designed to be used with
|
||||||
# .KATI_RESTAT. For kati, this function doesn't update the timestamp
|
# .KATI_RESTAT. For kati, this function doesn't update the timestamp
|
||||||
# of $1 when $1.tmp is identical to $1 so that ninja won't rebuild
|
# of $1 when $1.tmp is identical to $1 so that ninja won't rebuild
|
||||||
|
|
|
@ -125,8 +125,7 @@ $(full_classes_turbine_jar): \
|
||||||
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
||||||
$(full_classes_header_jarjar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
$(full_classes_header_jarjar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
||||||
$(full_classes_header_jarjar): $(full_classes_turbine_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
$(full_classes_header_jarjar): $(full_classes_turbine_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
||||||
@echo Header JarJar: $@
|
$(call transform-jarjar)
|
||||||
$(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
|
|
||||||
else
|
else
|
||||||
full_classes_header_jarjar := $(full_classes_turbine_jar)
|
full_classes_header_jarjar := $(full_classes_turbine_jar)
|
||||||
endif
|
endif
|
||||||
|
@ -149,8 +148,7 @@ $(full_classes_combined_jar): $(full_classes_compiled_jar) \
|
||||||
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
||||||
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
||||||
$(full_classes_jarjar_jar): $(full_classes_combined_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
$(full_classes_jarjar_jar): $(full_classes_combined_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
||||||
@echo JarJar: $@
|
$(call transform-jarjar)
|
||||||
$(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
|
|
||||||
else
|
else
|
||||||
full_classes_jarjar_jar := $(full_classes_combined_jar)
|
full_classes_jarjar_jar := $(full_classes_combined_jar)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -113,8 +113,7 @@ $(full_classes_combined_jar): $(full_classes_compiled_jar) \
|
||||||
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
||||||
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
||||||
$(full_classes_jarjar_jar): $(full_classes_combined_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
$(full_classes_jarjar_jar): $(full_classes_combined_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
||||||
@echo JarJar: $@
|
$(call transform-jarjar)
|
||||||
$(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
|
|
||||||
else
|
else
|
||||||
full_classes_jarjar_jar := $(full_classes_combined_jar)
|
full_classes_jarjar_jar := $(full_classes_combined_jar)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -253,8 +253,7 @@ $(full_classes_turbine_jar): \
|
||||||
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
||||||
$(full_classes_header_jarjar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
$(full_classes_header_jarjar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
||||||
$(full_classes_header_jarjar): $(full_classes_turbine_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
$(full_classes_header_jarjar): $(full_classes_turbine_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
||||||
@echo Header JarJar: $@
|
$(call transform-jarjar)
|
||||||
$(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
|
|
||||||
else
|
else
|
||||||
full_classes_header_jarjar := $(full_classes_turbine_jar)
|
full_classes_header_jarjar := $(full_classes_turbine_jar)
|
||||||
endif
|
endif
|
||||||
|
@ -334,8 +333,7 @@ endif
|
||||||
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
||||||
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
||||||
$(full_classes_jarjar_jar): $(full_classes_processed_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
$(full_classes_jarjar_jar): $(full_classes_processed_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
||||||
@echo JarJar: $@
|
$(call transform-jarjar)
|
||||||
$(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
|
|
||||||
else
|
else
|
||||||
full_classes_jarjar_jar := $(full_classes_processed_jar)
|
full_classes_jarjar_jar := $(full_classes_processed_jar)
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue