Update build files for Fluoride on Linux

uprev build/secondary/third_party/**/BUILD.gn"
Other BUILD.gn files were updated to match current state of project.

Change-Id: Ie895d25680d510f5e69e6f15553311f6671cdce3
diff --git a/BUILD.gn b/BUILD.gn
index e6cb5cb..ffbe4ef 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -25,7 +25,7 @@
   deps = [
     "//main:bluetooth.default",
     "//service:bluetoothtbd",
-    "//vendor_libs:vendor-libs"
+    "//vendor_libs:vendor-libs",
   ]
 }
 
@@ -33,7 +33,7 @@
   testonly = true
 
   deps = [
-    "//test/suite:net_test_bluedroid",
+    "//test/suite:net_test_bluetooth",
     "//btcore:net_test_btcore",
     "//hci:net_test_hci",
     "//osi:net_test_osi",
diff --git a/audio_a2dp_hw/BUILD.gn b/audio_a2dp_hw/BUILD.gn
index 2c5024a..4f252c4 100644
--- a/audio_a2dp_hw/BUILD.gn
+++ b/audio_a2dp_hw/BUILD.gn
@@ -16,7 +16,7 @@
 
 shared_library("audio.a2dp.default") {
   sources = [
-    "audio_a2dp_hw.c"
+    "audio_a2dp_hw.c",
   ]
 
   include_dirs = [
diff --git a/btcore/BUILD.gn b/btcore/BUILD.gn
index c0ebd8e..860a3c0 100644
--- a/btcore/BUILD.gn
+++ b/btcore/BUILD.gn
@@ -48,8 +48,12 @@
   deps = [
     "//btcore",
     "//osi",
-    "//third_party/gtest:gtest_main",
+    "//third_party/googletest:gtest_main",
   ]
 
-  libs = [ "-lpthread", "-lrt", "-ldl" ]
+  libs = [
+    "-lpthread",
+    "-lrt",
+    "-ldl",
+  ]
 }
diff --git a/btif/BUILD.gn b/btif/BUILD.gn
index ec683fb..7285c9a 100644
--- a/btif/BUILD.gn
+++ b/btif/BUILD.gn
@@ -17,8 +17,10 @@
 static_library("btif") {
   sources = [
     "src/btif_av.c",
+
+    #TODO(jpawlowski): heavily depends on Android,
+    #   "src/btif_avrcp_audio_track.cpp",
     "src/btif_config.c",
-    "src/btif_config_transcode.cpp",
     "src/btif_core.c",
     "src/btif_debug.c",
     "src/btif_debug_btsnoop.c",
diff --git a/build/BUILD.gn b/build/BUILD.gn
index fb20a34..eae1737 100644
--- a/build/BUILD.gn
+++ b/build/BUILD.gn
@@ -18,16 +18,22 @@
   # Include path for hardware/bluetooth.h
   libhw_include_path = ""
   core_include_path = ""
+  audio_include_path = ""
 }
 
 config("default_include_dirs") {
   # TODO(armansito): Remove "core_include_path" once the cutils includes have
   # been removed.
-  assert(libhw_include_path != "", "libhardware_include_path build argument wasn't provided.")
-  assert(core_include_path != "", "core_include_path build argument wasn't provided.")
+  assert(libhw_include_path != "",
+         "libhardware_include_path build argument wasn't provided.")
+  assert(core_include_path != "",
+         "core_include_path build argument wasn't provided.")
+  assert(audio_include_path != "",
+         "audio_include_path build argument wasn't provided.")
   include_dirs = [
     libhw_include_path,
     core_include_path,
+    audio_include_path,
   ]
 }
 
@@ -35,8 +41,9 @@
   # TODO(keybuk): AndroidConfig.h or equivalent
 
   cflags = [
-    "-Wall",
-    "-Werror",
+    #TODO(jpawlowski): uncomment once we have no warnings on linux build
+    #    "-Wall",
+    #    "-Werror",
     "-g",
     "-O0",
     "-fpic",
@@ -45,9 +52,7 @@
     "-fvisibility=hidden",
   ]
 
-  cflags_c = [
-    "-std=c99"
-  ]
+  cflags_c = [ "-std=c99" ]
 
   cflags_cc = [
     "-std=c++11",
@@ -60,6 +65,8 @@
     "HAS_NO_BDROID_BUILDCFG",
     "LOG_NDEBUG=1",
     "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))",
+    "PROPERTY_VALUE_MAX=256",
+    "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE",
 
     # This is a macro to that can be used by source code to detect if the
     # current build is done by GN or via Android.mk. This is a temporary
diff --git a/build/secondary/third_party/gmock/BUILD.gn b/build/secondary/third_party/gmock/BUILD.gn
deleted file mode 100644
index e1c4cf3..0000000
--- a/build/secondary/third_party/gmock/BUILD.gn
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-config("gmock_config") {
-  # Gmock headers need to be able to find themselves.
-  include_dirs = [ "include" ]
-}
-
-static_library("gmock") {
-  testonly = true
-  sources = [
-    # Sources based on files in r173 of gmock.
-    "include/gmock/gmock-actions.h",
-    "include/gmock/gmock-cardinalities.h",
-    "include/gmock/gmock-generated-actions.h",
-    "include/gmock/gmock-generated-function-mockers.h",
-    "include/gmock/gmock-generated-matchers.h",
-    "include/gmock/gmock-generated-nice-strict.h",
-    "include/gmock/gmock-matchers.h",
-    "include/gmock/gmock-spec-builders.h",
-    "include/gmock/gmock.h",
-    "include/gmock/internal/gmock-generated-internal-utils.h",
-    "include/gmock/internal/gmock-internal-utils.h",
-    "include/gmock/internal/gmock-port.h",
-
-    #"src/gmock-all.cc",  # Not needed by our build.
-    "src/gmock-cardinalities.cc",
-    "src/gmock-internal-utils.cc",
-    "src/gmock-matchers.cc",
-    "src/gmock-spec-builders.cc",
-    "src/gmock.cc",
-  ]
-
-  # This project includes some stuff form gtest's guts.
-  include_dirs = [ "../gtest/include" ]
-
-  public_configs = [
-    ":gmock_config",
-    "//third_party/gtest:gtest_config",
-  ]
-}
-
-static_library("gmock_main") {
-  testonly = true
-  sources = [
-    "src/gmock_main.cc",
-  ]
-  deps = [
-    ":gmock",
-  ]
-}
diff --git a/build/secondary/third_party/googletest/BUILD.gn b/build/secondary/third_party/googletest/BUILD.gn
new file mode 100644
index 0000000..0122adc
--- /dev/null
+++ b/build/secondary/third_party/googletest/BUILD.gn
@@ -0,0 +1,91 @@
+#
+#  Copyright (C) 2016 Google, Inc.
+#
+#  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.
+#
+
+config("gtest_config") {
+  # Gtest headers need to be able to find themselves.
+  include_dirs = [ "googletest/include" ]
+
+  defines = [ "GTEST_HAS_RTTI=0" ]
+}
+
+config("gtest_direct_config") {
+  visibility = [ ":*" ]
+  defines = [ "UNIT_TEST" ]
+}
+
+static_library("gtest") {
+  testonly = true
+  sources = [
+    "googletest/src/gtest-all.cc",
+  ]
+
+  include_dirs = [
+    "googletest/",
+    "googletest/include",
+  ]
+
+  all_dependent_configs = [ ":gtest_config" ]
+  public_configs = [ ":gtest_direct_config" ]
+}
+
+source_set("gtest_main") {
+  testonly = true
+  sources = [
+    "googletest/src/gtest_main.cc",
+  ]
+  deps = [
+    ":gtest",
+  ]
+}
+
+config("gmock_config") {
+  # Gmock headers need to be able to find themselves.
+  include_dirs = [ "googlemock/include" ]
+}
+
+static_library("gmock") {
+  testonly = true
+  sources = [
+    "googlemock/src/gmock-all.cc",
+  ]
+
+  # This project includes some stuff form gtest's guts.
+  include_dirs = [
+    "googlemock",
+    "googlemock/include",
+  ]
+
+  public_configs = [
+    ":gmock_config",
+    ":gtest_config",
+  ]
+}
+
+static_library("gmock_main") {
+  testonly = true
+  sources = [
+    "googlemock/src/gmock_main.cc",
+  ]
+  deps = [
+    ":gmock",
+    ":gtest",
+  ]
+
+  public_configs = [
+    ":gmock_config",
+    ":gtest_config",
+  ]
+}
diff --git a/build/secondary/third_party/gtest/BUILD.gn b/build/secondary/third_party/gtest/BUILD.gn
deleted file mode 100644
index c1112d9..0000000
--- a/build/secondary/third_party/gtest/BUILD.gn
+++ /dev/null
@@ -1,77 +0,0 @@
-#
-#  Copyright (C) 2015 Google, Inc.
-#
-#  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.
-#
-
-config("gtest_config") {
-  # Gtest headers need to be able to find themselves.
-  include_dirs = [ "include" ]
-
-  defines = [ "GTEST_HAS_RTTI=0" ]
-}
-
-config("gtest_direct_config") {
-  visibility = [ ":*" ]
-  defines = [ "UNIT_TEST" ]
-}
-
-static_library("gtest") {
-  testonly = true
-  sources = [
-    "include/gtest/gtest-death-test.h",
-    "include/gtest/gtest-message.h",
-    "include/gtest/gtest-param-test.h",
-    "include/gtest/gtest-printers.h",
-    "include/gtest/gtest-spi.h",
-    "include/gtest/gtest-test-part.h",
-    "include/gtest/gtest-typed-test.h",
-    "include/gtest/gtest.h",
-    "include/gtest/gtest_pred_impl.h",
-    "include/gtest/internal/gtest-death-test-internal.h",
-    "include/gtest/internal/gtest-filepath.h",
-    "include/gtest/internal/gtest-internal.h",
-    "include/gtest/internal/gtest-linked_ptr.h",
-    "include/gtest/internal/gtest-param-util-generated.h",
-    "include/gtest/internal/gtest-param-util.h",
-    "include/gtest/internal/gtest-port.h",
-    "include/gtest/internal/gtest-string.h",
-    "include/gtest/internal/gtest-tuple.h",
-    "include/gtest/internal/gtest-type-util.h",
-
-    "src/gtest-all.cc",
-    "src/gtest-death-test.cc",
-    "src/gtest-filepath.cc",
-    "src/gtest-internal-inl.h",
-    "src/gtest-port.cc",
-    "src/gtest-printers.cc",
-    "src/gtest-test-part.cc",
-    "src/gtest-typed-test.cc",
-    "src/gtest.cc",
-  ]
-
-  include_dirs = [ "." ]
-
-  all_dependent_configs = [ ":gtest_config" ]
-  public_configs = [ ":gtest_direct_config" ]
-}
-
-source_set("gtest_main") {
-  testonly = true
-  sources = [
-    "src/gtest_main.cc",
-  ]
-  deps = [
-    ":gtest",
-  ]
-}
diff --git a/build/secondary/third_party/libchrome/BUILD.gn b/build/secondary/third_party/libchrome/BUILD.gn
index 4d1b6bd..48f82c6 100644
--- a/build/secondary/third_party/libchrome/BUILD.gn
+++ b/build/secondary/third_party/libchrome/BUILD.gn
@@ -16,12 +16,10 @@
 
 source_set("base_sources") {
   sources = [
-    "base/allocator/type_profiler_control.cc",
     "base/at_exit.cc",
     "base/atomic_ref_count.h",
     "base/atomic_sequence_num.h",
     "base/atomicops.h",
-    "base/atomicops_internals_x86_gcc.cc",
     "base/base64.cc",
     "base/base64.h",
     "base/base_export.h",
@@ -56,7 +54,6 @@
     "base/files/scoped_temp_dir.cc",
     "base/guid.cc",
     "base/guid_posix.cc",
-    "base/hash.cc",
     "base/json/json_parser.cc",
     "base/json/json_reader.cc",
     "base/json/json_string_value_serializer.cc",
@@ -72,13 +69,16 @@
     "base/memory/weak_ptr.cc",
     "base/message_loop/incoming_task_queue.cc",
     "base/message_loop/message_loop.cc",
-    "base/message_loop/message_loop_proxy.cc",
-    "base/message_loop/message_loop_proxy_impl.cc",
+    "base/message_loop/message_loop_task_runner.cc",
     "base/message_loop/message_pump.cc",
     "base/message_loop/message_pump_default.cc",
+
+    # we don't want any glib dependencies.
+    #   "base/message_loop/message_pump_glib.cc",
     "base/message_loop/message_pump_libevent.cc",
     "base/metrics/bucket_ranges.cc",
     "base/metrics/field_trial.cc",
+    "base/metrics/metrics_hashes.cc",
     "base/metrics/histogram_base.cc",
     "base/metrics/histogram.cc",
     "base/metrics/histogram_samples.cc",
@@ -115,6 +115,7 @@
     "base/sequence_checker_impl.cc",
     "base/sequenced_task_runner.cc",
     "base/sha1_portable.cc",
+    "base/strings/pattern.cc",
     "base/strings/safe_sprintf.cc",
     "base/strings/string16.cc",
     "base/strings/string_number_conversions.cc",
@@ -133,6 +134,7 @@
     "base/synchronization/waitable_event_posix.cc",
     "base/sync_socket_posix.cc",
     "base/sys_info.cc",
+
     # TODO(armansito): For our GN builds these platform-specific implementations
     # don't really make that much sense but instead of removing the line I'm
     # commenting it out in case we want to re-add it later (it's included in the
@@ -142,12 +144,8 @@
     "base/sys_info_posix.cc",
     "base/task/cancelable_task_tracker.cc",
     "base/task_runner.cc",
-    "base/third_party/dmg_fp/dtoa.cc",
-    "base/third_party/dmg_fp/g_fmt.cc",
-    "base/third_party/dynamic_annotations/dynamic_annotations.c",
     "base/third_party/icu/icu_utf.cc",
     "base/third_party/nspr/prtime.cc",
-    "base/third_party/superfasthash/superfasthash.c",
     "base/threading/non_thread_safe_impl.cc",
     "base/threading/platform_thread_internal_posix.cc",
     "base/threading/platform_thread_linux.cc",
@@ -174,6 +172,10 @@
     "base/time/tick_clock.cc",
     "base/time/time.cc",
     "base/time/time_posix.cc",
+    "base/trace_event/heap_profiler_allocation_context.cc",
+    "base/trace_event/heap_profiler_allocation_context_tracker.cc",
+    "base/trace_event/heap_profiler_stack_frame_deduplicator.cc",
+    "base/trace_event/heap_profiler_type_name_deduplicator.cc",
     "base/trace_event/malloc_dump_provider.cc",
     "base/trace_event/memory_allocator_dump.cc",
     "base/trace_event/memory_allocator_dump_guid.cc",
@@ -184,29 +186,46 @@
     "base/trace_event/process_memory_maps_dump_provider.cc",
     "base/trace_event/process_memory_totals.cc",
     "base/trace_event/process_memory_totals_dump_provider.cc",
+    "base/trace_event/trace_buffer.cc",
     "base/trace_event/trace_config.cc",
     "base/trace_event/trace_event_argument.cc",
     "base/trace_event/trace_event_impl.cc",
-    "base/trace_event/trace_event_impl_constants.cc",
-    "base/trace_event/trace_event_memory.cc",
     "base/trace_event/trace_event_memory_overhead.cc",
     "base/trace_event/trace_event_synthetic_delay.cc",
+    "base/trace_event/trace_log.cc",
+    "base/trace_event/trace_log_constants.cc",
+    "base/trace_event/trace_sampling_thread.cc",
     "base/tracked_objects.cc",
     "base/tracking_info.cc",
     "base/values.cc",
     "base/vlog.cc",
   ]
 
-  defines = [ "BASE_IMPLEMENTATION" ]
+  defines = [
+    "BASE_IMPLEMENTATION",
+
+    # trick libchrome to think we're building host code within an Android checkout
+    # thanks to it no glib dependency
+    "__ANDROID_HOST__=1",
+    "OS_LINUX=1",
+  ]
 
   include_dirs = [
     "//",
     "//third_party/libchrome",
+    "//third_party/libevent",
+    "//third_party/libevent/include",
     "//third_party/libchrome/base",
     "//third_party/modp_b64",
+    "//third_party/gtest/include",
   ]
 }
 
+config("libchrome_config") {
+  # libchrome headers need to be able to find themselves.
+  include_dirs = [ "//third_party/libchrome" ]
+}
+
 static_library("base") {
   deps = [
     ":base_sources",
@@ -224,5 +243,11 @@
     "-Wno-sign-promo",
   ]
 
-  libs = [ "-levent", "-levent_core", "-lpthread" ]
+  libs = [
+    "-levent",
+    "-levent_core",
+    "-lpthread",
+  ]
+
+  public_configs = [ ":libchrome_config" ]
 }
diff --git a/build/secondary/third_party/tinyxml2/BUILD.gn b/build/secondary/third_party/tinyxml2/BUILD.gn
deleted file mode 100644
index 335960b..0000000
--- a/build/secondary/third_party/tinyxml2/BUILD.gn
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#  Copyright (C) 2015 Google, Inc.
-#
-#  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.
-#
-
-static_library("tinyxml2") {
-  sources = [
-    "tinyxml2.cpp"
-  ]
-
-  include_dirs = [ "." ]
-}
diff --git a/build/toolchain/gcc/BUILD.gn b/build/toolchain/gcc/BUILD.gn
index ecf9057..888b015 100644
--- a/build/toolchain/gcc/BUILD.gn
+++ b/build/toolchain/gcc/BUILD.gn
@@ -54,7 +54,8 @@
     soname = "{{target_output_name}}{{output_extension}}"  # e.g. "libfoo.so".
     rspfile = soname + ".rsp"
 
-    command = "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile"
+    command =
+        "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile"
     rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}"
 
     description = "SOLINK $soname"
diff --git a/device/BUILD.gn b/device/BUILD.gn
index 797e0da..bfc42ec 100644
--- a/device/BUILD.gn
+++ b/device/BUILD.gn
@@ -17,7 +17,8 @@
 static_library("device") {
   sources = [
     "src/classic/peer.c",
-    "src/controller.c"
+    "src/controller.c",
+    "src/interop.c",
   ]
 
   include_dirs = [
@@ -36,17 +37,18 @@
     "test/classic/peer_test.cpp",
   ]
 
-  include_dirs = [
-    "//",
-    "//osi/include",
-  ]
+  include_dirs = [ "//" ]
 
   deps = [
     "//device",
     "//btcore",
     "//osi",
-    "//third_party/gtest:gtest_main",
+    "//third_party/googletest:gtest_main",
   ]
 
-  libs = [ "-lpthread", "-lrt", "-ldl" ]
+  libs = [
+    "-lpthread",
+    "-lrt",
+    "-ldl",
+  ]
 }
diff --git a/embdrv/sbc/BUILD.gn b/embdrv/sbc/BUILD.gn
index 7c9387c..7e75633 100644
--- a/embdrv/sbc/BUILD.gn
+++ b/embdrv/sbc/BUILD.gn
@@ -32,9 +32,7 @@
     "decoder/srce/synthesis-sbc.c",
   ]
 
-  include_dirs = [
-    "decoder/include",
-  ]
+  include_dirs = [ "decoder/include" ]
 }
 
 source_set("sbc_encoder") {
diff --git a/hci/BUILD.gn b/hci/BUILD.gn
index 496144d..35a0b78 100644
--- a/hci/BUILD.gn
+++ b/hci/BUILD.gn
@@ -37,6 +37,7 @@
     "include",
     "//",
     "//include",
+    "//bta/include",
     "//btcore/include",
     "//stack/include",
   ]
@@ -59,6 +60,7 @@
     "//include",
     "//btcore/include",
     "//hci/include",
+    "//osi/test",
     "//stack/include",
   ]
 
