• 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_defaults {
11    name: "gd_rust_defaults",
12    target: {
13        darwin: {
14            enabled: false,
15        },
16    },
17    host_supported: true,
18}
19
20cc_defaults {
21    name: "gd_ffi_defaults",
22    target: {
23        darwin: {
24            enabled: false,
25        },
26    },
27}
28
29rust_ffi_static {
30    name: "libbt_shim_ffi",
31    defaults: ["gd_rust_defaults"],
32    crate_name: "bt_shim",
33    srcs: ["src/lib.rs"],
34    rustlibs: [
35        "libbt_hal",
36        "libbt_hci",
37        "libbt_common",
38        "libcxx",
39        "libtokio",
40        "libbt_main",
41        "libbt_packets",
42        "libfutures",
43        "libnum_traits",
44        "libnix",
45        "liblog_rust",
46        "libbt_facade_helpers",
47    ],
48    proc_macros: [
49        "libpaste",
50    ],
51    whole_static_libs: [
52        "libbt_callbacks_cxx",
53    ],
54}
55
56cc_library_static {
57    name: "libbluetooth_rust_interop",
58    defaults: ["gd_ffi_defaults"],
59    generated_headers: [
60        "libbt_init_flags_bridge_header",
61        "libbt_shim_bridge_header",
62        "libbt_message_loop_thread_bridge_header",
63        "cxx-bridge-header",
64    ],
65    generated_sources: [
66        "libbt_init_flags_bridge_code",
67        "libbt_shim_bridge_code",
68        "libbt_message_loop_thread_bridge_code",
69    ],
70    export_generated_headers: [
71        "libbt_init_flags_bridge_header",
72        "libbt_shim_bridge_header",
73        "libbt_message_loop_thread_bridge_header",
74        "cxx-bridge-header",
75    ],
76    header_libs: ["libbt_callbacks_cxx_headers"],
77    export_header_lib_headers: ["libbt_callbacks_cxx_headers"],
78    cflags: [
79        "-Wno-unused-const-variable",
80    ],
81    host_supported: true,
82    apex_available: [
83        "//apex_available:platform",
84        "com.android.bluetooth.updatable",
85    ],
86    shared_libs: [
87        "libchrome",
88    ],
89    whole_static_libs: [
90        "libbt_shim_ffi",
91    ],
92}
93
94cc_library_static {
95    name: "libbt_callbacks_cxx",
96    defaults: ["gd_ffi_defaults"],
97    header_libs: ["libbt_callbacks_cxx_headers"],
98    srcs: ["callbacks/callbacks.cc"],
99    generated_headers: ["libbt_shim_bridge_header", "cxx-bridge-header"],
100    shared_libs: [
101        "libchrome",
102    ],
103    host_supported: true,
104}
105
106cc_library_headers {
107    name: "libbt_callbacks_cxx_headers",
108    local_include_dirs: ["callbacks"],
109    host_supported: true,
110}
111
112genrule {
113    name: "libbt_shim_bridge_header",
114    tools: ["cxxbridge"],
115    cmd: "$(location cxxbridge) $(in) --header > $(out)",
116    srcs: ["src/bridge.rs"],
117    out: ["src/bridge.rs.h"],
118}
119
120genrule {
121    name: "libbt_shim_bridge_code",
122    tools: ["cxxbridge"],
123    cmd: "$(location cxxbridge) $(in) >> $(out)",
124    srcs: ["src/bridge.rs"],
125    out: ["bridge.cc"],
126}
127
128genrule {
129    name: "libbt_init_flags_bridge_header",
130    tools: ["cxxbridge"],
131    cmd: "$(location cxxbridge) $(in) --header > $(out)",
132    srcs: ["src/init_flags.rs"],
133    out: ["src/init_flags.rs.h"],
134}
135
136genrule {
137    name: "libbt_init_flags_bridge_code",
138    tools: ["cxxbridge"],
139    cmd: "$(location cxxbridge) $(in) >> $(out)",
140    srcs: ["src/init_flags.rs"],
141    out: ["init_flags.cc"],
142}
143
144genrule {
145    name: "libbt_message_loop_thread_bridge_header",
146    tools: ["cxxbridge"],
147    cmd: "$(location cxxbridge) $(in) --header > $(out)",
148    srcs: ["src/message_loop_thread.rs"],
149    out: ["src/message_loop_thread.rs.h"],
150}
151
152genrule {
153    name: "libbt_message_loop_thread_bridge_code",
154    tools: ["cxxbridge"],
155    cmd: "$(location cxxbridge) $(in) >> $(out)",
156    srcs: ["src/message_loop_thread.rs"],
157    out: ["message_loop_thread.cc"],
158}
159