Compile delta_generator and payload_consumer when "dbus" is disabled.

delta_generator and payload_consumer should not depend on any DBus
library. This patch now builds those even when "dbus" is disabled.

Bug: 25773375
TEST=`mma` on a target with DBus disabled.

Change-Id: Ia44cb9eed847e6d2eeb43a12373929128ae67d1c
diff --git a/Android.mk b/Android.mk
index 6270772..db195d8 100644
--- a/Android.mk
+++ b/Android.mk
@@ -118,21 +118,11 @@
 
 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.
-ue_libpayload_consumer_exported_c_includes := \
-    $(LOCAL_PATH)/include \
-    external/cros/system_api/dbus
 ue_libpayload_consumer_exported_static_libraries := \
     update_metadata-protos \
-    update_engine-dbus-libcros-client \
-    update_engine_client-dbus-proxies \
     libxz \
     libbz \
     libfs_mgr \
@@ -140,10 +130,7 @@
 ue_libpayload_consumer_exported_shared_libraries := \
     libcrypto \
     libcurl \
-    libshill-client \
     libssl \
-    libexpat \
-    libbrillo-policy \
     libhardware \
     libcutils \
     $(ue_update_metadata_protos_exported_shared_libraries)
@@ -154,18 +141,14 @@
 LOCAL_CPP_EXTENSION := .cc
 LOCAL_RTTI_FLAG := -frtti
 LOCAL_CLANG := true
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(ue_libpayload_consumer_exported_c_includes)
 LOCAL_CFLAGS := $(ue_common_cflags)
 LOCAL_CPPFLAGS := $(ue_common_cppflags)
 LOCAL_LDFLAGS := $(ue_common_ldflags)
 LOCAL_C_INCLUDES := \
     $(ue_common_c_includes) \
-    $(ue_libpayload_consumer_exported_c_includes) \
     external/e2fsprogs/lib
 LOCAL_STATIC_LIBRARIES := \
     update_metadata-protos \
-    update_engine-dbus-libcros-client \
-    update_engine_client-dbus-proxies \
     $(ue_libpayload_consumer_exported_static_libraries) \
     $(ue_update_metadata_protos_exported_static_libraries)
 LOCAL_SHARED_LIBRARIES := \
@@ -205,8 +188,6 @@
     payload_consumer/xz_extent_writer.cc
 include $(BUILD_STATIC_LIBRARY)
 
-endif  # BRILLO_USE_DBUS == 1
-
 ifeq ($(BRILLO_USE_DBUS),1)
 
 # libupdate_engine (type: static_library)
@@ -215,26 +196,21 @@
 # with Omaha and expose a DBus daemon.
 ue_libupdate_engine_exported_c_includes := \
     $(LOCAL_PATH)/include \
-    external/cros/system_api/dbus \
-    $(ue_libpayload_consumer_exported_c_includes)
+    external/cros/system_api/dbus
 ue_libupdate_engine_exported_static_libraries := \
     libpayload_consumer \
     update_metadata-protos \
     update_engine-dbus-adaptor \
     update_engine-dbus-libcros-client \
     update_engine_client-dbus-proxies \
-    libxz \
     libbz \
     libfs_mgr \
     $(ue_libpayload_consumer_exported_static_libraries) \
     $(ue_update_metadata_protos_exported_static_libraries)
 ue_libupdate_engine_exported_shared_libraries := \
     libdbus \
-    libcrypto \
-    libcurl \
     libmetrics \
     libshill-client \
-    libssl \
     libexpat \
     libbrillo-policy \
     libhardware \
@@ -254,8 +230,7 @@
 LOCAL_LDFLAGS := $(ue_common_ldflags)
 LOCAL_C_INCLUDES := \
     $(ue_common_c_includes) \
-    $(ue_libupdate_engine_exported_c_includes) \
-    $(ue_libpayload_consumer_exported_c_includes)
+    $(ue_libupdate_engine_exported_c_includes)
 LOCAL_STATIC_LIBRARIES := \
     libpayload_consumer \
     update_metadata-protos \
@@ -382,24 +357,18 @@
 
 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
 # for any client code.
-ue_libpayload_generator_exported_c_includes := \
-    $(ue_libupdate_engine_exported_c_includes)
 ue_libpayload_generator_exported_static_libraries := \
-    libupdate_engine \
+    libpayload_consumer \
     update_metadata-protos \
-    $(ue_libupdate_engine_exported_static_libraries) \
+    $(ue_libpayload_consumer_exported_static_libraries) \
     $(ue_update_metadata_protos_exported_static_libraries)
 ue_libpayload_generator_exported_shared_libraries := \
     libext2fs \
-    $(ue_libupdate_engine_exported_shared_libraries) \
+    $(ue_libpayload_consumer_exported_shared_libraries) \
     $(ue_update_metadata_protos_exported_shared_libraries)
 
 include $(CLEAR_VARS)
@@ -408,22 +377,19 @@
 LOCAL_CPP_EXTENSION := .cc
 LOCAL_RTTI_FLAG := -frtti
 LOCAL_CLANG := true
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(ue_libpayload_generator_exported_c_includes)
 LOCAL_CFLAGS := $(ue_common_cflags)
 LOCAL_CPPFLAGS := $(ue_common_cppflags)
 LOCAL_LDFLAGS := $(ue_common_ldflags)
