Merge "Support code coverage with Jack" am: 4dad88980f
am: 7b02e64148
* commit '7b02e64148e6a1c0355d715b2a8034061f0d2837':
Support code coverage with Jack
This commit is contained in:
commit
8192d3b821
|
@ -2033,6 +2033,7 @@ else \
|
|||
fi; \
|
||||
$(call call-jack) \
|
||||
$(strip $(PRIVATE_JACK_FLAGS)) \
|
||||
$(strip $(PRIVATE_JACK_COVERAGE_OPTIONS)) \
|
||||
$(if $(NO_OPTIMIZE_DX), \
|
||||
-D jack.dex.optimize="false") \
|
||||
$(if $(PRIVATE_RMTYPEDEFS), \
|
||||
|
|
13
core/java.mk
13
core/java.mk
|
@ -500,7 +500,11 @@ common_proguard_flags := \
|
|||
ifeq ($(filter nosystem,$(LOCAL_PROGUARD_ENABLED)),)
|
||||
common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.flags
|
||||
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
|
||||
ifdef LOCAL_JACK_ENABLED
|
||||
common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.jacoco.flags
|
||||
else
|
||||
common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.emma.flags
|
||||
endif # LOCAL_JACK_ENABLED
|
||||
endif
|
||||
# If this is a test package, add proguard keep flags for tests.
|
||||
ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),)
|
||||
|
@ -671,6 +675,15 @@ $(built_dex).toc: $(full_classes_jack)
|
|||
else #LOCAL_IS_STATIC_JAVA_LIBRARY
|
||||
$(built_dex_intermediate): PRIVATE_CLASSES_JACK := $(full_classes_jack)
|
||||
|
||||
ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
|
||||
$(built_dex_intermediate): PRIVATE_JACK_COVERAGE_OPTIONS := \
|
||||
-D jack.coverage="true" \
|
||||
-D jack.coverage.metadata.file=$(intermediates.COMMON)/coverage.em \
|
||||
-D jack.coverage.jacoco.package=$(JACOCO_PACKAGE_NAME)
|
||||
else
|
||||
$(built_dex_intermediate): PRIVATE_JACK_COVERAGE_OPTIONS :=
|
||||
endif
|
||||
|
||||
$(built_dex_intermediate): $(jack_all_deps) | setup-jack-server
|
||||
@echo Building with Jack: $@
|
||||
$(jack-java-to-dex)
|
||||
|
|
|
@ -47,7 +47,12 @@ endif
|
|||
ifeq (true,$(EMMA_INSTRUMENT))
|
||||
ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
|
||||
ifeq (true,$(EMMA_INSTRUMENT_STATIC))
|
||||
ifdef LOCAL_JACK_ENABLED
|
||||
# Jack supports coverage with Jacoco
|
||||
LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent
|
||||
else
|
||||
LOCAL_STATIC_JAVA_LIBRARIES += emma
|
||||
endif # LOCAL_JACK_ENABLED
|
||||
endif # LOCAL_EMMA_INSTRUMENT
|
||||
endif # EMMA_INSTRUMENT_STATIC
|
||||
else
|
||||
|
|
|
@ -334,6 +334,11 @@ include build/core/pdk_config.mk
|
|||
# Install and start Jack server
|
||||
-include $(TOPDIR)prebuilts/sdk/tools/jack_server_setup.mk
|
||||
|
||||
#
|
||||
# -----------------------------------------------------------------
|
||||
# Jacoco package name for Jack
|
||||
-include $(TOPDIR)external/jacoco/config.mk
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
###
|
||||
### In this section we set up the things that are different
|
||||
|
|
|
@ -216,12 +216,22 @@ endif # EMMA_INSTRUMENT is true
|
|||
|
||||
ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
|
||||
ifeq (true,$(EMMA_INSTRUMENT_STATIC))
|
||||
ifdef LOCAL_JACK_ENABLED
|
||||
# Jack supports coverage with Jacoco
|
||||
LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent
|
||||
else
|
||||
LOCAL_STATIC_JAVA_LIBRARIES += emma
|
||||
endif # LOCAL_JACK_ENABLED
|
||||
else
|
||||
ifdef LOCAL_SDK_VERSION
|
||||
ifdef TARGET_BUILD_APPS
|
||||
# In unbundled build merge the emma library into the apk.
|
||||
ifdef LOCAL_JACK_ENABLED
|
||||
# Jack supports coverage with Jacoco
|
||||
LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent
|
||||
else
|
||||
LOCAL_STATIC_JAVA_LIBRARIES += emma
|
||||
endif # LOCAL_JACK_ENABLED
|
||||
else
|
||||
# If build against the SDK in full build, core.jar is not used,
|
||||
# we have to use prebiult emma.jar to make Proguard happy;
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# Keep everything for the emma classes
|
||||
-keep class com.vladium.** {
|
||||
*;
|
||||
}
|
||||
# Keep everything for the jacoco classes
|
||||
-keep class org.jacoco.** {
|
||||
*;
|
||||
}
|
Loading…
Reference in New Issue