OSDN Git Service

Add gn builds for main/shim
authorSonny Sasaka <sonnysasaka@google.com>
Tue, 9 Feb 2021 06:09:59 +0000 (22:09 -0800)
committerHansong Zhang <hsz@google.com>
Wed, 24 Feb 2021 00:56:51 +0000 (00:56 +0000)
This adds GN builds for main/shim, along the way adding some fixes:
* Add message_loop_thread_bridge_header to use Rust's message loop
* Add some missing includes
* Build files for dumpsys
* Add gd/hci gn build

Bug: 176847216
Tag: #refactor
Test: atest --host bluetooth_test_common

Change-Id: Ide1edbb70076c4dcc4a4e6ee41303a9e315d52af

13 files changed:
BUILD.gn
bta/BUILD.gn
btcore/BUILD.gn
btif/src/btif_hd.cc
device/BUILD.gn
gd/BUILD.gn [new file with mode: 0644]
gd/common/BUILD.gn
gd/dumpsys/bundler/BUILD.gn [new file with mode: 0644]
gd/hci/BUILD.gn [new file with mode: 0644]
gd/rust/shim/BUILD.gn
main/BUILD.gn
main/shim/BUILD.gn [new file with mode: 0644]
profile/avrcp/BUILD.gn

index ab916ab..bf9b51c 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -90,6 +90,7 @@ config("target_defaults") {
     "-Wno-unused-result",
     "-Wno-unused-variable",
     "-Wno-unused-const-variable",
+    "-Wno-format",
   ]
 
   cflags_cc = [
index 4b763d5..ab7c327 100644 (file)
@@ -117,7 +117,9 @@ static_library("bta") {
   ]
 
   deps = [
+    "//bt/gd/rust/shim:hci_bridge_header",
     "//bt/gd/rust/shim:init_flags_bridge_header",
+    "//bt/gd/rust/shim:message_loop_thread_bridge_header",
   ]
 }
 
index a0b0ca3..ea55aa7 100644 (file)
@@ -34,6 +34,7 @@ static_library("btcore") {
 
   deps = [
     "//bt/gd/rust/shim:init_flags_bridge_header",
+    "//bt/gd/rust/shim:message_loop_thread_bridge_header",
   ]
 }
 
index 8699fd9..1eb64dd 100644 (file)
@@ -44,6 +44,7 @@
 #include "btif_storage.h"
 #include "btif_util.h"
 #include "osi/include/allocator.h"
+#include "osi/include/compat.h"
 
 #define BTIF_HD_APP_NAME_LEN 50
 #define BTIF_HD_APP_DESCRIPTION_LEN 50
index 581f044..b0c0261 100644 (file)
@@ -35,6 +35,7 @@ static_library("device") {
 
   deps = [
     "//bt/gd/rust/shim:init_flags_bridge_header",
+    "//bt/gd/rust/shim:message_loop_thread_bridge_header",
   ]
 }
 
diff --git a/gd/BUILD.gn b/gd/BUILD.gn
new file mode 100644 (file)
index 0000000..5b6a524
--- /dev/null
@@ -0,0 +1,38 @@
+#
+#  Copyright 2021 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.
+
+import("//common-mk/flatbuffer.gni")
+
+config("dumpsys_config") {
+  include_dirs = [
+    "$target_gen_dir",
+    "$target_gen_dir/common",
+    "$target_gen_dir/hci",
+    "$target_gen_dir/l2cap/classic",
+    "$target_gen_dir/shim",
+  ]
+}
+
+flatbuffer("dumpsys") {
+  sources = [
+    "common/init_flags.fbs",
+    "dumpsys_data.fbs",
+    "hci/hci_acl_manager.fbs",
+    "l2cap/classic/l2cap_classic_module.fbs",
+    "shim/dumpsys.fbs",
+  ]
+
+  all_dependent_configs = [ ":dumpsys_config" ]
+}
index 288a04e..58a836a 100644 (file)
@@ -21,6 +21,10 @@ source_set("BluetoothCommonSources") {
     "strings.cc",
   ]
 
+  deps = [
+    "//bt/gd/rust/shim:init_flags_bridge_header",
+  ]
+
   include_dirs = [ "//bt/gd" ]
 
   configs += [ "//bt:target_defaults" ]
