blob: 4036551ef32bc3b736c2b582901c218e080fc6d8 [file] [log] [blame]
Bob Badour9b844922022-08-25 09:28:56 -07001package {
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 "frameworks_native_license"
5 // to get the below license kinds:
6 // SPDX-license-identifier-Apache-2.0
7 default_applicable_licenses: ["frameworks_native_license"],
8}
9
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +000010rust_library {
11 name: "librpcbinder_rs",
12 crate_name: "rpcbinder",
13 srcs: ["src/lib.rs"],
14 shared_libs: [
15 "libutils",
16 ],
17 rustlibs: [
18 "libbinder_ndk_sys",
Andrew Walbran34e7bdf2022-08-24 11:16:24 +000019 "libbinder_rpc_unstable_bindgen_sys",
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +000020 "libbinder_rs",
Andrei Homescu2617c842023-08-08 02:52:23 +000021 "libcfg_if",
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +000022 "libdowncast_rs",
David Brazdilefb56832022-11-16 11:47:00 +000023 "libforeign_types",
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +000024 "liblibc",
Alice Wang893a9912022-10-24 10:44:09 +000025 "liblog_rust",
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +000026 ],
Marcin Radomski9fbb1f92023-01-20 11:38:04 +000027 visibility: [
28 "//device/google/cuttlefish/shared/minidroid/sample",
Marcin Radomski9fbb1f92023-01-20 11:38:04 +000029 "//packages/modules/Virtualization:__subpackages__",
30 ],
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +000031 apex_available: [
Marcin Radomski9fbb1f92023-01-20 11:38:04 +000032 "//apex_available:platform",
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +000033 "com.android.compos",
Aidan Wolter81139db2024-08-20 19:19:37 +000034 "com.android.microfuchsia",
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +000035 "com.android.uwb",
36 "com.android.virt",
37 ],
38 min_sdk_version: "Tiramisu",
39}
40
Andrew Walbran34e7bdf2022-08-24 11:16:24 +000041// Build a separate rust_library rather than depending directly on libbinder_rpc_unstable_bindgen,
42// to work around the fact that rust_bindgen targets only produce rlibs and not dylibs, which would
43// result in duplicate conflicting versions of libbinder_ndk_sys. This will hopefully be fixed in
44// the build system, at which point we can delete this target and go back to using
45// libbinder_rpc_unstable_bindgen directly.
46rust_library {
47 name: "libbinder_rpc_unstable_bindgen_sys",
48 crate_name: "binder_rpc_unstable_bindgen",
49 srcs: [
50 ":libbinder_rpc_unstable_bindgen",
51 ],
52 visibility: [":__subpackages__"],
53 rustlibs: [
54 "libbinder_ndk_sys",
55 ],
56 shared_libs: [
57 "libbinder_rpc_unstable",
58 "libutils",
59 ],
60 apex_available: [
Marcin Radomski9fbb1f92023-01-20 11:38:04 +000061 "//apex_available:platform",
Andrew Walbran34e7bdf2022-08-24 11:16:24 +000062 "com.android.compos",
Aidan Wolter81139db2024-08-20 19:19:37 +000063 "com.android.microfuchsia",
Andrew Walbran34e7bdf2022-08-24 11:16:24 +000064 "com.android.uwb",
65 "com.android.virt",
66 ],
67 min_sdk_version: "Tiramisu",
68 lints: "none",
69 clippy_lints: "none",
70}
71
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +000072// TODO(b/184872979): remove once the RPC Binder API is stabilised.
73rust_bindgen {
74 name: "libbinder_rpc_unstable_bindgen",
Matthew Maurer5fca42a2023-12-05 00:47:08 +000075 wrapper_src: "BinderBindings.hpp",
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +000076 crate_name: "binder_rpc_unstable_bindgen",
77 visibility: [":__subpackages__"],
78 source_stem: "bindings",
Andrew Walbran34e7bdf2022-08-24 11:16:24 +000079 bindgen_flags: [
80 "--blocklist-type",
81 "AIBinder",
82 "--raw-line",
83 "use binder_ndk_sys::AIBinder;",
David Brazdilae3ec6a2022-12-14 13:13:32 +000084 "--rustified-enum",
85 "ARpcSession_FileDescriptorTransportMode",
Andrew Walbran34e7bdf2022-08-24 11:16:24 +000086 ],
87 rustlibs: [
88 "libbinder_ndk_sys",
89 ],
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +000090 shared_libs: [
91 "libbinder_rpc_unstable",
92 "libutils",
93 ],
94 apex_available: [
Marcin Radomski9fbb1f92023-01-20 11:38:04 +000095 "//apex_available:platform",
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +000096 "com.android.compos",
Aidan Wolter81139db2024-08-20 19:19:37 +000097 "com.android.microfuchsia",
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +000098 "com.android.uwb",
99 "com.android.virt",
100 ],
101 min_sdk_version: "Tiramisu",
102}
103
104rust_test {
105 name: "libbinder_rpc_unstable_bindgen_test",
106 srcs: [":libbinder_rpc_unstable_bindgen"],
107 crate_name: "binder_rpc_unstable_bindgen",
Andrew Walbran34e7bdf2022-08-24 11:16:24 +0000108 rustlibs: [
109 "libbinder_ndk_sys",
110 ],
Andrew Walbranc4d1cbd2022-08-02 17:15:56 +0000111 test_suites: ["general-tests"],
112 auto_gen_config: true,
113 clippy_lints: "none",
114 lints: "none",
115}