Create make file for system/weaved and compile basic components

This change adds Android.mk to system/weaved target and make basic
components of buffet compile on AOSP. Right now code that depend on
other platform components (web server, shill, peerd) is commented
out/not being compiled.

BUG:23113639
Change-Id: Ice248029e3577dc664f9d82a12bc609d9689208e
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..9db260f
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,146 @@
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+# TODO(avakulenko): Remove this condition when libchromeos can be built on
+# non-Linux host.
+ifeq ($(HOST_OS),linux)
+
+# Common variables
+# ========================================================
+
+buffetCommonCppExtension := .cc
+buffetCommonCFlags := -D__BRILLO__ -Wall -Werror \
+	-Wno-char-subscripts -Wno-missing-field-initializers \
+	-Wno-unused-function -Wno-unused-parameter
+
+buffetCommonCppFlags := \
+	-Wno-deprecated-register \
+	-Wno-sign-compare \
+	-Wno-sign-promo \
+	-Wno-non-virtual-dtor \
+
+buffetCommonCIncludes := \
+	$(LOCAL_PATH)/.. \
+	$(LOCAL_PATH)/dbus-proxies \
+	external/gtest/include \
+
+buffetSharedLibraries := \
+	libchrome \
+	libchrome-dbus \
+	libchromeos \
+	libchromeos-dbus \
+	libchromeos-http \
+	libchromeos-stream \
+	libdbus \
+	libweave \
+
+# buffet-common
+# ========================================================
+include $(CLEAR_VARS)
+LOCAL_MODULE := buffet-common
+LOCAL_CPP_EXTENSION := $(buffetCommonCppExtension)
+LOCAL_CFLAGS := $(buffetCommonCFlags)
+LOCAL_CPPFLAGS := $(buffetCommonCppFlags)
+LOCAL_C_INCLUDES := $(buffetCommonCIncludes)
+LOCAL_SHARED_LIBRARIES := $(buffetSharedLibraries)
+LOCAL_STATIC_LIBRARIES :=
+LOCAL_RTTI_FLAG := -frtti
+LOCAL_CLANG := true
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+
+LOCAL_SRC_FILES := \
+	buffet/dbus_command_dispatcher.cc \
+	buffet/dbus_command_proxy.cc \
+	buffet/dbus_conversion.cc \
+	buffet/dbus_constants.cc \
+	buffet/http_transport_client.cc \
+	buffet/manager.cc \
+
+#	buffet/dbus_bindings/org.chromium.Buffet.Command.xml \
+#	buffet/dbus_bindings/org.chromium.Buffet.Manager.xml \
+#	buffet/ap_manager_client.cc \
+#	buffet/peerd_client.cc \
+#	buffet/shill_client.cc \
+#	buffet/webserv_client.cc \
+
+include $(BUILD_STATIC_LIBRARY)
+
+# buffet
+# ========================================================
+include $(CLEAR_VARS)
+LOCAL_MODULE := weaved
+LOCAL_REQUIRED_MODULES := init.weaved.rc
+LOCAL_CPP_EXTENSION := $(buffetCommonCppExtension)
+LOCAL_CFLAGS := $(buffetCommonCFlags)
+LOCAL_CPPFLAGS := $(buffetCommonCppFlags)
+LOCAL_C_INCLUDES := $(buffetCommonCIncludes)
+LOCAL_SHARED_LIBRARIES := $(buffetSharedLibraries)
+LOCAL_WHOLE_STATIC_LIBRARIES := buffet-common
+LOCAL_CLANG := true
+LOCAL_RTTI_FLAG := -frtti
+
+LOCAL_SRC_FILES := \
+	buffet/main.cc
+
+include $(BUILD_EXECUTABLE)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := init.weaved.rc
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_INITRCD)
+
+ifdef INITRC_TEMPLATE
+include $(BUILD_SYSTEM)/base_rules.mk
+
+weaved_caps :=
+$(LOCAL_BUILT_MODULE): $(INITRC_TEMPLATE)
+	$(call generate-initrc-file,weaved,$(weaved_caps))
+endif
+
+# buffet_testrunner
+# ========================================================
+include $(CLEAR_VARS)
+LOCAL_MODULE := buffet_testrunner
+LOCAL_CPP_EXTENSION := $(buffetCommonCppExtension)
+LOCAL_CFLAGS := $(buffetCommonCFlags)
+LOCAL_CPPFLAGS := $(buffetCommonCppFlags)
+LOCAL_C_INCLUDES := \
+	$(buffetCommonCIncludes) \
+	external/gmock/include \
+
+LOCAL_SHARED_LIBRARIES := \
+	$(buffetSharedLibraries) \
+
+LOCAL_STATIC_LIBRARIES := \
+	buffet-common \
+	libchrome_dbus_test_helpers \
+	libchrome_test_helpers \
+	libchromeos-test-helpers \
+	libgtest \
+	libgmock \
+	libweave-test \
+
+LOCAL_RTTI_FLAG := -frtti
+LOCAL_CLANG := true
+
+LOCAL_SRC_FILES := \
+	buffet/buffet_testrunner.cc \
+	buffet/dbus_command_proxy_unittest.cc \
+	buffet/dbus_conversion_unittest.cc \
+
+include $(BUILD_NATIVE_TEST)
+
+endif # HOST_OS == linux
diff --git a/buffet/manager.cc b/buffet/manager.cc
index 70c31f6..f0ebff9 100644
--- a/buffet/manager.cc
+++ b/buffet/manager.cc
@@ -27,9 +27,9 @@
 #include "buffet/dbus_command_dispatcher.h"
 #include "buffet/dbus_conversion.h"
 #include "buffet/http_transport_client.h"
