From 69b7f3f0b163f21437feef61f2c2f10c734fea3a Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 14 Sep 2017 14:58:02 -0700 Subject: [PATCH] Move jacocoagent into the bootclasspath Move jacocoagent out of core-libart and into its own jar on the bootclasspath. Test: m -j EMMA_INSTRUMENT=true Test: https://android-build.googleplex.com/builds/view-workplan?viewType=Table&workplanId=L19400000103297394&nodeType=Trybot Change-Id: I9e6e3dc59dba8b93685d59b258d4ebc7835eab8b --- core/envsetup.mk | 8 ++++++++ core/java.mk | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/core/envsetup.mk b/core/envsetup.mk index db6ddd4b59..c99c70ff9b 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -200,6 +200,14 @@ TARGET_COPY_OUT_VENDOR := $(_vendor_path_placeholder) # Set up minimal BOOTCLASSPATH list of jars to build/execute # java code with dalvikvm/art. TARGET_CORE_JARS := core-oj core-libart conscrypt okhttp bouncycastle apache-xml +ifeq ($(EMMA_INSTRUMENT),true) + ifneq ($(EMMA_INSTRUMENT_STATIC),true) + # For instrumented build, if Jacoco is not being included statically + # in instrumented packages then include Jacoco classes into the + # bootclasspath. + TARGET_CORE_JARS += jacocoagent + endif # EMMA_INSTRUMENT_STATIC +endif # EMMA_INSTRUMENT HOST_CORE_JARS := $(addsuffix -hostdex,$(TARGET_CORE_JARS)) ################################################################# diff --git a/core/java.mk b/core/java.mk index cc70368353..8e6f90c3a5 100644 --- a/core/java.mk +++ b/core/java.mk @@ -18,6 +18,19 @@ endif #PDK LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES)) LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION)) +ifneq ($(LOCAL_MODULE),jacocoagent) + ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) + ifeq ($(EMMA_INSTRUMENT),true) + ifneq ($(EMMA_INSTRUMENT_STATIC),true) + # For instrumented build, if Jacoco is not being included statically + # in instrumented packages then include Jacoco classes into the + # bootclasspath. + LOCAL_JAVA_LIBRARIES := jacocoagent $(LOCAL_JAVA_LIBRARIES) + endif # EMMA_INSTRUMENT_STATIC + endif # EMMA_INSTRUMENT + endif # !LOCAL_NO_STANDARD_LIBRARIES +endif # LOCAL_MODULE == jacocoagent + ifneq ($(LOCAL_SDK_VERSION),) ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) $(error $(LOCAL_PATH): Must not define both LOCAL_NO_STANDARD_LIBRARIES and LOCAL_SDK_VERSION)