Add support for jacoco in soong

Use jacoco values exported from soong and copy
jacoco-report-classes.jar to where the jacoco-report-classes-all.jar
rule can find it.

Bug: 69629238
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true SKIP_BOOT_JARS_CHECK=true WITH_DEXPREOPT=false
Change-Id: If05381f415fb52a575746b8be0bfcd03d55b2153
This commit is contained in:
Colin Cross 2017-11-22 16:04:55 -08:00
parent 98341ab6d6
commit 3fec81d978
4 changed files with 9 additions and 12 deletions

View File

@ -226,6 +226,9 @@ LOCAL_SDK_RES_VERSION:=
LOCAL_SDK_VERSION:=
LOCAL_SHARED_ANDROID_LIBRARIES:=
LOCAL_SHARED_LIBRARIES:=
LOCAL_SOONG_HEADER_JAR :=
LOCAL_SOONG_DEX_JAR :=
LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=
# '',true
LOCAL_SOURCE_FILES_ALL_GENERATED:=
LOCAL_SRC_FILES:=

View File

@ -658,7 +658,6 @@ RELOCATION_PACKER := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/relocation
FINDBUGS_DIR := external/owasp/sanitizer/tools/findbugs/bin
FINDBUGS := $(FINDBUGS_DIR)/findbugs
JACOCO_CLI_JAR := $(HOST_OUT_JAVA_LIBRARIES)/jacoco-cli$(COMMON_JAVA_PACKAGE_SUFFIX)
# Tool to merge AndroidManifest.xmls
ANDROID_MANIFEST_MERGER := $(JAVA) -classpath prebuilts/devtools/tools/lib/manifest-merger.jar com.android.manifmerger.Main merge

View File

@ -21,7 +21,6 @@
# determine Jacoco include/exclude filters even when coverage is not enabled
# to get syntax checking on LOCAL_JACK_COVERAGE_(INCLUDE|EXCLUDE)_FILTER
DEFAULT_JACOCO_EXCLUDE_FILTER := org/junit/*,org/jacoco/*,org/mockito/*
# copy filters from Jack but also skip some known java packages
my_include_filter := $(strip $(LOCAL_JACK_COVERAGE_INCLUDE_FILTER))
my_exclude_filter := $(strip $(DEFAULT_JACOCO_EXCLUDE_FILTER),$(LOCAL_JACK_COVERAGE_EXCLUDE_FILTER))

View File

@ -2,6 +2,7 @@
# Extra inputs:
# LOCAL_SOONG_HEADER_JAR
# LOCAL_SOONG_DEX_JAR
# LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
$(call pretty-error,soong_java_prebuilt.mk may only be used from Soong)
@ -18,13 +19,12 @@ full_classes_jar := $(intermediates.COMMON)/classes.jar
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
common_javalib.jar := $(intermediates.COMMON)/javalib.jar
LOCAL_FULL_CLASSES_PRE_JACOCO_JAR := $(LOCAL_PREBUILT_MODULE_FILE)
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(full_classes_jar)))
#######################################
include $(BUILD_SYSTEM)/jacoco.mk
#######################################
$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(full_classes_jar)))
ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
$(eval $(call copy-one-file,$(LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR),\
$(intermediates.COMMON)/jacoco-report-classes.jar))
endif
ifneq ($(TURBINE_DISABLED),false)
ifdef LOCAL_SOONG_HEADER_JAR
@ -94,7 +94,3 @@ my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
my_common := COMMON
include $(BUILD_SYSTEM)/link_type.mk
endif # !LOCAL_IS_HOST_MODULE
# Built in equivalent to include $(CLEAR_VARS)
LOCAL_SOONG_HEADER_JAR :=
LOCAL_SOONG_DEX_JAR :=