Remove module `jacocoagent` from `TARGET_CORE_JARS`.
Before this change, `jacocoagent` was conditionally added to
`TARGET_CORE_JARS`. However, this module is not really part of the
Android Core Libraries (also, we plan to remove `TARGET_CORE_JARS`
from `PRODUCT_PACKAGES`). Remove it from `TARGET_CORE_JARS` while
keeping it in `PRODUCT_PACKAGES` and `PRODUCT_BOOT_JARS`, to keep
having it installed and being part of the boot class path on
devices (under the same conditions).
Test: Check that:
export EMMA_INSTRUMENT=true
&& unset EMMA_INSTRUMENT_STATIC
&& m installclean
&& m systemimage
generates a system image that contains these files:
/system/framework/apex-jacocoagent.vdex
/system/framework/boot-jacocoagent.vdex
/system/framework/jacocoagent.jar
/system/framework/<arch>/apex-jacocoagent.art
/system/framework/<arch>/apex-jacocoagent.oat
/system/framework/<arch>/apex-jacocoagent.vdex
/system/framework/<arch>/boot-jacocoagent.art
/system/framework/<arch>/boot-jacocoagent.oat
/system/framework/<arch>/boot-jacocoagent.vdex
Test: Run test ATP test avd/avd_boot_health_check on build target
cf_x86_phone-userdebug_coverage
Bug: 143304991
Bug: 142944799
Change-Id: Ib047a394342aeffbfec26ebc756159f145d6523e
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 0c58cd6..d35cb7e 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -259,14 +259,6 @@
# Java libraries in the ART apex build rule.
ART_APEX_JARS := core-oj core-libart core-icu4j okhttp bouncycastle apache-xml
TARGET_CORE_JARS := $(ART_APEX_JARS) conscrypt
-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/product_config.mk b/core/product_config.mk
index 1293c94..4fc7bf6 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -184,6 +184,18 @@
all_product_makefiles :=
all_product_configs :=
+# Jacoco agent JARS to be built and installed, if any.
+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.
+ $(foreach product,$(PRODUCTS),\
+ $(eval PRODUCTS.$(product).PRODUCT_PACKAGES += jacocoagent)\
+ $(eval PRODUCTS.$(product).PRODUCT_BOOT_JARS += jacocoagent))
+ endif # EMMA_INSTRUMENT_STATIC
+endif # EMMA_INSTRUMENT
+
############################################################################
# Strip and assign the PRODUCT_ variables.
$(call strip-product-vars)