blob: 8404a48c26bc4ba46e17ccb521a6e5f26bc9be9d [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"],
Stephen Crane2a3c2502020-06-16 17:48:35 -070014 rustlibs: [
Stephen Crane994a0f02020-08-11 14:47:29 -070015 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +000016 "libdowncast_rs",
Andrew Walbran7b0be1f2022-08-04 16:47:46 +000017 "liblibc",
Devin Moorebbd71b12024-08-09 23:20:03 +000018 "liblog_rust",
Stephen Crane994a0f02020-08-11 14:47:29 -070019 ],
20 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080021 vendor_available: true,
Devin Moore3d5ca6b2023-02-17 02:10:50 +000022 product_available: true,
Yifan Hongf856a982020-10-30 14:51:17 -070023 target: {
24 darwin: {
25 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000026 },
Jiyong Parkb1af7832021-02-16 13:30:57 +090027 },
28 apex_available: [
29 "//apex_available:platform",
Nikita Putikhinea8bac22024-05-28 12:36:56 +020030 "//apex_available:anyapex",
Jiyong Parkb1af7832021-02-16 13:30:57 +090031 ],
Roshan Piusbf42e372022-01-20 18:55:59 +000032 min_sdk_version: "Tiramisu",
Stephen Crane994a0f02020-08-11 14:47:29 -070033}
34
35rust_library {
Andrei Homescu6dfa8c92024-03-29 04:58:32 +000036 name: "libbinder_rs_on_trusty_mock",
37 crate_name: "binder",
38 srcs: ["src/lib.rs"],
39 cfgs: [
40 "trusty",
41 ],
42 rustlibs: [
43 "libbinder_ndk_sys_on_trusty_mock",
44 "libdowncast_rs",
45 "liblibc",
46 ],
47 vendor: true,
48}
49
50rust_library {
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000051 name: "libbinder_tokio_rs",
52 crate_name: "binder_tokio",
53 srcs: ["binder_tokio/lib.rs"],
54 rustlibs: [
55 "libbinder_rs",
56 "libtokio",
57 ],
58 host_supported: true,
Matthew Maurer88e713a2022-01-14 22:15:38 +000059 vendor_available: true,
Nikita Putikhind0578482024-05-06 15:15:33 +020060 product_available: true,
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000061 target: {
62 darwin: {
63 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000064 },
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000065 },
66 apex_available: [
67 "//apex_available:platform",
Nikita Putikhinea8bac22024-05-28 12:36:56 +020068 "//apex_available:anyapex",
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000069 ],
Matthew Maurer88e713a2022-01-14 22:15:38 +000070 min_sdk_version: "Tiramisu",
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000071}
72
73rust_library {
Stephen Crane994a0f02020-08-11 14:47:29 -070074 name: "libbinder_ndk_sys",
75 crate_name: "binder_ndk_sys",
76 srcs: [
77 "sys/lib.rs",
78 ":libbinder_ndk_bindgen",
79 ],
80 shared_libs: [
81 "libbinder_ndk",
Stephen Crane2a3c2502020-06-16 17:48:35 -070082 ],
Devin Moorebbd71b12024-08-09 23:20:03 +000083 rustlibs: [
84 "liblibc",
85 ],
Stephen Crane2a3c2502020-06-16 17:48:35 -070086 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080087 vendor_available: true,
Devin Moore3d5ca6b2023-02-17 02:10:50 +000088 product_available: true,
Yifan Hongf856a982020-10-30 14:51:17 -070089 target: {
90 darwin: {
91 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000092 },
Jiyong Parkb1af7832021-02-16 13:30:57 +090093 },
94 apex_available: [
95 "//apex_available:platform",
Nikita Putikhinea8bac22024-05-28 12:36:56 +020096 "//apex_available:anyapex",
Jiyong Parkb1af7832021-02-16 13:30:57 +090097 ],
Roshan Piusbf42e372022-01-20 18:55:59 +000098 min_sdk_version: "Tiramisu",
ThiƩbaud Weksteen3160ce92021-04-29 20:54:39 +020099 lints: "none",
100 clippy_lints: "none",
Steven Moreland42548a02022-10-24 19:57:03 +0000101 visibility: [":__subpackages__"],
Stephen Crane2a3c2502020-06-16 17:48:35 -0700102}
103
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000104rust_library {
105 name: "libbinder_ndk_sys_on_trusty_mock",
106 crate_name: "binder_ndk_sys",
107 srcs: [
108 "sys/lib.rs",
109 ":libbinder_ndk_bindgen_on_trusty_mock",
110 ],
111 cfgs: [
112 "trusty",
113 ],
114 shared_libs: [
115 "libbinder_ndk_on_trusty_mock",
116 ],
117 vendor: true,
118 // Lints are checked separately for libbinder_ndk_sys.
119 // The Trusty mock copy pulls in extra headers that
120 // don't pass the lints for the bindgen output.
121 lints: "none",
122}
123
Stephen Crane2a3c2502020-06-16 17:48:35 -0700124rust_bindgen {
125 name: "libbinder_ndk_bindgen",
126 crate_name: "binder_ndk_bindgen",
Ivan Lozano7929c082020-09-23 13:33:42 -0400127 wrapper_src: "sys/BinderBindings.hpp",
Stephen Crane994a0f02020-08-11 14:47:29 -0700128 source_stem: "bindings",
Andrei Homescuabf991c2023-07-07 05:10:43 +0000129 bindgen_flag_files: [
Stephen Crane2a3c2502020-06-16 17:48:35 -0700130 // Unfortunately the only way to specify the rust_non_exhaustive enum
131 // style for a type is to make it the default
Stephen Crane2a3c2502020-06-16 17:48:35 -0700132 // and then specify constified enums for the enums we don't want
133 // rustified
Andrei Homescuabf991c2023-07-07 05:10:43 +0000134 "libbinder_ndk_bindgen_flags.txt",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700135 ],
Devin Moorebbd71b12024-08-09 23:20:03 +0000136 bindgen_flags: [
137 "--blocklist-type",
138 "sockaddr",
139 "--raw-line",
140 "use libc::sockaddr;",
141 ],
Matthew Maurercf0037d2024-10-09 21:38:29 +0000142 cflags: [
143 "-DANDROID_PLATFORM",
144 ],
Stephen Crane2a3c2502020-06-16 17:48:35 -0700145 shared_libs: [
146 "libbinder_ndk",
147 ],
Devin Moorebbd71b12024-08-09 23:20:03 +0000148 rustlibs: [
149 "liblibc",
150 ],
Stephen Crane2a3c2502020-06-16 17:48:35 -0700151 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -0800152 vendor_available: true,
Devin Moore3d5ca6b2023-02-17 02:10:50 +0000153 product_available: true,
Stephen Crane2a3c2502020-06-16 17:48:35 -0700154
155 // Currently necessary for host builds
156 // TODO(b/31559095): bionic on host should define this
157 target: {
Yifan Hongf856a982020-10-30 14:51:17 -0700158 darwin: {
159 enabled: false,
160 },
Stephen Crane2a3c2502020-06-16 17:48:35 -0700161 },
Jiyong Parkb1af7832021-02-16 13:30:57 +0900162 apex_available: [
163 "//apex_available:platform",
Nikita Putikhinea8bac22024-05-28 12:36:56 +0200164 "//apex_available:anyapex",
Jiyong Parkb1af7832021-02-16 13:30:57 +0900165 ],
Roshan Piusbf42e372022-01-20 18:55:59 +0000166 min_sdk_version: "Tiramisu",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700167}
168
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000169rust_bindgen {
170 name: "libbinder_ndk_bindgen_on_trusty_mock",
171 crate_name: "binder_ndk_bindgen",
172 wrapper_src: "sys/BinderBindings.hpp",
173 source_stem: "bindings",
174 defaults: [
175 "trusty_mock_defaults",
176 ],
177
178 bindgen_flag_files: [
179 // Unfortunately the only way to specify the rust_non_exhaustive enum
180 // style for a type is to make it the default
181 // and then specify constified enums for the enums we don't want
182 // rustified
183 "libbinder_ndk_bindgen_flags.txt",
184 ],
Matthew Maurercf0037d2024-10-09 21:38:29 +0000185 cflags: [
186 "-DANDROID_PLATFORM",
187 ],
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000188 shared_libs: [
189 "libbinder_ndk_on_trusty_mock",
190 "libc++",
191 ],
192}
193
Stephen Crane2a3c2502020-06-16 17:48:35 -0700194rust_test {
195 name: "libbinder_rs-internal_test",
196 crate_name: "binder",
197 srcs: ["src/lib.rs"],
198 test_suites: ["general-tests"],
199 auto_gen_config: true,
200 shared_libs: [
201 "libbinder_ndk",
202 ],
203 rustlibs: [
Stephen Crane994a0f02020-08-11 14:47:29 -0700204 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +0000205 "libdowncast_rs",
Andrew Walbran7b0be1f2022-08-04 16:47:46 +0000206 "liblibc",
Devin Moorebbd71b12024-08-09 23:20:03 +0000207 "liblog_rust",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700208 ],
209}
Joel Galenson52c44da2021-08-23 09:19:35 -0700210
211rust_test {
212 name: "libbinder_ndk_bindgen_test",
213 srcs: [":libbinder_ndk_bindgen"],
214 crate_name: "binder_ndk_bindgen",
215 test_suites: ["general-tests"],
216 auto_gen_config: true,
217 clippy_lints: "none",
218 lints: "none",
Devin Moorebbd71b12024-08-09 23:20:03 +0000219 rustlibs: [
220 "liblibc",
221 ],
Joel Galenson52c44da2021-08-23 09:19:35 -0700222}