blob: d36ebac1098e15b7be1907c92ef064aff3dd3c6d [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 "liblibc",
Stephen Crane994a0f02020-08-11 14:47:29 -070021 ],
22 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080023 vendor_available: true,
Devin Moore3d5ca6b2023-02-17 02:10:50 +000024 product_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",
Vikram Gaur38a4b0f2022-09-16 01:44:10 +000033 "com.android.rkpd",
ziyiwfe1cc952021-12-03 00:07:58 +000034 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +090035 "com.android.virt",
36 ],
Roshan Piusbf42e372022-01-20 18:55:59 +000037 min_sdk_version: "Tiramisu",
Stephen Crane994a0f02020-08-11 14:47:29 -070038}
39
40rust_library {
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000041 name: "libbinder_tokio_rs",
42 crate_name: "binder_tokio",
43 srcs: ["binder_tokio/lib.rs"],
44 rustlibs: [
45 "libbinder_rs",
46 "libtokio",
47 ],
48 host_supported: true,
Matthew Maurer88e713a2022-01-14 22:15:38 +000049 vendor_available: true,
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000050 target: {
51 darwin: {
52 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000053 },
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000054 },
55 apex_available: [
56 "//apex_available:platform",
57 "com.android.compos",
Matthew Maurer88e713a2022-01-14 22:15:38 +000058 "com.android.uwb",
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000059 "com.android.virt",
60 ],
Matthew Maurer88e713a2022-01-14 22:15:38 +000061 min_sdk_version: "Tiramisu",
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000062}
63
64rust_library {
Stephen Crane994a0f02020-08-11 14:47:29 -070065 name: "libbinder_ndk_sys",
66 crate_name: "binder_ndk_sys",
67 srcs: [
68 "sys/lib.rs",
69 ":libbinder_ndk_bindgen",
70 ],
71 shared_libs: [
72 "libbinder_ndk",
Stephen Crane2a3c2502020-06-16 17:48:35 -070073 ],
74 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080075 vendor_available: true,
Devin Moore3d5ca6b2023-02-17 02:10:50 +000076 product_available: true,
Yifan Hongf856a982020-10-30 14:51:17 -070077 target: {
78 darwin: {
79 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000080 },
Jiyong Parkb1af7832021-02-16 13:30:57 +090081 },
82 apex_available: [
83 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -070084 "com.android.compos",
Vikram Gaur38a4b0f2022-09-16 01:44:10 +000085 "com.android.rkpd",
ziyiwfe1cc952021-12-03 00:07:58 +000086 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +090087 "com.android.virt",
88 ],
Roshan Piusbf42e372022-01-20 18:55:59 +000089 min_sdk_version: "Tiramisu",
ThiƩbaud Weksteen3160ce92021-04-29 20:54:39 +020090 lints: "none",
91 clippy_lints: "none",
Steven Moreland42548a02022-10-24 19:57:03 +000092 visibility: [":__subpackages__"],
Stephen Crane2a3c2502020-06-16 17:48:35 -070093}
94
95rust_bindgen {
96 name: "libbinder_ndk_bindgen",
97 crate_name: "binder_ndk_bindgen",
Ivan Lozano7929c082020-09-23 13:33:42 -040098 wrapper_src: "sys/BinderBindings.hpp",
Stephen Crane994a0f02020-08-11 14:47:29 -070099 source_stem: "bindings",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700100 bindgen_flags: [
101 // Unfortunately the only way to specify the rust_non_exhaustive enum
102 // style for a type is to make it the default
ziyiwfe1cc952021-12-03 00:07:58 +0000103 "--default-enum-style",
104 "rust_non_exhaustive",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700105 // and then specify constified enums for the enums we don't want
106 // rustified
ziyiwfe1cc952021-12-03 00:07:58 +0000107 "--constified-enum",
108 "android::c_interface::consts::.*",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700109
ziyiwfe1cc952021-12-03 00:07:58 +0000110 "--allowlist-type",
111 "android::c_interface::.*",
112 "--allowlist-type",
113 "AStatus",
114 "--allowlist-type",
115 "AIBinder_Class",
116 "--allowlist-type",
117 "AIBinder",
118 "--allowlist-type",
119 "AIBinder_Weak",
120 "--allowlist-type",
121 "AIBinder_DeathRecipient",
122 "--allowlist-type",
123 "AParcel",
124 "--allowlist-type",
125 "binder_status_t",
126 "--allowlist-function",
127 ".*",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700128 ],
129 shared_libs: [
130 "libbinder_ndk",
131 ],
132 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -0800133 vendor_available: true,
Devin Moore3d5ca6b2023-02-17 02:10:50 +0000134 product_available: true,
Stephen Crane2a3c2502020-06-16 17:48:35 -0700135
136 // Currently necessary for host builds
137 // TODO(b/31559095): bionic on host should define this
138 target: {
Yifan Hongf856a982020-10-30 14:51:17 -0700139 darwin: {
140 enabled: false,
141 },
Stephen Crane2a3c2502020-06-16 17:48:35 -0700142 },
Jiyong Parkb1af7832021-02-16 13:30:57 +0900143 apex_available: [
144 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -0700145 "com.android.compos",
Vikram Gaur38a4b0f2022-09-16 01:44:10 +0000146 "com.android.rkpd",
ziyiwfe1cc952021-12-03 00:07:58 +0000147 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +0900148 "com.android.virt",
149 ],
Roshan Piusbf42e372022-01-20 18:55:59 +0000150 min_sdk_version: "Tiramisu",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700151}
152
153rust_test {
154 name: "libbinder_rs-internal_test",
155 crate_name: "binder",
156 srcs: ["src/lib.rs"],
157 test_suites: ["general-tests"],
158 auto_gen_config: true,
159 shared_libs: [
160 "libbinder_ndk",
161 ],
162 rustlibs: [
Stephen Crane994a0f02020-08-11 14:47:29 -0700163 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +0000164 "libdowncast_rs",
Andrew Walbran7b0be1f2022-08-04 16:47:46 +0000165 "liblibc",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700166 ],
167}
Joel Galenson52c44da2021-08-23 09:19:35 -0700168
169rust_test {
170 name: "libbinder_ndk_bindgen_test",
171 srcs: [":libbinder_ndk_bindgen"],
172 crate_name: "binder_ndk_bindgen",
173 test_suites: ["general-tests"],
174 auto_gen_config: true,
175 clippy_lints: "none",
176 lints: "none",
177}