From d81f4b3461ef02437bff7d9788768d20db88ee16 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 12 Feb 2020 14:14:27 -0800 Subject: [PATCH] Support empty jacoco-report-classes.jar If EMMA_INSTRUMENT is turned on but no APKs were built the rule to collect jacoco-report-classes.jar would error with missing directories and an empty zip file. Switch to soong_zip, which doesn't error on empty zip files, and hide the errors if $(TARGET_COMMON_OUT_ROOT) or $(HOST_COMMON_OUT_ROOT) don't exist. Test: m EMMA_INSTRUMENT=true TARGET_BUILD_APPS=Camera2 Change-Id: I09e30e37dc38f32f55b3f91bfc4d12c9e753083f --- core/Makefile | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/core/Makefile b/core/Makefile index c862e97c7..35ae4e0ea 100644 --- a/core/Makefile +++ b/core/Makefile @@ -4732,13 +4732,8 @@ ifeq (true,$(EMMA_INSTRUMENT)) JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar $(JACOCO_REPORT_CLASSES_ALL) : @echo "Collecting uninstrumented classes" - $(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" | \ - zip -@ -0 -q -X $@ -# Meaning of these options: -# -@ scan stdin for file paths to add to the zip -# -0 don't do any compression -# -q supress most output -# -X skip storing extended file attributes + find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" 2>/dev/null | sort > $@.list + $(SOONG_ZIP) -o $@ -L 0 -C $(OUT_DIR) -P out -l $@.list endif # EMMA_INSTRUMENT=true