summaryrefslogtreecommitdiff
path: root/system/gd/rust/stack/Android.bp
blob: 37d71369fa1ff575770b96ada7d4e0f27d8d4ead (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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_library {
    name: "libbluetooth_rs",
    defaults: ["gd_rust_defaults"],
    crate_name: "bluetooth_rs",
    srcs: ["src/lib.rs"],
    edition: "2018",
    rustlibs: [
        "libbt_facade_proto",
        "libbt_packets",
        "libbytes",
        "libfutures",
        "libthiserror",
        "libgrpcio",
        "libtokio",
        "libtokio_stream",
        "libprotobuf",
        "libbt_packets",
        "libgddi",
        "libcxx",
        "liblazy_static",
        "liblog_rust",
        "libbt_common",
        "libnum_traits",
        "libbt_facade_helpers",
    ],
    proc_macros: [
        "libnum_derive",
    ],
    apex_available: [
        "com.android.bluetooth",
    ],
    min_sdk_version: "30",
    target: {
        android: {
            whole_static_libs: ["libbt_hidl_hal_cxx"],
            shared_libs: [
                "android.hardware.bluetooth@1.0",
                "android.hardware.bluetooth@1.1",
                "libhidlbase",
                "libutils",
            ],
        },
    },
}

rust_test_host {
    name: "libbluetooth_rs_test",
    defaults: [
        "gd_rust_defaults",
        "mts_defaults",
    ],
    srcs: ["src/lib.rs"],
    test_suites: ["general-tests"],
    edition: "2018",
    rustlibs: [
        "libbt_facade_proto",
        "libbt_packets",
        "libbluetooth_rs",
        "libbytes",
        "libfutures",
        "libthiserror",
        "libgrpcio",
        "libtokio",
        "libtokio_stream",
        "libprotobuf",
        "libgddi",
        "libcxx",
        "liblazy_static",
        "liblog_rust",
        "libbt_common",
        "libnum_traits",
        "libbt_facade_helpers",
    ],
    proc_macros: [
        "libnum_derive",
    ],
}

genrule {
    name: "libbt_hidl_hal_bridge_header",
    tools: ["cxxbridge"],
    cmd: "$(location cxxbridge) $(in) --header > $(out)",
    srcs: ["src/hal/hidl_hal.rs"],
    out: ["src/hal/hidl_hal.rs.h"],
}

genrule {
    name: "libbt_hidl_hal_bridge_code",
    tools: ["cxxbridge"],
    cmd: "$(location cxxbridge) $(in) >> $(out)",
    srcs: ["src/hal/hidl_hal.rs"],
    out: ["hidl_hal_generated.cc"],
}

cc_library_static {
    name: "libbt_hidl_hal_cxx",
    defaults: ["gd_ffi_defaults"],
    srcs: ["src/hal/ffi/hidl.cc"],
    local_include_dirs: ["src/hal/ffi"],
    include_dirs: ["packages/modules/Bluetooth/system"],
    generated_headers: ["libbt_hidl_hal_bridge_header", "cxx-bridge-header"],
    generated_sources: ["libbt_hidl_hal_bridge_code"],
    shared_libs: [
        "android.hardware.bluetooth@1.0",
        "android.hardware.bluetooth@1.1",
        "libhidlbase",
        "libutils",
    ],
    apex_available: [
        "com.android.bluetooth",
    ],
    min_sdk_version: "30",
}