ART: Conditionally add debug version to art-runtime package
Conditionally include debug versions of ART binaries into art-runtime.
Use PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD to make this configurable by
a product. The rules are explained in art/Android.mk.
Bug: 62087184
Test: m
Test: Device boots
The following tests are on userdebug builds.
Test: m clean && m && ls $OUT/system/lib*/libartd* >/dev/null 2>&1 && echo OK
Test: m clean && PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD=true m && ls $OUT/system/lib*/libartd* >/dev/null 2>&1 && echo OK
Test: m clean && PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD=false m && ls $OUT/system/lib*/libartd* >/dev/null 2>&1 || echo OK
Change-Id: I88e1cb0925cf62c3951b486a178d4dfc5e888a93
diff --git a/Android.mk b/Android.mk
index 7de07a8..0402513 100644
--- a/Android.mk
+++ b/Android.mk
@@ -375,6 +375,25 @@
# For nosy apps, we provide a fake library that avoids namespace issues and gives some warnings.
LOCAL_REQUIRED_MODULES += libart_fake
+# Potentially add in debug variants:
+#
+# * We will never add them if PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD = false.
+# * We will always add them if PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD = true.
+# * Otherwise, we will add them by default to userdebug and eng builds.
+ifneq (false,$(PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD))
+ifneq (,$(filter userdebug eng,$(PRODUCT_TARGET_BUILD_VARIANT)))
+ PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD := true
+endif
+ifeq (true,$(PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD))
+LOCAL_REQUIRED_MODULES += \
+ libartd \
+ libartd-compiler \
+ libopenjdkjvmd \
+ libopenjdkjvmtid \
+
+endif
+endif
+
include $(BUILD_PHONY_PACKAGE)
# The art-tools package depends on helpers and tools that are useful for developers and on-device