blob: 355b3b4b8992f0bcaf37bcca53e911c5b15d238d [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: [
18 "liblibc",
Stephen Crane994a0f02020-08-11 14:47:29 -070019 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +000020 "libdowncast_rs",
Stephen Crane994a0f02020-08-11 14:47:29 -070021 ],
22 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080023 vendor_available: true,
Yifan Hongf856a982020-10-30 14:51:17 -070024 target: {
25 darwin: {
26 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000027 },
Jiyong Parkb1af7832021-02-16 13:30:57 +090028 },
29 apex_available: [
30 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -070031 "com.android.compos",
ziyiwfe1cc952021-12-03 00:07:58 +000032 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +090033 "com.android.virt",
34 ],
Roshan Piusbf42e372022-01-20 18:55:59 +000035 min_sdk_version: "Tiramisu",
Stephen Crane994a0f02020-08-11 14:47:29 -070036}
37
38rust_library {
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000039 name: "libbinder_tokio_rs",
40 crate_name: "binder_tokio",
41 srcs: ["binder_tokio/lib.rs"],
42 rustlibs: [
43 "libbinder_rs",
44 "libtokio",
45 ],
46 host_supported: true,
Matthew Maurer88e713a2022-01-14 22:15:38 +000047 vendor_available: true,
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000048 target: {
49 darwin: {
50 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000051 },
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000052 },
53 apex_available: [
54 "//apex_available:platform",
55 "com.android.compos",
Matthew Maurer88e713a2022-01-14 22:15:38 +000056 "com.android.uwb",
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000057 "com.android.virt",
58 ],
Matthew Maurer88e713a2022-01-14 22:15:38 +000059 min_sdk_version: "Tiramisu",
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000060}
61
62rust_library {
Stephen Crane994a0f02020-08-11 14:47:29 -070063 name: "libbinder_ndk_sys",
64 crate_name: "binder_ndk_sys",
65 srcs: [
66 "sys/lib.rs",
67 ":libbinder_ndk_bindgen",
68 ],
69 shared_libs: [
70 "libbinder_ndk",
Stephen Crane2a3c2502020-06-16 17:48:35 -070071 ],
72 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080073 vendor_available: true,
Yifan Hongf856a982020-10-30 14:51:17 -070074 target: {
75 darwin: {
76 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000077 },
Jiyong Parkb1af7832021-02-16 13:30:57 +090078 },
79 apex_available: [
80 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -070081 "com.android.compos",
ziyiwfe1cc952021-12-03 00:07:58 +000082 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +090083 "com.android.virt",
84 ],
Roshan Piusbf42e372022-01-20 18:55:59 +000085 min_sdk_version: "Tiramisu",
ThiƩbaud Weksteen3160ce92021-04-29 20:54:39 +020086 lints: "none",
87 clippy_lints: "none",
Stephen Crane2a3c2502020-06-16 17:48:35 -070088}
89
90rust_bindgen {
91 name: "libbinder_ndk_bindgen",
92 crate_name: "binder_ndk_bindgen",
Ivan Lozano7929c082020-09-23 13:33:42 -040093 wrapper_src: "sys/BinderBindings.hpp",
Stephen Crane994a0f02020-08-11 14:47:29 -070094 source_stem: "bindings",
Stephen Crane2a3c2502020-06-16 17:48:35 -070095 bindgen_flags: [
96 // Unfortunately the only way to specify the rust_non_exhaustive enum
97 // style for a type is to make it the default
ziyiwfe1cc952021-12-03 00:07:58 +000098 "--default-enum-style",
99 "rust_non_exhaustive",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700100 // and then specify constified enums for the enums we don't want
101 // rustified
ziyiwfe1cc952021-12-03 00:07:58 +0000102 "--constified-enum",
103 "android::c_interface::consts::.*",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700104
ziyiwfe1cc952021-12-03 00:07:58 +0000105 "--allowlist-type",
106 "android::c_interface::.*",
107 "--allowlist-type",
108 "AStatus",
109 "--allowlist-type",
110 "AIBinder_Class",
111 "--allowlist-type",
112 "AIBinder",
113 "--allowlist-type",
114 "AIBinder_Weak",
115 "--allowlist-type",
116 "AIBinder_DeathRecipient",
117 "--allowlist-type",
118 "AParcel",
119 "--allowlist-type",
120 "binder_status_t",
121 "--allowlist-function",
122 ".*",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700123 ],
124 shared_libs: [
125 "libbinder_ndk",
126 ],
127 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -0800128 vendor_available: true,
Stephen Crane2a3c2502020-06-16 17:48:35 -0700129
130 // Currently necessary for host builds
131 // TODO(b/31559095): bionic on host should define this
132 target: {
Yifan Hongf856a982020-10-30 14:51:17 -0700133 darwin: {
134 enabled: false,
135 },
Stephen Crane2a3c2502020-06-16 17:48:35 -0700136 },
Jiyong Parkb1af7832021-02-16 13:30:57 +0900137 apex_available: [
138 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -0700139 "com.android.compos",
ziyiwfe1cc952021-12-03 00:07:58 +0000140 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +0900141 "com.android.virt",
142 ],
Roshan Piusbf42e372022-01-20 18:55:59 +0000143 min_sdk_version: "Tiramisu",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700144}
145
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700146// TODO(b/184872979): remove once the Rust API is created.
147rust_bindgen {
148 name: "libbinder_rpc_unstable_bindgen",
Inseob Kim01befc82021-08-31 20:28:50 +0900149 wrapper_src: ":libbinder_rpc_unstable_header",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700150 crate_name: "binder_rpc_unstable_bindgen",
151 source_stem: "bindings",
152 shared_libs: [
153 "libutils",
154 ],
155 apex_available: [
156 "com.android.compos",
ziyiwfe1cc952021-12-03 00:07:58 +0000157 "com.android.uwb",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700158 "com.android.virt",
159 ],
Roshan Piusbf42e372022-01-20 18:55:59 +0000160 min_sdk_version: "Tiramisu",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700161}
162
Stephen Crane2a3c2502020-06-16 17:48:35 -0700163rust_test {
164 name: "libbinder_rs-internal_test",
165 crate_name: "binder",
166 srcs: ["src/lib.rs"],
167 test_suites: ["general-tests"],
168 auto_gen_config: true,
169 shared_libs: [
170 "libbinder_ndk",
171 ],
172 rustlibs: [
173 "liblibc",
Stephen Crane994a0f02020-08-11 14:47:29 -0700174 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +0000175 "libdowncast_rs",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700176 ],
177}
Joel Galenson52c44da2021-08-23 09:19:35 -0700178
179rust_test {
180 name: "libbinder_ndk_bindgen_test",
181 srcs: [":libbinder_ndk_bindgen"],
182 crate_name: "binder_ndk_bindgen",
183 test_suites: ["general-tests"],
184 auto_gen_config: true,
185 clippy_lints: "none",
186 lints: "none",
187}
188
189rust_test {
190 name: "libbinder_rpc_unstable_bindgen_test",
191 srcs: [":libbinder_rpc_unstable_bindgen"],
192 crate_name: "binder_rpc_unstable_bindgen",
193 test_suites: ["general-tests"],
194 auto_gen_config: true,
195 clippy_lints: "none",
196 lints: "none",
197}