1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
package {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "system_bt_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["system_bt_license"],
}
rust_library_host_rlib {
name: "libbt_topshim",
defaults: ["gd_rust_defaults"],
crate_name: "bt_topshim",
srcs: [
"src/lib.rs",
":libbt_topshim_wrapper_bindgen",
],
rustlibs: [
"libbitflags",
"libbluetooth_rs",
"libbt_common",
"libbt_facade_helpers",
"libclap",
"libcxx",
"libgrpcio",
"libtokio",
"libtokio_stream",
"libbt_packets",
"libfutures",
"libnum_traits",
"libnix",
"liblog_rust",
],
proc_macros: [
"libnum_derive",
"libpaste",
"libtopshim_macros",
],
lints: "none",
clippy_lints: "none",
}
cc_library_static {
name: "libbt_topshim_cxx",
defaults: ["gd_ffi_defaults"],
header_libs: ["libbt_callbacks_cxx_headers"],
srcs: [
"btav/btav_shim.cc",
"btav_sink/btav_sink_shim.cc",
"btif/btif_shim.cc",
"gatt/gatt_shim.cc",
"hfp/hfp_shim.cc",
"controller/controller_shim.cc",
],
generated_headers: ["libbt_topshim_bridge_header", "cxx-bridge-header"],
generated_sources: ["libbt_topshim_bridge_code"],
shared_libs: [
"libchrome",
],
include_dirs: [
"system/bt",
"system/bt/gd/rust/topshim",
"system/bt/include",
"system/bt/types",
],
host_supported: true,
}
gensrcs {
name: "libbt_topshim_bridge_header",
tools: ["cxxbridge"],
cmd: "$(location cxxbridge) $(in) --header > $(out)",
srcs: [
"src/btif.rs",
"src/profiles/a2dp.rs",
"src/profiles/avrcp.rs",
"src/profiles/gatt.rs",
"src/controller.rs",
],
output_extension: "rs.h",
export_include_dirs: ["."],
}
gensrcs {
name: "libbt_topshim_bridge_code",
tools: ["cxxbridge"],
cmd: "$(location cxxbridge) $(in) > $(out)",
srcs: [
"src/btif.rs",
"src/profiles/a2dp.rs",
"src/profiles/avrcp.rs",
"src/profiles/gatt.rs",
"src/controller.rs",
],
output_extension: "cc",
export_include_dirs: ["."],
}
rust_bindgen {
name: "libbt_topshim_wrapper_bindgen",
wrapper_src: "bindings/wrapper.hpp",
crate_name: "bt_topshim_wrapper_bindgen",
source_stem: "bindings",
cpp_std: "c++17",
host_supported: true,
bindgen_flags: [
"--size_t-is-usize",
"--allowlist-function=bt_.*",
"--allowlist-function=bthh_.*",
"--allowlist-function=btgatt_.*",
"--allowlist-function=btsdp.*",
"--allowlist-function=hal_util_.*",
"--allowlist-type=bt_.*",
"--allowlist-type=bthh_.*",
"--allowlist-type=btgatt_.*",
"--allowlist-type=bluetooth_sdp.*",
"--allowlist-type=btsdp.*",
"--enable-cxx-namespaces",
"--opaque-type=std::.*",
"--with-derive-default",
"--with-derive-partialeq",
"--with-derive-eq",
],
shared_libs: [
"libc++",
],
header_libs: [
"libbluetooth_headers",
],
include_dirs: ["system/bt"],
}
|