diff --git a/BUILD.gn b/BUILD.gn index ab916ab879a00877d9e29392835c42848dac960e..bf9b51c3ba7f84ce198d2ca4199ebeb6c2195b4b 100644 --- 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 = [ diff --git a/system/bta/BUILD.gn b/system/bta/BUILD.gn index 4b763d55b4a6c6b350a124f4b1e6d3a8423b6ea7..ab7c327f5861e30294c1ad086447e4e18934ad2b 100644 --- a/system/bta/BUILD.gn +++ b/system/bta/BUILD.gn @@ -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", ] } diff --git a/system/btcore/BUILD.gn b/system/btcore/BUILD.gn index a0b0ca35d703ad6b23fe4a17548a3ed8c62efffa..ea55aa72228a78ad4c6fcc04f623ba32c31c39c0 100644 --- a/system/btcore/BUILD.gn +++ b/system/btcore/BUILD.gn @@ -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", ] } diff --git a/system/btif/src/btif_hd.cc b/system/btif/src/btif_hd.cc index 8699fd91a63f99f11bb389437425709f6282fea3..1eb64dd654fa8549b100fae1ea3fcb9f10d5d9d9 100644 --- a/system/btif/src/btif_hd.cc +++ b/system/btif/src/btif_hd.cc @@ -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 diff --git a/system/device/BUILD.gn b/system/device/BUILD.gn index 581f044a9151fa16cbb36793e047ad70d42e6d44..b0c026146872cc344ef95cdcedd50f0e552ce7e6 100644 --- a/system/device/BUILD.gn +++ b/system/device/BUILD.gn @@ -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/system/gd/BUILD.gn b/system/gd/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5b6a524edd5f8bf1445cda5cc074cfb629ff05f5 --- /dev/null +++ b/system/gd/BUILD.gn @@ -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" ] +} diff --git a/system/gd/common/BUILD.gn b/system/gd/common/BUILD.gn index 288a04ef7bdcf85a69d98b42d5edd3cefc761fa9..58a836a351bfe85a85f295441ea68595a7ee0a85 100644 --- a/system/gd/common/BUILD.gn +++ b/system/gd/common/BUILD.gn @@ -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/system/gd/dumpsys/bundler/BUILD.gn b/system/gd/dumpsys/bundler/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ce0d0d73d1cf6e13749a242a2a140321f5d4aecd --- /dev/null +++ b/system/gd/dumpsys/bundler/BUILD.gn @@ -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/system/gd/hci/BUILD.gn b/system/gd/hci/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5eb2fca5108d37b23ef1e8e274ea6a67302a03b5 --- /dev/null +++ b/system/gd/hci/BUILD.gn @@ -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" ] +} diff --git a/system/gd/rust/shim/BUILD.gn b/system/gd/rust/shim/BUILD.gn index 8843c934ad43d49f5e80ab707337f682271812a1..d42f822cbeaf1c37f7ef3e9ed8ece6343234748e 100644 --- a/system/gd/rust/shim/BUILD.gn +++ b/system/gd/rust/shim/BUILD.gn @@ -16,14 +16,33 @@ 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" ] } diff --git a/system/main/BUILD.gn b/system/main/BUILD.gn index 54461b382b32f45913332d6377c2b85ed81dba73..c694a7c35cad0008daf3b4a42fa6b77ce9141bbc 100644 --- a/system/main/BUILD.gn +++ b/system/main/BUILD.gn @@ -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/system/main/shim/BUILD.gn b/system/main/shim/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ddfcbf02be673d7f42c726a7049190dce8ee5548 --- /dev/null +++ b/system/main/shim/BUILD.gn @@ -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" ] +} diff --git a/system/profile/avrcp/BUILD.gn b/system/profile/avrcp/BUILD.gn index c93c07ff28511299be3bf506bb755694ee5a1d95..5e54fff6041cc708b553487a36b2a36adb432b23 100644 --- a/system/profile/avrcp/BUILD.gn +++ b/system/profile/avrcp/BUILD.gn @@ -35,6 +35,10 @@ static_library("profile_avrcp") { "device.cc", ] + deps = [ + "//bt/gd/rust/shim:message_loop_thread_bridge_header", + ] + configs += [ ":avrcp_config" ]