summaryrefslogtreecommitdiffstats
path: root/core/package.mk
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2012-08-21 16:59:01 -0700
committerYing Wang <wangying@google.com>2012-08-22 12:11:01 -0700
commitaf4800c8a6a9266ceb7269bd2c6b0bb2f0965bea (patch)
tree571c67540d0168aa90f8eaa1fa1a3e378fc611e6 /core/package.mk
parent4606449a53c1a802ea9db0059c08c95cb020376d (diff)
downloadbuild-af4800c8a6a9266ceb7269bd2c6b0bb2f0965bea.zip
build-af4800c8a6a9266ceb7269bd2c6b0bb2f0965bea.tar.gz
build-af4800c8a6a9266ceb7269bd2c6b0bb2f0965bea.tar.bz2
Support EMMA_INSTRUMENT in both full and unbundled builds.
Bug: 6987838 - With this change, use "EMMA_INSTRUMENT=true" to enable emma in full or unbundled build. - You don't need to add "LOCAL_STATIC_JAVA_LIBRARIES += emma" any more for unbundled apps. - Now a single var LOCAL_EMMA_INSTRUMENT replaces the previous LOCAL_NO_EMMA_INSTRUMENT and LOCAL_NO_EMMA_COMPILE. - By default, if EMMA_INSTRUMENT is true, emma is enabled for only non-test apps. - A new global var EMMA_INSTRUMENT_STATIC. It enables EMMA_INSTRUMENT and builds emma into apk/jar as static library, instead of using emma as part of shared library core.jar. Change-Id: I0aa219e83074879ececc159b5b07c39eb07ccc00
Diffstat (limited to 'core/package.mk')
-rw-r--r--core/package.mk29
1 files changed, 29 insertions, 0 deletions
diff --git a/core/package.mk b/core/package.mk
index a1d901e..c181ae4 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -170,6 +170,35 @@ ifeq (false,$(LOCAL_DEX_PREOPT))
LOCAL_DEX_PREOPT :=
endif
+ifeq (true,$(EMMA_INSTRUMENT))
+ifndef LOCAL_EMMA_INSTRUMENT
+# No emma for test apks.
+ifeq (,$(filer tests,$(LOCAL_MODULE_TAGS))$(LOCAL_INSTRUMENTATION_FOR))
+LOCAL_EMMA_INSTRUMENT := true
+endif # No test apk
+endif # LOCAL_EMMA_INSTRUMENT is not set
+else
+LOCAL_EMMA_INSTRUMENT := false
+endif # EMMA_INSTRUMENT is true
+
+ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
+ifeq (true,$(EMMA_INSTRUMENT_STATIC))
+LOCAL_STATIC_JAVA_LIBRARIES += emma
+else
+ifdef LOCAL_SDK_VERSION
+ifdef TARGET_BUILD_APPS
+# In unbundled build merge the emma library into the apk.
+LOCAL_STATIC_JAVA_LIBRARIES += emma
+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;
+# Otherwise emma classes are included in core.jar.
+LOCAL_PROGUARD_FLAGS += -libraryjars $(EMMA_JAR)
+endif # full build
+endif # LOCAL_SDK_VERSION
+endif # EMMA_INSTRUMENT_STATIC
+endif # LOCAL_EMMA_INSTRUMENT
+
#################################
include $(BUILD_SYSTEM)/java.mk
#################################