-#include "buffet/peerd_client.h"
-#include "buffet/shill_client.h"
-#include "buffet/webserv_client.h"
+//#include "buffet/peerd_client.h"
+//#include "buffet/shill_client.h"
+//#include "buffet/webserv_client.h"
 
 using chromeos::dbus_utils::AsyncEventSequencer;
 using chromeos::dbus_utils::ExportedObjectManager;
@@ -60,15 +60,15 @@
                     const std::set<std::string>& device_whitelist,
                     AsyncEventSequencer* sequencer) {
   http_client_.reset(new HttpTransportClient);
-  shill_client_.reset(new ShillClient{dbus_object_.GetBus(), device_whitelist});
-  if (!options.disable_privet) {
-    peerd_client_.reset(new PeerdClient{dbus_object_.GetBus()});
-    web_serv_client_.reset(new WebServClient{dbus_object_.GetBus(), sequencer});
-  }
+//  shill_client_.reset(new ShillClient{dbus_object_.GetBus(), device_whitelist});
+//  if (!options.disable_privet) {
+//    peerd_client_.reset(new PeerdClient{dbus_object_.GetBus()});
+//    web_serv_client_.reset(new WebServClient{dbus_object_.GetBus(), sequencer});
+//  }
 
   device_ = weave::Device::Create();
-  device_->Start(options, http_client_.get(), shill_client_.get(),
-                 peerd_client_.get(), web_serv_client_.get());
+  device_->Start(options, http_client_.get(), nullptr /*shill_client_.get()*/,
+                 nullptr /*peerd_client_.get()*/, nullptr /*web_serv_client_.get()*/);
 
   command_dispatcher_.reset(new DBusCommandDispacher{
       dbus_object_.GetObjectManager(), device_->GetCommands()});
diff --git a/buffet/manager.h b/buffet/manager.h
index 1f89a01..873c24f 100644
--- a/buffet/manager.h
+++ b/buffet/manager.h
@@ -32,9 +32,9 @@
 
 class DBusCommandDispacher;
 class HttpTransportClient;
-class PeerdClient;
-class ShillClient;
-class WebServClient;
+//class PeerdClient;
+//class ShillClient;
+//class WebServClient;
 
 template<typename... Types>
 using DBusMethodResponsePtr =
@@ -120,9 +120,9 @@
   chromeos::dbus_utils::DBusObject dbus_object_;
 
   std::unique_ptr<HttpTransportClient> http_client_;
-  std::unique_ptr<ShillClient> shill_client_;
-  std::unique_ptr<PeerdClient> peerd_client_;
-  std::unique_ptr<WebServClient> web_serv_client_;
+//  std::unique_ptr<ShillClient> shill_client_;
+//  std::unique_ptr<PeerdClient> peerd_client_;
+//  std::unique_ptr<WebServClient> web_serv_client_;
   std::unique_ptr<weave::Device> device_;
   std::unique_ptr<DBusCommandDispacher> command_dispatcher_;