aboutsummaryrefslogtreecommitdiff
path: root/report-internal.mk
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2019-11-19 14:49:34 -0800
committerColin Cross <ccross@android.com>2019-11-19 14:49:34 -0800
commit72f772acb389b6ab8572aa5f46d9a92a646ec727 (patch)
treeda5a443e57f159bc0a6654952e40e97d3642b906 /report-internal.mk
parentf8966c57ab194f9f5dd2e8a2a074202f30d076d7 (diff)
downloadrobolectric-shadows-72f772acb389b6ab8572aa5f46d9a92a646ec727.tar.gz
Hide failures in jacoco report generation
Jacoco report generation can fail if the jacoco data from the test was corrupted, don't fail the rule and make sure the output file exists. Bug: 138617205 Test: m RunCarMediaCommonRoboTests-jacoco with injected failure Change-Id: I0037a03dd05429aebda0ad90122eab2d4678bc82
Diffstat (limited to 'report-internal.mk')
-rw-r--r--report-internal.mk6
1 files changed, 5 insertions, 1 deletions
diff --git a/report-internal.mk b/report-internal.mk
index d5a12630a..a12479c97 100644
--- a/report-internal.mk
+++ b/report-internal.mk
@@ -18,7 +18,10 @@ $(my_coverage_output): PRIVATE_COVERAGE_REPORT_JAR := $(my_coverage_report_jar)
$(my_coverage_output): PRIVATE_REPORT_DIR := $(my_report_dir)
# Generate the coverage report.
+# Touches the output file and continues on failure to avoid breaking the build when a test fails to
+# generate coverage data.
$(my_coverage_output): $(my_collect_file) $(my_coverage_report_jar)
+ $(hide) rm -f $@
$(hide) rm -rf $(PRIVATE_REPORT_DIR)
$(hide) mkdir -p $(PRIVATE_REPORT_DIR)
$(hide) $(JAVA) \
@@ -29,7 +32,8 @@ $(my_coverage_output): $(my_collect_file) $(my_coverage_report_jar)
--name $(PRIVATE_MODULE) \
--report-dir $(PRIVATE_REPORT_DIR)/ \
$(PRIVATE_SRC_ARGS) \
- >$(PRIVATE_REPORT_DIR)/reporter.txt 2>&1
+ >$(PRIVATE_REPORT_DIR)/reporter.txt 2>&1 \
+ || touch $@
@echo "Coverage report: file://"$(realpath $(PRIVATE_REPORT_DIR))"/index.html"