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
diff --git a/core/Makefile b/core/Makefile
index c862e97..35ae4e0 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -4732,13 +4732,8 @@
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