Merge "Fix code coverage for apps" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e771251424
@@ -241,21 +241,34 @@ endif # LOCAL_JACK_ENABLED
|
|||||||
else
|
else
|
||||||
ifdef LOCAL_SDK_VERSION
|
ifdef LOCAL_SDK_VERSION
|
||||||
ifdef TARGET_BUILD_APPS
|
ifdef TARGET_BUILD_APPS
|
||||||
# In unbundled build merge the emma library into the apk.
|
# In unbundled build, merge the coverage library into the apk.
|
||||||
ifdef LOCAL_JACK_ENABLED
|
ifdef LOCAL_JACK_ENABLED
|
||||||
# Jack supports coverage with Jacoco
|
# Jack supports coverage with Jacoco
|
||||||
ifneq ($(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),)
|
ifneq ($(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),)
|
||||||
# Only add jacocoagent if the package contains some java code
|
# Only add jacocoagent if the package contains some java code
|
||||||
LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent
|
LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent
|
||||||
|
# Exclude jacoco classes from proguard
|
||||||
|
LOCAL_PROGUARD_FLAGS += -include $(BUILD_SYSTEM)/proguard.jacoco.flags
|
||||||
|
LOCAL_JACK_PROGUARD_FLAGS += -include $(BUILD_SYSTEM)/proguard.jacoco.flags
|
||||||
endif # Contains java code
|
endif # Contains java code
|
||||||
else
|
else
|
||||||
LOCAL_STATIC_JAVA_LIBRARIES += emma
|
LOCAL_STATIC_JAVA_LIBRARIES += emma
|
||||||
endif # LOCAL_JACK_ENABLED
|
endif # LOCAL_JACK_ENABLED
|
||||||
else
|
else
|
||||||
# If build against the SDK in full build, core.jar is not used,
|
# If build against the SDK in full build, core.jar is not used
|
||||||
# we have to use prebiult emma.jar to make Proguard happy;
|
# so coverage classes are not present.
|
||||||
|
ifdef LOCAL_JACK_ENABLED
|
||||||
|
# Jack needs jacoco on the classpath but we do not want it to be in
|
||||||
|
# the final apk. While it is a static library, we add it to the
|
||||||
|
# LOCAL_JAVA_LIBRARIES which are only present on the classpath.
|
||||||
|
# Note: we have nothing to do for proguard since jacoco will be
|
||||||
|
# on the classpath only, thus not modified during the compilation.
|
||||||
|
LOCAL_JAVA_LIBRARIES += jacocoagent
|
||||||
|
else
|
||||||
|
# We have to use prebuilt emma.jar to make Proguard happy;
|
||||||
# Otherwise emma classes are included in core.jar.
|
# Otherwise emma classes are included in core.jar.
|
||||||
LOCAL_PROGUARD_FLAGS += -libraryjars $(EMMA_JAR)
|
LOCAL_PROGUARD_FLAGS += -libraryjars $(EMMA_JAR)
|
||||||
|
endif # LOCAL_JACK_ENABLED
|
||||||
endif # full build
|
endif # full build
|
||||||
endif # LOCAL_SDK_VERSION
|
endif # LOCAL_SDK_VERSION
|
||||||
endif # EMMA_INSTRUMENT_STATIC
|
endif # EMMA_INSTRUMENT_STATIC
|
||||||
|
Reference in New Issue
Block a user