Disable DBus dependent targets when "dbus" USE flag is not set.
Some targets should not be build when DBus is not enabled, such as the
update_engine_client, the generated DBus proxies and the DBus daemon.
This patch disables those headers and also temporary disables
libpayload_consumer and delta_generator on Android when the "dbus" USE
flag is not set, since they depend on headers that still depend on
DBus.
Bug: 25197634
Test: `mmma system/update_engine` on an android target without dbus.
Change-Id: Ic33dc52c2f910bd526b06663cdbd119a0b8cdfd9
diff --git a/Android.mk b/Android.mk
index 8c1388a..ea37507 100644
--- a/Android.mk
+++ b/Android.mk
@@ -17,11 +17,13 @@
LOCAL_PATH := $(my-dir)
# Default values for the USE flags. Override these USE flags from your product.
+BRILLO_USE_DBUS ?= 1
BRILLO_USE_HWID_OVERRIDE ?= 0
BRILLO_USE_MTD ?= 0
BRILLO_USE_POWER_MANAGEMENT ?= 0
ue_common_cflags := \
+ -DUSE_DBUS=$(BRILLO_USE_DBUS) \
-DUSE_HWID_OVERRIDE=$(BRILLO_USE_HWID_OVERRIDE) \
-DUSE_MTD=$(BRILLO_USE_MTD) \
-DUSE_POWER_MANAGEMENT=$(BRILLO_USE_POWER_MANAGEMENT) \
@@ -49,12 +51,18 @@
system
ue_common_shared_libraries := \
libbrillo \
- libbrillo-dbus \
libbrillo-http \
libbrillo-stream \
- libchrome \
- libchrome-dbus
+ libchrome
+ifeq ($(BRILLO_USE_DBUS),1)
+ue_common_shared_libraries += \
+ libbrillo-dbus \
+ libchrome-dbus
+endif # BRILLO_USE_DBUS == 1
+
+
+ifeq ($(BRILLO_USE_DBUS),1)
# update_engine_client-dbus-proxies (from generate-dbus-proxies.gypi)
# ========================================================
@@ -67,6 +75,8 @@
LOCAL_DBUS_PROXY_PREFIX := update_engine
include $(BUILD_STATIC_LIBRARY)
+endif # BRILLO_USE_DBUS == 1
+
# update_metadata-protos (type: static_library)
# ========================================================
# Protobufs.
@@ -84,6 +94,8 @@
update_metadata.proto
include $(BUILD_STATIC_LIBRARY)
+ifeq ($(BRILLO_USE_DBUS),1)
+
# update_engine-dbus-adaptor (from generate-dbus-adaptors.gypi)
# ========================================================
# Chrome D-Bus bindings.
@@ -104,6 +116,13 @@
LOCAL_DBUS_PROXY_PREFIX := libcros
include $(BUILD_STATIC_LIBRARY)
+endif # BRILLO_USE_DBUS == 1
+
+
+#TODO(deymo): Re-enable this library once the dbus dependencies are removed from
+# the code.
+ifeq ($(BRILLO_USE_DBUS),1)
+
# libpayload_consumer (type: static_library)
# ========================================================
# The payload application component and common dependencies.
@@ -187,6 +206,10 @@
payload_consumer/xz_extent_writer.cc
include $(BUILD_STATIC_LIBRARY)
+endif # BRILLO_USE_DBUS == 1
+
+ifdef BRILLO
+
# libupdate_engine (type: static_library)
# ========================================================
# The main daemon static_library with all the code used to check for updates
@@ -283,6 +306,8 @@
update_status_utils.cc
include $(BUILD_STATIC_LIBRARY)
+endif # defined(BRILLO)
+
# update_engine (type: executable)
# ========================================================
# update_engine daemon.
@@ -295,14 +320,16 @@
LOCAL_CPPFLAGS := $(ue_common_cppflags)
LOCAL_LDFLAGS := $(ue_common_ldflags)
LOCAL_C_INCLUDES := \
- $(ue_common_c_includes) \
+ $(ue_common_c_includes)
+
+ifdef BRILLO
+
+LOCAL_C_INCLUDES += \
$(ue_libupdate_engine_exported_c_includes)
LOCAL_STATIC_LIBRARIES := \
libupdate_engine \
$(ue_libupdate_engine_exported_static_libraries)
-ifdef BRILLO
-
LOCAL_RTTI_FLAG := -frtti
LOCAL_SHARED_LIBRARIES := \
$(ue_common_shared_libraries) \
@@ -328,6 +355,8 @@
LOCAL_INIT_RC := update_engine.rc
include $(BUILD_EXECUTABLE)
+ifeq ($(BRILLO_USE_DBUS),1)
+
# update_engine_client (type: executable)
# ========================================================
# update_engine console client.
@@ -349,6 +378,12 @@
update_engine_client.cc
include $(BUILD_EXECUTABLE)
+endif # BRILLO_USE_DBUS == 1
+
+#TODO(deymo): Re-enable this library once the dbus dependencies are removed from
+# the code.
+ifeq ($(BRILLO_USE_DBUS),1)
+
# libpayload_generator (type: static_library)
# ========================================================
# server-side code. This is used for delta_generator and unittests but not
@@ -441,6 +476,10 @@
payload_generator/generate_delta_main.cc
include $(BUILD_EXECUTABLE)
+endif # BRILLO_USE_DBUS == 1
+
+ifeq ($(BRILLO_USE_DBUS),1)
+
# libupdate_engine_client
# ========================================================
include $(CLEAR_VARS)
@@ -471,6 +510,7 @@
update_status_utils.cc
include $(BUILD_SHARED_LIBRARY)
+endif # BRILLO_USE_DBUS == 1
# Update payload signing public key.
# ========================================================