@@ -66,8 +68,12 @@
     "//hci",
     "//osi",
     "//btcore",
-    "//third_party/gtest:gtest_main",
+    "//third_party/googletest:gtest_main",
   ]
 
-  libs = [ "-lpthread", "-lrt", "-ldl" ]
+  libs = [
+    "-lpthread",
+    "-lrt",
+    "-ldl",
+  ]
 }
diff --git a/main/BUILD.gn b/main/BUILD.gn
index 1ffaee6..d7d0790 100644
--- a/main/BUILD.gn
+++ b/main/BUILD.gn
@@ -70,5 +70,15 @@
     "//utils",
   ]
 
-  libs = [ "-ldl", "-lpthread", "-lresolv", "-lrt", "-lz" ]
+  cflags_c = [
+    "-Lobj/osi",
+    "-losi",
+  ]
+  libs = [
+    "-ldl",
+    "-lpthread",
+    "-lresolv",
+    "-lrt",
+    "-lz",
+  ]
 }
diff --git a/osi/BUILD.gn b/osi/BUILD.gn
index b0a8f91..a52647a 100644
--- a/osi/BUILD.gn
+++ b/osi/BUILD.gn
@@ -42,14 +42,15 @@
     # dependencies are abstracted.
     "src/socket_utils/socket_local_client.c",
     "src/socket_utils/socket_local_server.c",
