Skip to content

Commit 019ce6f

Browse files
Sonny SasakaHansong Zhang
authored andcommitted
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
1 parent a4cf58d commit 019ce6f

File tree

13 files changed

+205
-0
lines changed

13 files changed

+205
-0
lines changed

BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ config("target_defaults") {
9090
"-Wno-unused-result",
9191
"-Wno-unused-variable",
9292
"-Wno-unused-const-variable",
93+
"-Wno-format",
9394
]
9495

9596
cflags_cc = [

system/bta/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ static_library("bta") {
117117
]
118118

119119
deps = [
120+
"//bt/gd/rust/shim:hci_bridge_header",
120121
"//bt/gd/rust/shim:init_flags_bridge_header",
122+
"//bt/gd/rust/shim:message_loop_thread_bridge_header",
121123
]
122124
}
123125

system/btcore/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ static_library("btcore") {
3434

3535
deps = [
3636
"//bt/gd/rust/shim:init_flags_bridge_header",
37+
"//bt/gd/rust/shim:message_loop_thread_bridge_header",
3738
]
3839
}
3940

system/btif/src/btif_hd.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "btif_storage.h"
4545
#include "btif_util.h"
4646
#include "osi/include/allocator.h"
47+
#include "osi/include/compat.h"
4748

4849
#define BTIF_HD_APP_NAME_LEN 50
4950
#define BTIF_HD_APP_DESCRIPTION_LEN 50

system/device/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ static_library("device") {
3535

3636
deps = [
3737
"//bt/gd/rust/shim:init_flags_bridge_header",
38+
"//bt/gd/rust/shim:message_loop_thread_bridge_header",
3839
]
3940
}
4041

system/gd/BUILD.gn

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#
2+
# Copyright 2021 Google, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at:
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
import("//common-mk/flatbuffer.gni")
17+
18+
config("dumpsys_config") {
19+
include_dirs = [
20+
"$target_gen_dir",
21+
"$target_gen_dir/common",
22+
"$target_gen_dir/hci",
23+
"$target_gen_dir/l2cap/classic",
24+
"$target_gen_dir/shim",
25+
]
26+
}
27+
28+
flatbuffer("dumpsys") {
29+
sources = [
30+
"common/init_flags.fbs",
31+
"dumpsys_data.fbs",
32+
"hci/hci_acl_manager.fbs",
33+
"l2cap/classic/l2cap_classic_module.fbs",
34+
"shim/dumpsys.fbs",
35+
]
36+
37+
all_dependent_configs = [ ":dumpsys_config" ]
38+
}

system/gd/common/BUILD.gn

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ source_set("BluetoothCommonSources") {
2121
"strings.cc",
2222
]
2323

24+
deps = [
25+
"//bt/gd/rust/shim:init_flags_bridge_header",
26+
]
27+
2428
include_dirs = [ "//bt/gd" ]
2529

2630
configs += [ "//bt:target_defaults" ]

system/gd/dumpsys/bundler/BUILD.gn

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Copyright 2021 Google, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at:
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
import("//common-mk/flatbuffer.gni")
17+
18+
config("bundler_generated_config") {
19+
include_dirs = [ "$target_gen_dir" ]
20+
}
21+
22+
flatbuffer("bundler_generated") {
23+
sources = [ "bundler.fbs" ]
24+
25+
all_dependent_configs = [ ":bundler_generated_config" ]
26+
}

system/gd/hci/BUILD.gn

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#
2+
# Copyright 2021 Google, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at:
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
source_set("BluetoothHciSources") {
17+
sources = [
18+
"acl_manager.cc",
19+
"acl_manager/acl_connection.cc",
20+
"acl_manager/acl_fragmenter.cc",
21+
"acl_manager/classic_acl_connection.cc",
22+
"acl_manager/le_acl_connection.cc",
23+
"acl_manager/round_robin_scheduler.cc",
24+
"address.cc",
25+
"class_of_device.cc",
26+
"controller.cc",
27+
"hci_layer.cc",
28+
"le_address_manager.cc",
29+
"le_advertising_manager.cc",
30+
"le_scanning_manager.cc",
31+
"link_key.cc",
32+
"uuid.cc",
33+
]
34+
35+
include_dirs = [ "//bt/gd" ]
36+
37+
deps = [
38+
"//bt/gd:dumpsys",
39+
"//bt/gd/rust/shim:init_flags_bridge_header",
40+
]
41+
42+
configs += [ "//bt:target_defaults" ]
43+
}

system/gd/rust/shim/BUILD.gn

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,33 @@
1616

1717
import("//common-mk/cxxbridge.gni")
1818

19+
config("rust_shim_config") {
20+
include_dirs = [
21+
"//bt/gd/rust/shim"
22+
]
23+
}
24+
1925
cxxbridge_header("shim_bridge_header") {
2026
sources = [ "src/stack.rs" ]
27+
all_dependent_configs = [ ":rust_shim_config" ]
2128
}
2229

2330
cxxbridge_header("init_flags_bridge_header") {
2431
sources = [ "src/init_flags.rs" ]
32+
all_dependent_configs = [ ":rust_shim_config" ]
2533
}
2634

2735
cxxbridge_header("hci_bridge_header") {
2836
sources = [ "src/hci.rs" ]
37+
all_dependent_configs = [ ":rust_shim_config" ]
38+
}
39+
40+
cxxbridge_header("message_loop_thread_bridge_header") {
41+
sources = [ "src/message_loop_thread.rs" ]
42+
all_dependent_configs = [ ":rust_shim_config" ]
43+
}
44+
45+
cxxbridge_header("controller_bridge_header") {
46+
sources = [ "src/controller.rs" ]
47+
all_dependent_configs = [ ":rust_shim_config" ]
2948
}

0 commit comments

Comments
 (0)