summaryrefslogtreecommitdiff
path: root/libs/binder/rust/rpcbinder/Android.bp
blob: 2e463451f9f5241f87a86289f7eb6702ba0064cc (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
package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "frameworks_native_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["frameworks_native_license"],
}

rust_library {
    name: "librpcbinder_rs",
    crate_name: "rpcbinder",
    srcs: ["src/lib.rs"],
    shared_libs: [
        "libutils",
    ],
    rustlibs: [
        "libbinder_ndk_sys",
        "libbinder_rpc_unstable_bindgen_sys",
        "libbinder_rs",
        "libcfg_if",
        "libdowncast_rs",
        "libforeign_types",
        "liblibc",
        "liblog_rust",
    ],
    visibility: [
        "//device/google/cuttlefish/shared/minidroid/sample",
        "//packages/modules/Virtualization:__subpackages__",
        "//system/software_defined_vehicle:__subpackages__",
    ],
    apex_available: [
        "//apex_available:platform",
        "com.android.compos",
        "com.android.uwb",
        "com.android.virt",
    ],
    min_sdk_version: "Tiramisu",
}

// Build a separate rust_library rather than depending directly on libbinder_rpc_unstable_bindgen,
// to work around the fact that rust_bindgen targets only produce rlibs and not dylibs, which would
// result in duplicate conflicting versions of libbinder_ndk_sys. This will hopefully be fixed in
// the build system, at which point we can delete this target and go back to using
// libbinder_rpc_unstable_bindgen directly.
rust_library {
    name: "libbinder_rpc_unstable_bindgen_sys",
    crate_name: "binder_rpc_unstable_bindgen",
    srcs: [
        ":libbinder_rpc_unstable_bindgen",
    ],
    visibility: [":__subpackages__"],
    rustlibs: [
        "libbinder_ndk_sys",
    ],
    shared_libs: [
        "libbinder_rpc_unstable",
        "libutils",
    ],
    apex_available: [
        "//apex_available:platform",
        "com.android.compos",
        "com.android.uwb",
        "com.android.virt",
    ],
    min_sdk_version: "Tiramisu",
    lints: "none",
    clippy_lints: "none",
}

// TODO(b/184872979): remove once the RPC Binder API is stabilised.
rust_bindgen {
    name: "libbinder_rpc_unstable_bindgen",
    wrapper_src: "BinderBindings.hpp",
    crate_name: "binder_rpc_unstable_bindgen",
    visibility: [":__subpackages__"],
    source_stem: "bindings",
    bindgen_flags: [
        "--blocklist-type",
        "AIBinder",
        "--raw-line",
        "use binder_ndk_sys::AIBinder;",
        "--rustified-enum",
        "ARpcSession_FileDescriptorTransportMode",
    ],
    rustlibs: [
        "libbinder_ndk_sys",
    ],
    shared_libs: [
        "libbinder_rpc_unstable",
        "libutils",
    ],
    apex_available: [
        "//apex_available:platform",
        "com.android.compos",
        "com.android.uwb",
        "com.android.virt",
    ],
    min_sdk_version: "Tiramisu",
}

rust_test {
    name: "libbinder_rpc_unstable_bindgen_test",
    srcs: [":libbinder_rpc_unstable_bindgen"],
    crate_name: "binder_rpc_unstable_bindgen",
    rustlibs: [
        "libbinder_ndk_sys",
    ],
    test_suites: ["general-tests"],
    auto_gen_config: true,
    clippy_lints: "none",
    lints: "none",
}