From: Sonny Sasaka Date: Tue, 9 Feb 2021 06:09:59 +0000 (-0800) Subject: Add gn builds for main/shim X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=5bc5b6c961;p=android-x86%2Fsystem-bt.git Add gn builds for main/shim 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 --- diff --git a/BUILD.gn b/BUILD.gn index ab916ab87..bf9b51c3b 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/bta/BUILD.gn b/bta/BUILD.gn index 4b763d55b..ab7c327f5 100644 --- a/bta/BUILD.gn +++ b/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/btcore/BUILD.gn b/btcore/BUILD.gn index a0b0ca35d..ea55aa722 100644 --- a/btcore/BUILD.gn +++ b/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/btif/src/btif_hd.cc b/btif/src/btif_hd.cc index 8699fd91a..1eb64dd65 100644 --- a/btif/src/btif_hd.cc +++ b/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/device/BUILD.gn b/device/BUILD.gn index 581f044a9..b0c026146 100644 --- a/device/BUILD.gn +++ b/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/gd/BUILD.gn b/gd/BUILD.gn new file mode 100644 index 000000000..5b6a524ed --- /dev/null +++ b/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/gd/common/BUILD.gn b/gd/common/BUILD.gn index 288a04ef7..58a836a35 100644 --- a/gd/common/BUILD.gn +++ b/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/gd/dumpsys/bundler/BUILD.gn b/gd/dumpsys/bundler/BUILD.gn new file mode 100644 index 000000000..ce0d0d73d --- /dev/null +++ b/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/gd/hci/BUILD.gn b/gd/hci/BUILD.gn new file mode 100644 index 000000000..5eb2fca51 --- /dev/null +++ b/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/gd/rust/shim/BUILD.gn b/gd/rust/shim/BUILD.gn index 8843c934a..d42f822cb 100644 --- a/gd/rust/shim/BUILD.gn +++ b/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/main/BUILD.gn b/main/BUILD.gn index 54461b382..c694a7c35 100644 --- a/main/BUILD.gn +++ b/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/main/shim/BUILD.gn b/main/shim/BUILD.gn new file mode 100644 index 000000000..ddfcbf02b --- /dev/null +++ b/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/profile/avrcp/BUILD.gn b/profile/avrcp/BUILD.gn index c93c07ff2..5e54fff60 100644 --- a/profile/avrcp/BUILD.gn +++ b/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" ]