Loading core/definitions.mk +24 −0 Original line number Diff line number Diff line Loading @@ -3290,6 +3290,30 @@ endef # run test $(strip $(call test-validate-paths-are-subdirs)) ########################################################### ## Validate jacoco class filters and convert them to ## file arguments ## Jacoco class filters are comma-separated lists of class ## files (android.app.Application), and may have '*' as the ## last character to match all classes in a package ## including subpackages. define jacoco-class-filter-to-file-args $(strip $(call jacoco-validate-file-args,\ $(subst $(comma),$(space),\ $(subst .,/,\ $(strip $(1)))))) endef define jacoco-validate-file-args $(strip $(1)\ $(call validate-paths-are-subdirs,$(1)) $(foreach arg,$(1),\ $(if $(findstring ?,$(arg)),$(call pretty-error,\ '?' filters are not supported in LOCAL_JACK_COVERAGE_INCLUDE_FILTER or LOCAL_JACK_COVERAGE_EXCLUDE_FILTER))\ $(if $(findstring *,$(patsubst %*,%,$(arg))),$(call pretty-error,\ '*' is only supported at the end of a filter in LOCAL_JACK_COVERAGE_INCLUDE_FILTER or LOCAL_JACK_COVERAGE_EXCLUDE_FILTER))\ )) endef ########################################################### ## Other includes Loading core/jacoco.mk +13 −31 Original line number Diff line number Diff line Loading @@ -19,41 +19,23 @@ # (at the time of authorship, it is included by java.mk and # java_host_library.mk) my_include_filter := my_exclude_filter := ifeq ($(LOCAL_EMMA_INSTRUMENT),true) # determine Jacoco include/exclude filters # 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)) # replace '.' with '/' and ',' with ' ', and quote each arg ifneq ($(strip $(my_include_filter)),) my_include_args := $(strip $(my_include_filter)) my_include_args := $(subst .,/,$(my_include_args)) my_include_args := '$(subst $(comma),' ',$(my_include_args))' else my_include_args := endif my_include_args := $(call jacoco-class-filter-to-file-args, $(my_include_filter)) my_exclude_args := $(call jacoco-class-filter-to-file-args, $(my_exclude_filter)) # replace '.' with '/' and ',' with ' ' ifneq ($(strip $(my_exclude_filter)),) my_exclude_args := $(my_exclude_filter) my_exclude_args := $(subst .,/,$(my_exclude_args)) my_exclude_args := $(subst $(comma)$(comma),$(comma),$(my_exclude_args)) my_exclude_args := $(subst $(comma), ,$(my_exclude_args)) else my_exclude_args := endif # single-quote each arg of the include args so the '*' gets evaluated by zip # don't quote the exclude args they need to be evaluated by bash for rm -rf my_include_args := $(foreach arg,$(my_include_args),'$(arg)') ifeq ($(LOCAL_EMMA_INSTRUMENT),true) my_files := $(intermediates.COMMON)/jacoco $(call validate-paths-are-subdirs,$(my_exclude_args)) # make a task that unzips the classes that we want to instrument from the # input jar my_unzipped_path := $(my_files)/work/classes-to-instrument/classes Loading Loading
core/definitions.mk +24 −0 Original line number Diff line number Diff line Loading @@ -3290,6 +3290,30 @@ endef # run test $(strip $(call test-validate-paths-are-subdirs)) ########################################################### ## Validate jacoco class filters and convert them to ## file arguments ## Jacoco class filters are comma-separated lists of class ## files (android.app.Application), and may have '*' as the ## last character to match all classes in a package ## including subpackages. define jacoco-class-filter-to-file-args $(strip $(call jacoco-validate-file-args,\ $(subst $(comma),$(space),\ $(subst .,/,\ $(strip $(1)))))) endef define jacoco-validate-file-args $(strip $(1)\ $(call validate-paths-are-subdirs,$(1)) $(foreach arg,$(1),\ $(if $(findstring ?,$(arg)),$(call pretty-error,\ '?' filters are not supported in LOCAL_JACK_COVERAGE_INCLUDE_FILTER or LOCAL_JACK_COVERAGE_EXCLUDE_FILTER))\ $(if $(findstring *,$(patsubst %*,%,$(arg))),$(call pretty-error,\ '*' is only supported at the end of a filter in LOCAL_JACK_COVERAGE_INCLUDE_FILTER or LOCAL_JACK_COVERAGE_EXCLUDE_FILTER))\ )) endef ########################################################### ## Other includes Loading
core/jacoco.mk +13 −31 Original line number Diff line number Diff line Loading @@ -19,41 +19,23 @@ # (at the time of authorship, it is included by java.mk and # java_host_library.mk) my_include_filter := my_exclude_filter := ifeq ($(LOCAL_EMMA_INSTRUMENT),true) # determine Jacoco include/exclude filters # 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)) # replace '.' with '/' and ',' with ' ', and quote each arg ifneq ($(strip $(my_include_filter)),) my_include_args := $(strip $(my_include_filter)) my_include_args := $(subst .,/,$(my_include_args)) my_include_args := '$(subst $(comma),' ',$(my_include_args))' else my_include_args := endif my_include_args := $(call jacoco-class-filter-to-file-args, $(my_include_filter)) my_exclude_args := $(call jacoco-class-filter-to-file-args, $(my_exclude_filter)) # replace '.' with '/' and ',' with ' ' ifneq ($(strip $(my_exclude_filter)),) my_exclude_args := $(my_exclude_filter) my_exclude_args := $(subst .,/,$(my_exclude_args)) my_exclude_args := $(subst $(comma)$(comma),$(comma),$(my_exclude_args)) my_exclude_args := $(subst $(comma), ,$(my_exclude_args)) else my_exclude_args := endif # single-quote each arg of the include args so the '*' gets evaluated by zip # don't quote the exclude args they need to be evaluated by bash for rm -rf my_include_args := $(foreach arg,$(my_include_args),'$(arg)') ifeq ($(LOCAL_EMMA_INSTRUMENT),true) my_files := $(intermediates.COMMON)/jacoco $(call validate-paths-are-subdirs,$(my_exclude_args)) # make a task that unzips the classes that we want to instrument from the # input jar my_unzipped_path := $(my_files)/work/classes-to-instrument/classes Loading