-
     "src/thread.c",
     "src/time.c",
+    "src/wakelock.c",
   ]
 
   include_dirs = [
     "//",
     "//utils/include",
+    "//stack/include",
   ]
 }
 
@@ -77,12 +78,16 @@
 
   include_dirs = [
     "//",
+    "//osi/test",
   ]
 
   deps = [
     "//osi",
-    "//third_party/gtest:gtest_main",
+    "//third_party/googletest:gtest_main",
   ]
 
-  libs = [ "-lpthread", "-lrt" ]
+  libs = [
+    "-lpthread",
+    "-lrt",
+  ]
 }
diff --git a/service/BUILD.gn b/service/BUILD.gn
index 616c7e8..e8d2fd3 100644
--- a/service/BUILD.gn
+++ b/service/BUILD.gn
@@ -17,48 +17,62 @@
 source_set("service") {
   sources = [
     "adapter.cpp",
-    "adapter_state.cpp",
     "daemon.cpp",
+    "gatt_client.cpp",
     "gatt_server.cpp",
-    "hal/bluetooth_interface.cpp",
-    "ipc/binder/bluetooth_binder_server.cpp",
-    "ipc/binder/IBluetooth.cpp",
-    "ipc/binder/IBluetoothCallback.cpp",
-    "ipc/binder/ipc_handler_binder.cpp",
-    "ipc/ipc_handler.cpp",
-    "ipc/ipc_handler_linux.cpp",
-    "ipc/ipc_manager.cpp",
-    "ipc/linux_ipc_host.cpp",
+    "gatt_server_old.cpp",
     "logging_helpers.cpp",
+    "low_energy_client.cpp",
     "settings.cpp",
-    "util/atomic_string.cpp",
-    "uuid.cpp"
+    "common/bluetooth/advertise_data.cpp",
+    "common/bluetooth/adapter_state.cpp",
+    "common/bluetooth/uuid.cpp",
+    "common/bluetooth/scan_filter.cpp",
+    "common/bluetooth/scan_result.cpp",
+    "common/bluetooth/scan_settings.cpp",
+    "common/bluetooth/gatt_identifier.cpp",
+    "common/bluetooth/advertise_settings.cpp",
+    "common/bluetooth/util/atomic_string.cpp",
+    "common/bluetooth/util/address_helper.cpp",
+    "hal/bluetooth_interface.cpp",
+    "hal/bluetooth_gatt_interface.cpp",
+    "hal/fake_bluetooth_gatt_interface.cpp",
+    "hal/fake_bluetooth_interface.cpp",
+    "hal/gatt_helpers.cpp",
+    "ipc/ipc_handler.cpp",
+    "ipc/linux_ipc_host.cpp",
+    "ipc/ipc_manager.cpp",
+    "ipc/ipc_handler_linux.cpp",
   ]
 
   include_dirs = [
     "//",
-    "//third_party/libchrome"
+    "//service/common",
+    "//third_party/libchrome",
+    "//third_party/modp_b64/modp64",
+    libhw_include_path,
   ]
 }
 
 executable("bluetoothtbd") {
   sources = [
-    "main.cpp"
+    "main.cpp",
   ]
 
   deps = [
     ":service",
     "//btcore",
     "//third_party/libchrome:base",
-    "//third_party/modp_b64"
+    "//third_party/modp_b64",
   ]
 
-  include_dirs = [
-    "//",
-    "//third_party/libchrome"
-  ]
+  include_dirs = [ "//" ]
 
-  libs = [ "-ldl", "-lpthread", "-lrt" ]
+  libs = [
+    "-ldl",
+    "-lpthread",
+    "-lrt",
+  ]
 }
 
 executable("service_unittests") {
@@ -70,16 +84,11 @@
     "test/uuid_unittest.cpp",
   ]
 
