summaryrefslogtreecommitdiff
path: root/tools/rootcanal/rust/Android.bp
blob: 66a8e0877ed0727d91a227cdc5fe68044b47e64e (plain)
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
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_ffi {
    name: "librootcanal_rs",
    host_supported: true,
    vendor_available: true,
    crate_name: "rootcanal_rs",
    srcs: [
        "src/lib.rs",

        ":rootcanal_hci_packets_rust_gen",
        ":rootcanal_llcp_packets_rust_gen",
        ":rootcanal_lmp_packets_rust_gen",
    ],
    edition: "2018",
    proc_macros: ["libnum_derive"],
    rustlibs: [
        "libbytes",
        "libnum_bigint",
        "libnum_integer",
        "libnum_traits",
        "libpdl_runtime",
        "libpin_utils",
        "librand",
        "libthiserror",
    ],
    export_include_dirs: ["include"],
}

genrule {
    name: "rootcanal_lmp_packets_rust_gen",
    defaults: ["pdl_rust_legacy_generator_defaults"],
    srcs: ["lmp_packets.pdl"],
    out: ["lmp_packets.rs"],
}

genrule {
    name: "rootcanal_llcp_packets_rust_gen",
    defaults: ["pdl_rust_legacy_generator_defaults"],
    srcs: ["llcp_packets.pdl"],
    out: ["llcp_packets.rs"],
}

rust_test_host {
    name: "rootcanal_rs_test",
    crate_name: "rootcanal_rs",
    srcs: [
        "src/lib.rs",

        ":rootcanal_hci_packets_rust_gen",
        ":rootcanal_llcp_packets_rust_gen",
        ":rootcanal_lmp_packets_rust_gen",
    ],
    auto_gen_config: true,
    edition: "2018",
    proc_macros: [
        "libnum_derive",
        "libpaste",
    ],
    rustlibs: [
        "libbytes",
        "libnum_bigint",
        "libnum_integer",
        "libnum_traits",
        "libpdl_runtime",
        "libpin_utils",
        "librand",
        "libthiserror",
    ],
}