blob: 725744cd70eedcdfe06b00bc9b96ef392e966e57 [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",
Stephen Crane994a0f02020-08-11 14:47:29 -070018 ],
19 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080020 vendor_available: true,
Devin Moore3d5ca6b2023-02-17 02:10:50 +000021 product_available: true,
Yifan Hongf856a982020-10-30 14:51:17 -070022 target: {
23 darwin: {
24 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000025 },
Jiyong Parkb1af7832021-02-16 13:30:57 +090026 },
27 apex_available: [
28 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -070029 "com.android.compos",
Vikram Gaur38a4b0f2022-09-16 01:44:10 +000030 "com.android.rkpd",
ziyiwfe1cc952021-12-03 00:07:58 +000031 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +090032 "com.android.virt",
33 ],
Roshan Piusbf42e372022-01-20 18:55:59 +000034 min_sdk_version: "Tiramisu",
Stephen Crane994a0f02020-08-11 14:47:29 -070035}
36
37rust_library {
Andrei Homescu6dfa8c92024-03-29 04:58:32 +000038 name: "libbinder_rs_on_trusty_mock",
39 crate_name: "binder",
40 srcs: ["src/lib.rs"],
41 cfgs: [
42 "trusty",
43 ],
44 rustlibs: [
45 "libbinder_ndk_sys_on_trusty_mock",
46 "libdowncast_rs",
47 "liblibc",
48 ],
49 vendor: true,
50}
51
52rust_library {
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000053 name: "libbinder_tokio_rs",
54 crate_name: "binder_tokio",
55 srcs: ["binder_tokio/lib.rs"],
56 rustlibs: [
57 "libbinder_rs",
58 "libtokio",
59 ],
60 host_supported: true,
Matthew Maurer88e713a2022-01-14 22:15:38 +000061 vendor_available: true,
Nikita Putikhind0578482024-05-06 15:15:33 +020062 product_available: true,
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000063 target: {
64 darwin: {
65 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000066 },
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000067 },
68 apex_available: [
69 "//apex_available:platform",
70 "com.android.compos",
Matthew Maurer88e713a2022-01-14 22:15:38 +000071 "com.android.uwb",
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000072 "com.android.virt",
73 ],
Matthew Maurer88e713a2022-01-14 22:15:38 +000074 min_sdk_version: "Tiramisu",
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000075}
76
77rust_library {
Stephen Crane994a0f02020-08-11 14:47:29 -070078 name: "libbinder_ndk_sys",
79 crate_name: "binder_ndk_sys",
80 srcs: [
81 "sys/lib.rs",
82 ":libbinder_ndk_bindgen",
83 ],
84 shared_libs: [
85 "libbinder_ndk",
Stephen Crane2a3c2502020-06-16 17:48:35 -070086 ],
87 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",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -070097 "com.android.compos",
Vikram Gaur38a4b0f2022-09-16 01:44:10 +000098 "com.android.rkpd",
ziyiwfe1cc952021-12-03 00:07:58 +000099 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +0900100 "com.android.virt",
101 ],
Roshan Piusbf42e372022-01-20 18:55:59 +0000102 min_sdk_version: "Tiramisu",
ThiƩbaud Weksteen3160ce92021-04-29 20:54:39 +0200103 lints: "none",
104 clippy_lints: "none",
Steven Moreland42548a02022-10-24 19:57:03 +0000105 visibility: [":__subpackages__"],
Stephen Crane2a3c2502020-06-16 17:48:35 -0700106}
107
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000108rust_library {
109 name: "libbinder_ndk_sys_on_trusty_mock",
110 crate_name: "binder_ndk_sys",
111 srcs: [
112 "sys/lib.rs",
113 ":libbinder_ndk_bindgen_on_trusty_mock",
114 ],
115 cfgs: [
116 "trusty",
117 ],
118 shared_libs: [
119 "libbinder_ndk_on_trusty_mock",
120 ],
121 vendor: true,
122 // Lints are checked separately for libbinder_ndk_sys.
123 // The Trusty mock copy pulls in extra headers that
124 // don't pass the lints for the bindgen output.
125 lints: "none",
126}
127
Stephen Crane2a3c2502020-06-16 17:48:35 -0700128rust_bindgen {
129 name: "libbinder_ndk_bindgen",
130 crate_name: "binder_ndk_bindgen",
Ivan Lozano7929c082020-09-23 13:33:42 -0400131 wrapper_src: "sys/BinderBindings.hpp",
Stephen Crane994a0f02020-08-11 14:47:29 -0700132 source_stem: "bindings",
Andrei Homescuabf991c2023-07-07 05:10:43 +0000133 bindgen_flag_files: [
Stephen Crane2a3c2502020-06-16 17:48:35 -0700134 // Unfortunately the only way to specify the rust_non_exhaustive enum
135 // style for a type is to make it the default
Stephen Crane2a3c2502020-06-16 17:48:35 -0700136 // and then specify constified enums for the enums we don't want
137 // rustified
Andrei Homescuabf991c2023-07-07 05:10:43 +0000138 "libbinder_ndk_bindgen_flags.txt",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700139 ],
140 shared_libs: [
141 "libbinder_ndk",
142 ],
143 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -0800144 vendor_available: true,
Devin Moore3d5ca6b2023-02-17 02:10:50 +0000145 product_available: true,
Stephen Crane2a3c2502020-06-16 17:48:35 -0700146
147 // Currently necessary for host builds
148 // TODO(b/31559095): bionic on host should define this
149 target: {
Yifan Hongf856a982020-10-30 14:51:17 -0700150 darwin: {
151 enabled: false,
152 },
Stephen Crane2a3c2502020-06-16 17:48:35 -0700153 },
Jiyong Parkb1af7832021-02-16 13:30:57 +0900154 apex_available: [
155 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -0700156 "com.android.compos",
Vikram Gaur38a4b0f2022-09-16 01:44:10 +0000157 "com.android.rkpd",
ziyiwfe1cc952021-12-03 00:07:58 +0000158 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +0900159 "com.android.virt",
160 ],
Roshan Piusbf42e372022-01-20 18:55:59 +0000161 min_sdk_version: "Tiramisu",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700162}
163
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000164rust_bindgen {
165 name: "libbinder_ndk_bindgen_on_trusty_mock",
166 crate_name: "binder_ndk_bindgen",
167 wrapper_src: "sys/BinderBindings.hpp",
168 source_stem: "bindings",
169 defaults: [
170 "trusty_mock_defaults",
171 ],
172
173 bindgen_flag_files: [
174 // Unfortunately the only way to specify the rust_non_exhaustive enum
175 // style for a type is to make it the default
176 // and then specify constified enums for the enums we don't want
177 // rustified
178 "libbinder_ndk_bindgen_flags.txt",
179 ],
180 shared_libs: [
181 "libbinder_ndk_on_trusty_mock",
182 "libc++",
183 ],
184}
185
Stephen Crane2a3c2502020-06-16 17:48:35 -0700186rust_test {
187 name: "libbinder_rs-internal_test",
188 crate_name: "binder",
189 srcs: ["src/lib.rs"],
190 test_suites: ["general-tests"],
191 auto_gen_config: true,
192 shared_libs: [
193 "libbinder_ndk",
194 ],
195 rustlibs: [
Stephen Crane994a0f02020-08-11 14:47:29 -0700196 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +0000197 "libdowncast_rs",
Andrew Walbran7b0be1f2022-08-04 16:47:46 +0000198 "liblibc",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700199 ],
200}
Joel Galenson52c44da2021-08-23 09:19:35 -0700201
202rust_test {
203 name: "libbinder_ndk_bindgen_test",
204 srcs: [":libbinder_ndk_bindgen"],
205 crate_name: "binder_ndk_bindgen",
206 test_suites: ["general-tests"],
207 auto_gen_config: true,
208 clippy_lints: "none",
209 lints: "none",
210}