blob: 6c819e1d2b898b347f7d6ab9629fe7e78a4b07c6 [file] [log] [blame]
Bob Badour3c538232021-02-12 21:26:48 -08001package {
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
Stephen Crane2a3c2502020-06-16 17:48:35 -070010rust_library {
11 name: "libbinder_rs",
12 crate_name: "binder",
13 srcs: ["src/lib.rs"],
14 shared_libs: [
Stephen Crane2a3c2502020-06-16 17:48:35 -070015 "libutils",
16 ],
17 rustlibs: [
Stephen Crane994a0f02020-08-11 14:47:29 -070018 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +000019 "libdowncast_rs",
Andrew Walbran7b0be1f2022-08-04 16:47:46 +000020 "liblazy_static",
21 "liblibc",
Stephen Crane994a0f02020-08-11 14:47:29 -070022 ],
23 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080024 vendor_available: true,
Yifan Hongf856a982020-10-30 14:51:17 -070025 target: {
26 darwin: {
27 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000028 },
Jiyong Parkb1af7832021-02-16 13:30:57 +090029 },
30 apex_available: [
31 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -070032 "com.android.compos",
ziyiwfe1cc952021-12-03 00:07:58 +000033 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +090034 "com.android.virt",
35 ],
Roshan Piusbf42e372022-01-20 18:55:59 +000036 min_sdk_version: "Tiramisu",
Stephen Crane994a0f02020-08-11 14:47:29 -070037}
38
39rust_library {
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000040 name: "libbinder_tokio_rs",
41 crate_name: "binder_tokio",
42 srcs: ["binder_tokio/lib.rs"],
43 rustlibs: [
44 "libbinder_rs",
45 "libtokio",
46 ],
47 host_supported: true,
Matthew Maurer88e713a2022-01-14 22:15:38 +000048 vendor_available: true,
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000049 target: {
50 darwin: {
51 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000052 },
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000053 },
54 apex_available: [
55 "//apex_available:platform",
56 "com.android.compos",
Matthew Maurer88e713a2022-01-14 22:15:38 +000057 "com.android.uwb",
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000058 "com.android.virt",
59 ],
Matthew Maurer88e713a2022-01-14 22:15:38 +000060 min_sdk_version: "Tiramisu",
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000061}
62
63rust_library {
Stephen Crane994a0f02020-08-11 14:47:29 -070064 name: "libbinder_ndk_sys",
65 crate_name: "binder_ndk_sys",
66 srcs: [
67 "sys/lib.rs",
68 ":libbinder_ndk_bindgen",
69 ],
70 shared_libs: [
71 "libbinder_ndk",
Stephen Crane2a3c2502020-06-16 17:48:35 -070072 ],
73 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080074 vendor_available: true,
Yifan Hongf856a982020-10-30 14:51:17 -070075 target: {
76 darwin: {
77 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000078 },
Jiyong Parkb1af7832021-02-16 13:30:57 +090079 },
80 apex_available: [
81 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -070082 "com.android.compos",
ziyiwfe1cc952021-12-03 00:07:58 +000083 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +090084 "com.android.virt",
85 ],
Roshan Piusbf42e372022-01-20 18:55:59 +000086 min_sdk_version: "Tiramisu",
ThiƩbaud Weksteen3160ce92021-04-29 20:54:39 +020087 lints: "none",
88 clippy_lints: "none",
Stephen Crane2a3c2502020-06-16 17:48:35 -070089}
90
91rust_bindgen {
92 name: "libbinder_ndk_bindgen",
93 crate_name: "binder_ndk_bindgen",
Ivan Lozano7929c082020-09-23 13:33:42 -040094 wrapper_src: "sys/BinderBindings.hpp",
Stephen Crane994a0f02020-08-11 14:47:29 -070095 source_stem: "bindings",
Stephen Crane2a3c2502020-06-16 17:48:35 -070096 bindgen_flags: [
97 // Unfortunately the only way to specify the rust_non_exhaustive enum
98 // style for a type is to make it the default
ziyiwfe1cc952021-12-03 00:07:58 +000099 "--default-enum-style",
100 "rust_non_exhaustive",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700101 // and then specify constified enums for the enums we don't want
102 // rustified
ziyiwfe1cc952021-12-03 00:07:58 +0000103 "--constified-enum",
104 "android::c_interface::consts::.*",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700105
ziyiwfe1cc952021-12-03 00:07:58 +0000106 "--allowlist-type",
107 "android::c_interface::.*",
108 "--allowlist-type",
109 "AStatus",
110 "--allowlist-type",
111 "AIBinder_Class",
112 "--allowlist-type",
113 "AIBinder",
114 "--allowlist-type",
115 "AIBinder_Weak",
116 "--allowlist-type",
117 "AIBinder_DeathRecipient",
118 "--allowlist-type",
119 "AParcel",
120 "--allowlist-type",
121 "binder_status_t",
122 "--allowlist-function",
123 ".*",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700124 ],
125 shared_libs: [
126 "libbinder_ndk",
127 ],
128 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -0800129 vendor_available: true,
Stephen Crane2a3c2502020-06-16 17:48:35 -0700130
131 // Currently necessary for host builds
132 // TODO(b/31559095): bionic on host should define this
133 target: {
Yifan Hongf856a982020-10-30 14:51:17 -0700134 darwin: {
135 enabled: false,
136 },
Stephen Crane2a3c2502020-06-16 17:48:35 -0700137 },
Jiyong Parkb1af7832021-02-16 13:30:57 +0900138 apex_available: [
139 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -0700140 "com.android.compos",
ziyiwfe1cc952021-12-03 00:07:58 +0000141 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +0900142 "com.android.virt",
143 ],
Roshan Piusbf42e372022-01-20 18:55:59 +0000144 min_sdk_version: "Tiramisu",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700145}
146
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700147// TODO(b/184872979): remove once the Rust API is created.
148rust_bindgen {
149 name: "libbinder_rpc_unstable_bindgen",
Inseob Kim01befc82021-08-31 20:28:50 +0900150 wrapper_src: ":libbinder_rpc_unstable_header",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700151 crate_name: "binder_rpc_unstable_bindgen",
152 source_stem: "bindings",
153 shared_libs: [
154 "libutils",
155 ],
156 apex_available: [
157 "com.android.compos",
ziyiwfe1cc952021-12-03 00:07:58 +0000158 "com.android.uwb",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700159 "com.android.virt",
160 ],
Roshan Piusbf42e372022-01-20 18:55:59 +0000161 min_sdk_version: "Tiramisu",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700162}
163
Stephen Crane2a3c2502020-06-16 17:48:35 -0700164rust_test {
165 name: "libbinder_rs-internal_test",
166 crate_name: "binder",
167 srcs: ["src/lib.rs"],
168 test_suites: ["general-tests"],
169 auto_gen_config: true,
170 shared_libs: [
171 "libbinder_ndk",
172 ],
173 rustlibs: [
Stephen Crane994a0f02020-08-11 14:47:29 -0700174 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +0000175 "libdowncast_rs",
Andrew Walbran7b0be1f2022-08-04 16:47:46 +0000176 "liblazy_static",
177 "liblibc",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700178 ],
179}
Joel Galenson52c44da2021-08-23 09:19:35 -0700180
181rust_test {
182 name: "libbinder_ndk_bindgen_test",
183 srcs: [":libbinder_ndk_bindgen"],
184 crate_name: "binder_ndk_bindgen",
185 test_suites: ["general-tests"],
186 auto_gen_config: true,
187 clippy_lints: "none",
188 lints: "none",
189}
190
191rust_test {
192 name: "libbinder_rpc_unstable_bindgen_test",
193 srcs: [":libbinder_rpc_unstable_bindgen"],
194 crate_name: "binder_rpc_unstable_bindgen",
195 test_suites: ["general-tests"],
196 auto_gen_config: true,
197 clippy_lints: "none",
198 lints: "none",
199}