-LOCAL_C_INCLUDES := \
-    $(ue_common_c_includes) \
-    $(ue_libupdate_engine_exported_c_includes)
+LOCAL_C_INCLUDES := $(ue_common_c_includes)
 LOCAL_STATIC_LIBRARIES := \
-    libupdate_engine \
+    libpayload_consumer \
     update_metadata-protos \
-    $(ue_libupdate_engine_exported_static_libraries) \
+    $(ue_libpayload_consumer_exported_static_libraries) \
     $(ue_update_metadata_protos_exported_static_libraries)
 LOCAL_SHARED_LIBRARIES := \
     $(ue_common_shared_libraries) \
     $(ue_libpayload_generator_exported_shared_libraries) \
-    $(ue_libupdate_engine_exported_shared_libraries) \
+    $(ue_libpayload_consumer_exported_shared_libraries) \
     $(ue_update_metadata_protos_exported_shared_libraries)
 LOCAL_SRC_FILES := \
     payload_generator/ab_generator.cc \
@@ -461,25 +427,20 @@
 LOCAL_CFLAGS := $(ue_common_cflags)
 LOCAL_CPPFLAGS := $(ue_common_cppflags)
 LOCAL_LDFLAGS := $(ue_common_ldflags)
-LOCAL_C_INCLUDES := \
-    $(ue_common_c_includes) \
-    $(ue_libupdate_engine_exported_c_includes) \
-    $(ue_libpayload_generator_exported_c_includes)
+LOCAL_C_INCLUDES := $(ue_common_c_includes)
 LOCAL_STATIC_LIBRARIES := \
-    libupdate_engine \
+    libpayload_consumer \
     libpayload_generator \
-    $(ue_libupdate_engine_exported_static_libraries) \
+    $(ue_libpayload_consumer_exported_static_libraries) \
     $(ue_libpayload_generator_exported_static_libraries)
 LOCAL_SHARED_LIBRARIES := \
     $(ue_common_shared_libraries) \
-    $(ue_libupdate_engine_exported_shared_libraries) \
+    $(ue_libpayload_consumer_exported_shared_libraries) \
     $(ue_libpayload_generator_exported_shared_libraries)
 LOCAL_SRC_FILES := \
     payload_generator/generate_delta_main.cc
 include $(BUILD_EXECUTABLE)
 
-endif  # BRILLO_USE_DBUS == 1
-
 ifeq ($(BRILLO_USE_DBUS),1)
 
 # libupdate_engine_client
diff --git a/system_state.h b/system_state.h
index 15350bf..2ba0272 100644
--- a/system_state.h
+++ b/system_state.h
@@ -17,7 +17,11 @@
 #ifndef UPDATE_ENGINE_SYSTEM_STATE_H_
 #define UPDATE_ENGINE_SYSTEM_STATE_H_
 
-#include <power_manager/dbus-proxies.h>
+namespace org {
+namespace chromium {
+class PowerManagerProxyInterface;
+}  // namespace chromium
+}  // namespace org
 
 class MetricsLibraryInterface;
 
diff --git a/update_engine.gyp b/update_engine.gyp
index 2f1144b..c21edc2 100644
--- a/update_engine.gyp
+++ b/update_engine.gyp
@@ -46,6 +46,7 @@
     'defines': [
       '_FILE_OFFSET_BITS=64',
       '_POSIX_C_SOURCE=199309L',
+      'USE_DBUS=<(USE_dbus)',
       'USE_HWID_OVERRIDE=<(USE_hwid_override)',
       'USE_MTD=<(USE_mtd)',
       'USE_POWER_MANAGEMENT=<(USE_power_management)',
@@ -118,7 +119,6 @@
       'type': 'static_library',
       'dependencies': [
         'update_metadata-protos',
-        'update_engine-other-dbus-proxies',
       ],
       #TODO(deymo): Remove unused dependencies once we stop including files
       # from the root directory.
@@ -126,13 +126,7 @@
         'exported_deps': [
           'libcrypto',
           'libcurl',
-          'libdebugd-client',
-          'libsession_manager-client',
-          'libpower_manager-client',
-          'libupdate_engine-client',
-          'libshill-client',
           'libssl',
-          'expat',
           'xz-embedded',
         ],
         'deps': ['<@(exported_deps)'],
@@ -152,7 +146,6 @@
         },
         'libraries': [
           '-lbz2',
-          '-lpolicy-<(libbase_ver)',
           '-lrootdev',
           '-lrt',
           '-lvboot_host',
@@ -217,17 +210,13 @@
       'variables': {
         'exported_deps': [
           'dbus-1',
-          'libcrypto',
-          'libcurl',
           'libdebugd-client',
           'libsession_manager-client',
           'libmetrics-<(libbase_ver)',
           'libpower_manager-client',
           'libupdate_engine-client',
           'libshill-client',
-          'libssl',
           'expat',
-          'xz-embedded',
         ],
         'deps': ['<@(exported_deps)'],
       },
@@ -318,7 +307,7 @@
       'target_name': 'libpayload_generator',
       'type': 'static_library',
       'dependencies': [
-        'libupdate_engine',
+        'libpayload_consumer',
         'update_metadata-protos',
       ],
       'variables': {
@@ -370,7 +359,7 @@
       'target_name': 'delta_generator',
       'type': 'executable',
       'dependencies': [
-        'libupdate_engine',
+        'libpayload_consumer',
         'libpayload_generator',
       ],
       'link_settings': {