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 {
11    name: "libbt_hal",
12    defaults: ["gd_rust_defaults"],
13    crate_name: "bt_hal",
14    srcs: ["src/lib.rs"],
15    edition: "2018",
16    rustlibs: [
17        "libbt_facade_proto",
18        "libbt_packets",
19        "libbytes",
20        "libfutures",
21        "libthiserror",
22        "libgrpcio",
23        "libtokio",
24        "libprotobuf",
25        "libbt_packets",
26        "libgddi",
27        "libcxx",
28        "liblazy_static",
29        "liblog_rust",
30        "libbt_common",
31        "libnum_traits",
32        "libbt_facade_helpers",
33    ],
34    proc_macros: [
35        "libnum_derive",
36    ],
37    target: {
38        android: {
39            whole_static_libs: ["libbt_hidl_hal_cxx"],
40            shared_libs: [
41                "android.hardware.bluetooth@1.0",
42                "android.hardware.bluetooth@1.1",
43                "libhidlbase",
44                "libutils",
45            ],
46        },
47    },
48}
49
50genrule {
51    name: "libbt_hidl_hal_bridge_header",
52    tools: ["cxxbridge"],
53    cmd: "$(location cxxbridge) $(in) --header > $(out)",
54    srcs: ["src/hidl_hal.rs"],
55    out: ["src/hidl_hal.rs.h"],
56}
57
58genrule {
59    name: "libbt_hidl_hal_bridge_code",
60    tools: ["cxxbridge"],
61    cmd: "$(location cxxbridge) $(in) >> $(out)",
62    srcs: ["src/hidl_hal.rs"],
63    out: ["hidl_hal_generated.cc"],
64}
65
66cc_library_static {
67    name: "libbt_hidl_hal_cxx",
68    defaults: ["gd_ffi_defaults"],
69    srcs: ["src/ffi/hidl.cc"],
70    local_include_dirs: ["src/ffi"],
71    generated_headers: ["libbt_hidl_hal_bridge_header", "cxx-bridge-header"],
72    generated_sources: ["libbt_hidl_hal_bridge_code"],
73    shared_libs: [
74        "android.hardware.bluetooth@1.0",
75        "android.hardware.bluetooth@1.1",
76        "libhidlbase",
77        "libutils",
78    ],
79}
80