diff --git a/gd/dumpsys/bundler/BUILD.gn b/gd/dumpsys/bundler/BUILD.gn
new file mode 100644 (file)
index 0000000..ce0d0d7
--- /dev/null
@@ -0,0 +1,26 @@
+#
+#  Copyright 2021 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.
+
+import("//common-mk/flatbuffer.gni")
+
+config("bundler_generated_config") {
+  include_dirs = [ "$target_gen_dir" ]
+}
+
+flatbuffer("bundler_generated") {
+  sources = [ "bundler.fbs" ]
+
+  all_dependent_configs = [ ":bundler_generated_config" ]
+}
diff --git a/gd/hci/BUILD.gn b/gd/hci/BUILD.gn
new file mode 100644 (file)
index 0000000..5eb2fca
--- /dev/null
@@ -0,0 +1,43 @@
+#
+#  Copyright 2021 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.
+
+source_set("BluetoothHciSources") {
+  sources = [
+    "acl_manager.cc",
+    "acl_manager/acl_connection.cc",
+    "acl_manager/acl_fragmenter.cc",
+    "acl_manager/classic_acl_connection.cc",
+    "acl_manager/le_acl_connection.cc",
+    "acl_manager/round_robin_scheduler.cc",
+    "address.cc",
+    "class_of_device.cc",
+    "controller.cc",
+    "hci_layer.cc",
+    "le_address_manager.cc",
+    "le_advertising_manager.cc",
+    "le_scanning_manager.cc",
+    "link_key.cc",
+    "uuid.cc",
+  ]
+
+  include_dirs = [ "//bt/gd" ]
+
+  deps = [
+    "//bt/gd:dumpsys",
+    "//bt/gd/rust/shim:init_flags_bridge_header",
+  ]
+
+  configs += [ "//bt:target_defaults" ]
+}
index 8843c93..d42f822 100644 (file)
 
 import("//common-mk/cxxbridge.gni")
 
+config("rust_shim_config") {
+  include_dirs = [
+    "//bt/gd/rust/shim"
+  ]
+}
+
 cxxbridge_header("shim_bridge_header") {
   sources = [ "src/stack.rs" ]
+  all_dependent_configs = [ ":rust_shim_config" ]
 }
 
 cxxbridge_header("init_flags_bridge_header") {
   sources = [ "src/init_flags.rs" ]
+  all_dependent_configs = [ ":rust_shim_config" ]
 }
 
 cxxbridge_header("hci_bridge_header") {
   sources = [ "src/hci.rs" ]
+  all_dependent_configs = [ ":rust_shim_config" ]
+}
+
+cxxbridge_header("message_loop_thread_bridge_header") {
+  sources = [ "src/message_loop_thread.rs" ]
+  all_dependent_configs = [ ":rust_shim_config" ]
+}
+
+cxxbridge_header("controller_bridge_header") {
+  sources = [ "src/controller.rs" ]
+  all_dependent_configs = [ ":rust_shim_config" ]
 }
index 54461b3..c694a7c 100644 (file)
@@ -69,6 +69,7 @@ shared_library("bluetooth") {
     "//bt/gd/common:BluetoothCommonSources",
     "//bt/hci",
     "//bt/osi",
+    "//bt/main/shim",
     "//bt/packet",
     "//bt/stack",
     "//bt/udrv",
diff --git a/main/shim/BUILD.gn b/main/shim/BUILD.gn
new file mode 100644 (file)
index 0000000..ddfcbf0
--- /dev/null
@@ -0,0 +1,64 @@
+#
+#  Copyright 2021 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.
+
+source_set("shim") {
+  sources = [
+    "acl.cc",
+    "acl_api.cc",
+    "acl_legacy_interface.cc",
+    "btm.cc",
+    "btm_api.cc",
+    "config.cc",
+    "controller.cc",
+    "dumpsys.cc",
+    "entry.cc",
+    "hci_layer.cc",
+    "l2c_api.cc",
+    "le_advertising_manager.cc",
+    "le_scanning_manager.cc",
+    "link_policy.cc",
+    "shim.cc",
+    "stack.cc",
+  ]
+
+  include_dirs = [
+    "//bt",
+    "//bt/btif/include",
+    "//bt/gd",
+    "//bt/gd/rust/shim",
+    "//bt/internal_include",
+    "//bt/stack/include",
+    "//bt/types",
+  ]
+
+  deps = [
+    "//bt/gd:dumpsys",
+    "//bt/gd/common:BluetoothCommonSources",
+    "//bt/gd/dumpsys/bundler:bundler_generated",
+    "//bt/gd/hci:BluetoothHciSources",
+    "//bt/gd/os:BluetoothOsSources_linux_generic",
+    "//bt/gd/packet:BluetoothPacketSources",
+    "//bt/gd/rust/shim:hci_bridge_header",
+    "//bt/gd/rust/shim:init_flags_bridge_header",
+    "//bt/gd/rust/shim:shim_bridge_header",
+    "//bt/gd/rust/shim:message_loop_thread_bridge_header",
+    "//bt/gd/rust/shim:controller_bridge_header",
+    "//bt/osi",
+    "//bt/stack",
+    "//bt/types",
+  ]
+
+  configs += [ "//bt:target_defaults" ]
+}
index c93c07f..5e54fff 100644 (file)
@@ -35,6 +35,10 @@ static_library("profile_avrcp") {
     "device.cc",
   ]
 
+  deps = [
+    "//bt/gd/rust/shim:message_loop_thread_bridge_header",
+  ]
+
   configs += [
     ":avrcp_config"
   ]