Compile update_engine without shill.
Add a new BRILLO_USE_SHILL for shill, it depends on BRILLO_USE_DBUS.
Bug: 30746265
Test: mma with USE_SHILL=1 and USE_DBUS=1
Test: mma with USE_SHILL=0 and USE_DBUS=1
Test: mma with USE_SHILL=0 and USE_DBUS=0
Change-Id: Ia5ef7a7c7cf48e81c2dd0e4326eeac0f7c0248b3
diff --git a/Android.mk b/Android.mk
index a28af7f..c16a56e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -28,8 +28,15 @@
local_use_libcros := $(if $(BRILLO_USE_LIBCROS),$(BRILLO_USE_LIBCROS),0)
local_use_mtd := $(if $(BRILLO_USE_MTD),$(BRILLO_USE_MTD),0)
local_use_omaha := $(if $(BRILLO_USE_OMAHA),$(BRILLO_USE_OMAHA),0)
+local_use_shill := $(if $(BRILLO_USE_SHILL),$(BRILLO_USE_SHILL),0)
local_use_weave := $(if $(BRILLO_USE_WEAVE),$(BRILLO_USE_WEAVE),0)
+ifeq ($(local_use_shill),1)
+ifneq ($(local_use_dbus),1)
+$(error USE_SHILL depends on USE_DBUS.)
+endif # local_use_dbus != 1
+endif # local_use_shill == 1
+
ue_common_cflags := \
-DUSE_BINDER=$(local_use_binder) \
-DUSE_DBUS=$(local_use_dbus) \
@@ -37,6 +44,7 @@
-DUSE_LIBCROS=$(local_use_libcros) \
-DUSE_MTD=$(local_use_mtd) \
-DUSE_OMAHA=$(local_use_omaha) \
+ -DUSE_SHILL=$(local_use_shill) \
-DUSE_WEAVE=$(local_use_weave) \
-D_FILE_OFFSET_BITS=64 \
-D_POSIX_C_SOURCE=199309L \
@@ -262,9 +270,12 @@
ue_libupdate_engine_exported_shared_libraries += \
libdbus \
libbrillo-dbus \
- libchrome-dbus \
- libshill-client
+ libchrome-dbus
endif # local_use_dbus == 1
+ifeq ($(local_use_shill),1)
+ue_libupdate_engine_exported_shared_libraries += \
+ libshill-client
+endif # local_use_shill == 1
ifeq ($(local_use_binder),1)
ue_libupdate_engine_exported_shared_libraries += \
libbinder \
@@ -343,16 +354,19 @@
weave_service_factory.cc
ifeq ($(local_use_dbus),1)
LOCAL_SRC_FILES += \
- connection_manager.cc \
dbus_connection.cc \
dbus_service.cc \
- libcros_proxy.cc \
+ libcros_proxy.cc
+endif # local_use_dbus == 1
+ifeq ($(local_use_shill),1)
+LOCAL_SRC_FILES += \
+ connection_manager.cc \
shill_proxy.cc \
update_manager/real_shill_provider.cc
-else # local_use_dbus == 1
+else # local_use_shill != 1
LOCAL_SRC_FILES += \
connection_manager_android.cc
-endif # local_use_dbus == 1
+endif # local_use_shill == 1
ifeq ($(local_use_binder),1)
LOCAL_AIDL_INCLUDES += $(LOCAL_PATH)/binder_bindings
LOCAL_SRC_FILES += \
@@ -1059,12 +1073,12 @@
LOCAL_SHARED_LIBRARIES += \
$(ue_libupdate_engine_android_exported_shared_libraries:-host=)
endif # local_use_omaha == 1
-ifeq ($(local_use_dbus),1)
+ifeq ($(local_use_shill),1)
LOCAL_SRC_FILES += \
connection_manager_unittest.cc \
fake_shill_proxy.cc \
update_manager/real_shill_provider_unittest.cc
-endif # local_use_dbus == 1
+endif # local_use_shill == 1
ifeq ($(local_use_libcros),1)
LOCAL_SRC_FILES += \
chrome_browser_proxy_resolver_unittest.cc
diff --git a/update_engine.gyp b/update_engine.gyp
index b892672..9e8d735 100644
--- a/update_engine.gyp
+++ b/update_engine.gyp
@@ -56,6 +56,7 @@
'USE_LIBCROS=<(USE_libcros)',
'USE_MTD=<(USE_mtd)',
'USE_OMAHA=1',
+ 'USE_SHILL=1',
'USE_WEAVE=<(USE_buffet)',
],
'include_dirs': [
diff --git a/update_manager/state_factory.cc b/update_manager/state_factory.cc
index 6c8808b..2b3ce63 100644
--- a/update_manager/state_factory.cc
+++ b/update_manager/state_factory.cc
@@ -25,6 +25,9 @@
#endif // USE_DBUS
#include "update_engine/common/clock_interface.h"
+#if USE_DBUS
+#include "update_engine/dbus_connection.h"
+#endif // USE_DBUS
#include "update_engine/update_manager/fake_shill_provider.h"
#include "update_engine/update_manager/real_config_provider.h"
#include "update_engine/update_manager/real_device_policy_provider.h"
@@ -33,11 +36,10 @@
#include "update_engine/update_manager/real_system_provider.h"
#include "update_engine/update_manager/real_time_provider.h"
#include "update_engine/update_manager/real_updater_provider.h"
-#if USE_DBUS
-#include "update_engine/dbus_connection.h"
+#if USE_SHILL
#include "update_engine/shill_proxy.h"
#include "update_engine/update_manager/real_shill_provider.h"
-#endif // USE_DBUS
+#endif // USE_SHILL
using std::unique_ptr;
@@ -58,13 +60,16 @@
brillo::make_unique_ptr(
new org::chromium::SessionManagerInterfaceProxy(bus)),
policy_provider));
- unique_ptr<RealShillProvider> shill_provider(
- new RealShillProvider(new chromeos_update_engine::ShillProxy(), clock));
#else
unique_ptr<RealDevicePolicyProvider> device_policy_provider(
new RealDevicePolicyProvider(policy_provider));
- unique_ptr<FakeShillProvider> shill_provider(new FakeShillProvider());
#endif // USE_DBUS
+#if USE_SHILL
+ unique_ptr<RealShillProvider> shill_provider(
+ new RealShillProvider(new chromeos_update_engine::ShillProxy(), clock));
+#else
+ unique_ptr<FakeShillProvider> shill_provider(new FakeShillProvider());
+#endif // USE_SHILL
unique_ptr<RealRandomProvider> random_provider(new RealRandomProvider());
unique_ptr<RealSystemProvider> system_provider(new RealSystemProvider(
system_state->hardware(), system_state->boot_control(), libcros_proxy));
@@ -75,9 +80,9 @@
if (!(config_provider->Init() &&
device_policy_provider->Init() &&
random_provider->Init() &&
-#if USE_DBUS
+#if USE_SHILL
shill_provider->Init() &&
-#endif // USE_DBUS
+#endif // USE_SHILL
system_provider->Init() &&
time_provider->Init() &&
updater_provider->Init())) {