blob: 4545d7bb2e3db14273244dc09429ce0c817638ed [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",
19 "libnix",
Stephen Crane994a0f02020-08-11 14:47:29 -070020 ],
21 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080022 vendor_available: true,
Devin Moore3d5ca6b2023-02-17 02:10:50 +000023 product_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",
Nikita Putikhinea8bac22024-05-28 12:36:56 +020031 "//apex_available:anyapex",
Jiyong Parkb1af7832021-02-16 13:30:57 +090032 ],
Roshan Piusbf42e372022-01-20 18:55:59 +000033 min_sdk_version: "Tiramisu",
Stephen Crane994a0f02020-08-11 14:47:29 -070034}
35
36rust_library {
Andrei Homescu6dfa8c92024-03-29 04:58:32 +000037 name: "libbinder_rs_on_trusty_mock",
38 crate_name: "binder",
39 srcs: ["src/lib.rs"],
40 cfgs: [
41 "trusty",
42 ],
43 rustlibs: [
44 "libbinder_ndk_sys_on_trusty_mock",
45 "libdowncast_rs",
46 "liblibc",
47 ],
48 vendor: true,
49}
50
51rust_library {
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000052 name: "libbinder_tokio_rs",
53 crate_name: "binder_tokio",
54 srcs: ["binder_tokio/lib.rs"],
55 rustlibs: [
56 "libbinder_rs",
57 "libtokio",
58 ],
59 host_supported: true,
Matthew Maurer88e713a2022-01-14 22:15:38 +000060 vendor_available: true,
Nikita Putikhind0578482024-05-06 15:15:33 +020061 product_available: true,
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000062 target: {
63 darwin: {
64 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000065 },
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000066 },
67 apex_available: [
68 "//apex_available:platform",
Nikita Putikhinea8bac22024-05-28 12:36:56 +020069 "//apex_available:anyapex",
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000070 ],
Matthew Maurer88e713a2022-01-14 22:15:38 +000071 min_sdk_version: "Tiramisu",
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000072}
73
74rust_library {
Stephen Crane994a0f02020-08-11 14:47:29 -070075 name: "libbinder_ndk_sys",
76 crate_name: "binder_ndk_sys",
77 srcs: [
78 "sys/lib.rs",
79 ":libbinder_ndk_bindgen",
80 ],
81 shared_libs: [
82 "libbinder_ndk",
Stephen Crane2a3c2502020-06-16 17:48:35 -070083 ],
Devin Moorebbd71b12024-08-09 23:20:03 +000084 rustlibs: [
85 "liblibc",
86 ],
Stephen Crane2a3c2502020-06-16 17:48:35 -070087 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080088 vendor_available: true,
Devin Moore3d5ca6b2023-02-17 02:10:50 +000089 product_available: true,
Yifan Hongf856a982020-10-30 14:51:17 -070090 target: {
91 darwin: {
92 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000093 },
Jiyong Parkb1af7832021-02-16 13:30:57 +090094 },
95 apex_available: [
96 "//apex_available:platform",
Nikita Putikhinea8bac22024-05-28 12:36:56 +020097 "//apex_available:anyapex",
Jiyong Parkb1af7832021-02-16 13:30:57 +090098 ],
Roshan Piusbf42e372022-01-20 18:55:59 +000099 min_sdk_version: "Tiramisu",
ThiƩbaud Weksteen3160ce92021-04-29 20:54:39 +0200100 lints: "none",
101 clippy_lints: "none",
Steven Moreland42548a02022-10-24 19:57:03 +0000102 visibility: [":__subpackages__"],
Stephen Crane2a3c2502020-06-16 17:48:35 -0700103}
104
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000105rust_library {
106 name: "libbinder_ndk_sys_on_trusty_mock",
107 crate_name: "binder_ndk_sys",
108 srcs: [
109 "sys/lib.rs",
110 ":libbinder_ndk_bindgen_on_trusty_mock",
111 ],
112 cfgs: [
113 "trusty",
114 ],
115 shared_libs: [
116 "libbinder_ndk_on_trusty_mock",
117 ],
118 vendor: true,
119 // Lints are checked separately for libbinder_ndk_sys.
120 // The Trusty mock copy pulls in extra headers that
121 // don't pass the lints for the bindgen output.
122 lints: "none",
123}
124
Stephen Crane2a3c2502020-06-16 17:48:35 -0700125rust_bindgen {
126 name: "libbinder_ndk_bindgen",
127 crate_name: "binder_ndk_bindgen",
Ivan Lozano7929c082020-09-23 13:33:42 -0400128 wrapper_src: "sys/BinderBindings.hpp",
Stephen Crane994a0f02020-08-11 14:47:29 -0700129 source_stem: "bindings",
Andrei Homescuabf991c2023-07-07 05:10:43 +0000130 bindgen_flag_files: [
Stephen Crane2a3c2502020-06-16 17:48:35 -0700131 // Unfortunately the only way to specify the rust_non_exhaustive enum
132 // style for a type is to make it the default
Stephen Crane2a3c2502020-06-16 17:48:35 -0700133 // and then specify constified enums for the enums we don't want
134 // rustified
Andrei Homescuabf991c2023-07-07 05:10:43 +0000135 "libbinder_ndk_bindgen_flags.txt",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700136 ],
Devin Moorebbd71b12024-08-09 23:20:03 +0000137 bindgen_flags: [
138 "--blocklist-type",
139 "sockaddr",
140 "--raw-line",
141 "use libc::sockaddr;",
142 ],
Stephen Crane2a3c2502020-06-16 17:48:35 -0700143 shared_libs: [
144 "libbinder_ndk",
145 ],
Devin Moorebbd71b12024-08-09 23:20:03 +0000146 rustlibs: [
147 "liblibc",
148 ],
Stephen Crane2a3c2502020-06-16 17:48:35 -0700149 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -0800150 vendor_available: true,
Devin Moore3d5ca6b2023-02-17 02:10:50 +0000151 product_available: true,
Stephen Crane2a3c2502020-06-16 17:48:35 -0700152
153 // Currently necessary for host builds
154 // TODO(b/31559095): bionic on host should define this
155 target: {
Yifan Hongf856a982020-10-30 14:51:17 -0700156 darwin: {
157 enabled: false,
158 },
Stephen Crane2a3c2502020-06-16 17:48:35 -0700159 },
Jiyong Parkb1af7832021-02-16 13:30:57 +0900160 apex_available: [
161 "//apex_available:platform",
Nikita Putikhinea8bac22024-05-28 12:36:56 +0200162 "//apex_available:anyapex",
Jiyong Parkb1af7832021-02-16 13:30:57 +0900163 ],
Roshan Piusbf42e372022-01-20 18:55:59 +0000164 min_sdk_version: "Tiramisu",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700165}
166
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000167rust_bindgen {
168 name: "libbinder_ndk_bindgen_on_trusty_mock",
169 crate_name: "binder_ndk_bindgen",
170 wrapper_src: "sys/BinderBindings.hpp",
171 source_stem: "bindings",
172 defaults: [
173 "trusty_mock_defaults",
174 ],
175
176 bindgen_flag_files: [
177 // Unfortunately the only way to specify the rust_non_exhaustive enum
178 // style for a type is to make it the default
179 // and then specify constified enums for the enums we don't want
180 // rustified
181 "libbinder_ndk_bindgen_flags.txt",
182 ],
183 shared_libs: [
184 "libbinder_ndk_on_trusty_mock",
185 "libc++",
186 ],
187}
188
Stephen Crane2a3c2502020-06-16 17:48:35 -0700189rust_test {
190 name: "libbinder_rs-internal_test",
191 crate_name: "binder",
192 srcs: ["src/lib.rs"],
193 test_suites: ["general-tests"],
194 auto_gen_config: true,
195 shared_libs: [
196 "libbinder_ndk",
197 ],
198 rustlibs: [
Stephen Crane994a0f02020-08-11 14:47:29 -0700199 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +0000200 "libdowncast_rs",
Andrew Walbran7b0be1f2022-08-04 16:47:46 +0000201 "liblibc",
Devin Moorebbd71b12024-08-09 23:20:03 +0000202 "liblog_rust",
203 "libnix",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700204 ],
205}
Joel Galenson52c44da2021-08-23 09:19:35 -0700206
207rust_test {
208 name: "libbinder_ndk_bindgen_test",
209 srcs: [":libbinder_ndk_bindgen"],
210 crate_name: "binder_ndk_bindgen",
211 test_suites: ["general-tests"],
212 auto_gen_config: true,
213 clippy_lints: "none",
214 lints: "none",
Devin Moorebbd71b12024-08-09 23:20:03 +0000215 rustlibs: [
216 "liblibc",
217 ],
Joel Galenson52c44da2021-08-23 09:19:35 -0700218}