-  include_dirs = [
-    "//",
-    "//third_party/gmock/include",
-    "//third_party/libchrome"
-  ]
+  include_dirs = [ "//" ]
 
   deps = [
     ":service",
-    "//third_party/gmock:gmock_main",
-    "//third_party/gtest:gtest_main",
+    "//third_party/googletest:gmock_main",
     "//third_party/libchrome:base",
     "//third_party/modp_b64",
   ]
diff --git a/stack/BUILD.gn b/stack/BUILD.gn
index 95372d6..24afc93 100644
--- a/stack/BUILD.gn
+++ b/stack/BUILD.gn
@@ -148,6 +148,7 @@
     "sdp",
     "smp",
     "srvc",
+    "//osi/include",
     "//btcore/include",
     "//vnd/include",
     "//vnd/ble",
diff --git a/test/suite/BUILD.gn b/test/suite/BUILD.gn
index 74d6b75..7218852 100644
--- a/test/suite/BUILD.gn
+++ b/test/suite/BUILD.gn
@@ -17,18 +17,8 @@
 executable("net_test_bluetooth") {
   testonly = true
   sources = [
-    "cases/adapter.c",
-    "cases/cases.c",
-    "cases/gatt.c",
-    "cases/pan.c",
-    "cases/rfcomm.c",
-    "support/adapter.c",
-    "support/callbacks.c",
-    "support/gatt.c",
-    "support/hal.c",
-    "support/pan.c",
-    "support/rfcomm.c",
-    "main.cpp",
+    "adapter/adapter_unittest.cpp",
+    "adapter/bluetooth_test.cpp",
   ]
 
   include_dirs = [
@@ -39,10 +29,16 @@
   deps = [
     "//btcore",
     "//main:bluetooth.default",
+    "//service:service",
+    "//service:service_unittests",
+    "//third_party/libchrome:base",
     "//osi",
-    "//third_party/gtest:gtest_main",
+    "//third_party/googletest:gtest_main",
   ]
 
-  libs = [ "-lpthread", "-lrt", "-ldl" ]
-
+  libs = [
+    "-lpthread",
+    "-lrt",
+    "-ldl",
+  ]
 }
diff --git a/udrv/BUILD.gn b/udrv/BUILD.gn
index 1fb16f7..90c84b5 100644
--- a/udrv/BUILD.gn
+++ b/udrv/BUILD.gn
@@ -16,7 +16,7 @@
 
 source_set("udrv") {
   sources = [
-    "ulinux/uipc.c"
+    "ulinux/uipc.c",
   ]
 
   include_dirs = [
diff --git a/utils/BUILD.gn b/utils/BUILD.gn
index 2b7dc59..e7a5315 100644
--- a/utils/BUILD.gn
+++ b/utils/BUILD.gn
@@ -16,7 +16,7 @@
 
 static_library("utils") {
   sources = [
-    "src/bt_utils.c"
+    "src/bt_utils.c",
   ]
 
   include_dirs = [
diff --git a/vendor_libs/BUILD.gn b/vendor_libs/BUILD.gn
index a088315..2a12558 100644
--- a/vendor_libs/BUILD.gn
+++ b/vendor_libs/BUILD.gn
@@ -17,6 +17,7 @@
 group("vendor-libs") {
   deps = [
     "linux:bt-vendor-linux",
-    "test_vendor_lib:test_vendor_lib",
+    #TODO(jpawlowski): uncomment when building fixed
+    #    "test_vendor_lib:test_vendor_lib",
   ]
 }
diff --git a/vendor_libs/linux/BUILD.gn b/vendor_libs/linux/BUILD.gn
index 6026001..2179a64 100644
--- a/vendor_libs/linux/BUILD.gn
+++ b/vendor_libs/linux/BUILD.gn
@@ -16,10 +16,8 @@
 
 shared_library("bt-vendor-linux") {
   sources = [
-    "bt_vendor_linux.c"
+    "bt_vendor_linux.c",
   ]
 
-  include_dirs = [
-    "//"
-  ]
+  include_dirs = [ "//" ]
 }
diff --git a/vendor_libs/test_vendor_lib/BUILD.gn b/vendor_libs/test_vendor_lib/BUILD.gn
index 4bcbd11..76f4651 100644
--- a/vendor_libs/test_vendor_lib/BUILD.gn
+++ b/vendor_libs/test_vendor_lib/BUILD.gn
@@ -14,9 +14,11 @@
   include_dirs = [
     "include",
     "//",
+
     # TODO(dennischeng): Ideally we should need to have the lines below for
     # indirect includes.
     "//stack/include",
+    "//third_party/libchrome:base",
   ]
 }
 
@@ -40,7 +42,7 @@
   ]
 
   deps = [
-    "//third_party/gtest:gtest_main",
+    "//third_party/googletest:gtest_main",
     "//third_party/libchrome:base",
     "//vendor_libs/test_vendor_lib",
   ]