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