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_ffi {
11    name: "librootcanal_rs",
12    host_supported: true,
13    vendor_available: true,
14    crate_name: "rootcanal_rs",
15    srcs: [
16        "src/lib.rs",
17
18        ":rootcanal_hci_packets_rust_gen",
19        ":rootcanal_llcp_packets_rust_gen",
20        ":rootcanal_lmp_packets_rust_gen",
21    ],
22    edition: "2018",
23    proc_macros: ["libnum_derive"],
24    rustlibs: [
25        "libbytes",
26        "libnum_bigint",
27        "libnum_integer",
28        "libnum_traits",
29        "libpdl_runtime",
30        "libpin_utils",
31        "librand",
32        "libthiserror",
33    ],
34    export_include_dirs: ["include"],
35}
36
37genrule {
38    name: "rootcanal_lmp_packets_rust_gen",
39    defaults: ["pdl_rust_legacy_generator_defaults"],
40    srcs: ["lmp_packets.pdl"],
41    out: ["lmp_packets.rs"],
42}
43
44genrule {
45    name: "rootcanal_llcp_packets_rust_gen",
46    defaults: ["pdl_rust_legacy_generator_defaults"],
47    srcs: ["llcp_packets.pdl"],
48    out: ["llcp_packets.rs"],
49}
50
51rust_test_host {
52    name: "rootcanal_rs_test",
53    crate_name: "rootcanal_rs",
54    srcs: [
55        "src/lib.rs",
56
57        ":rootcanal_hci_packets_rust_gen",
58        ":rootcanal_llcp_packets_rust_gen",
59        ":rootcanal_lmp_packets_rust_gen",
60    ],
61    auto_gen_config: true,
62    edition: "2018",
63    proc_macros: [
64        "libnum_derive",
65        "libpaste",
66    ],
67    rustlibs: [
68        "libbytes",
69        "libnum_bigint",
70        "libnum_integer",
71        "libnum_traits",
72        "libpdl_runtime",
73        "libpin_utils",
74        "librand",
75        "libthiserror",
76    ],
77}
78