Add webservd client for testing purposes
Right now, this client only answers ping requests. We'll enable more
interesting functionality later. With this patch and a corresponding
selinux policy modification, we can:
$ adb forward tcp:8080 tcp:80
$ adb shell start webservd_tclient
$ curl http://localhost:8080/webservd-test-client/ping
Still alive, still alive.
Refactor a little of the build logic to make it easier later on to do
DBus/Binder specific implementations.
Bug: 26385135
Test: compiles, and above shell commands work on emulator
Change-Id: I225793a455972d99e97804d07f9ab7d15ca2b716
diff --git a/Android.mk b/Android.mk
index 3a694d0..999d6b4 100644
--- a/Android.mk
+++ b/Android.mk
@@ -16,10 +16,19 @@
webservd_root := $(my-dir)
+system_webservd_use_dbus := true
+system_webservd_use_binder :=
+
# Definitions applying to all targets. $(eval) this last.
define webservd_common
LOCAL_CPP_EXTENSION := .cc
LOCAL_CFLAGS += -Wall -Werror
+ ifeq ($(system_webservd_use_dbus),true)
+ LOCAL_CFLAGS += -DWEBSERV_USE_DBUS
+ endif
+ ifeq ($(system_webservd_use_binder),true)
+ LOCAL_CFLAGS += -DWEBSERV_USE_BINDER
+ endif
# libbrillo's secure_blob.h calls "using Blob::vector" to expose its base
# class's constructors. This causes a "conflicts with version inherited from
@@ -30,16 +39,32 @@
$(webservd_root) \
external/gtest/include \
+endef # webserv_common
+
+define webservd_common_libraries
LOCAL_SHARED_LIBRARIES += \
libbrillo \
- libbrillo-dbus \
libbrillo-http \
libbrillo-stream \
libchrome \
- libchrome-dbus \
- libdbus \
- libmicrohttpd \
+ libmicrohttpd
-endef
+ # TODO(wiley) Uncomment these guards once firewalld moves to binder
+ # b/25932807
+ # ifeq ($(system_webservd_use_dbus),true)
+ LOCAL_SHARED_LIBRARIES += \
+ libbrillo-dbus \
+ libchrome-dbus \
+ libdbus
+ # endif
+ ifeq ($(system_webservd_use_binder),true)
+ LOCAL_SHARED_LIBRARIES += \
+ libbrillo-binder \
+ libcutils \
+ libutils \
+ libbinder
+ endif
+
+endef # webserv_common_libraries
include $(call all-subdir-makefiles)