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
This commit is contained in:
Colin Cross 2020-02-12 14:14:27 -08:00
parent 4475590a45
commit d81f4b3461
1 changed files with 2 additions and 7 deletions

View File

@ -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