blob: 2deb25457e495b05172de4da1887c5ce47498e48 [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",
Nikita Putikhinea8bac22024-05-28 12:36:56 +020029 "//apex_available:anyapex",
Jiyong Parkb1af7832021-02-16 13:30:57 +090030 ],
Roshan Piusbf42e372022-01-20 18:55:59 +000031 min_sdk_version: "Tiramisu",
Stephen Crane994a0f02020-08-11 14:47:29 -070032}
33
34rust_library {
Andrei Homescu6dfa8c92024-03-29 04:58:32 +000035 name: "libbinder_rs_on_trusty_mock",
36 crate_name: "binder",
37 srcs: ["src/lib.rs"],
38 cfgs: [
39 "trusty",
40 ],
41 rustlibs: [
42 "libbinder_ndk_sys_on_trusty_mock",
43 "libdowncast_rs",
44 "liblibc",
45 ],
46 vendor: true,
47}
48
49rust_library {
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000050 name: "libbinder_tokio_rs",
51 crate_name: "binder_tokio",
52 srcs: ["binder_tokio/lib.rs"],
53 rustlibs: [
54 "libbinder_rs",
55 "libtokio",
56 ],
57 host_supported: true,
Matthew Maurer88e713a2022-01-14 22:15:38 +000058 vendor_available: true,
Nikita Putikhind0578482024-05-06 15:15:33 +020059 product_available: true,
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000060 target: {
61 darwin: {
62 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000063 },
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000064 },
65 apex_available: [
66 "//apex_available:platform",
Nikita Putikhinea8bac22024-05-28 12:36:56 +020067 "//apex_available:anyapex",
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000068 ],
Matthew Maurer88e713a2022-01-14 22:15:38 +000069 min_sdk_version: "Tiramisu",
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000070}
71
72rust_library {
Stephen Crane994a0f02020-08-11 14:47:29 -070073 name: "libbinder_ndk_sys",
74 crate_name: "binder_ndk_sys",
75 srcs: [
76 "sys/lib.rs",
77 ":libbinder_ndk_bindgen",
78 ],
79 shared_libs: [
80 "libbinder_ndk",
Stephen Crane2a3c2502020-06-16 17:48:35 -070081 ],
82 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080083 vendor_available: true,
Devin Moore3d5ca6b2023-02-17 02:10:50 +000084 product_available: true,
Yifan Hongf856a982020-10-30 14:51:17 -070085 target: {
86 darwin: {
87 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000088 },
Jiyong Parkb1af7832021-02-16 13:30:57 +090089 },
90 apex_available: [
91 "//apex_available:platform",
Nikita Putikhinea8bac22024-05-28 12:36:56 +020092 "//apex_available:anyapex",
Jiyong Parkb1af7832021-02-16 13:30:57 +090093 ],
Roshan Piusbf42e372022-01-20 18:55:59 +000094 min_sdk_version: "Tiramisu",
ThiƩbaud Weksteen3160ce92021-04-29 20:54:39 +020095 lints: "none",
96 clippy_lints: "none",
Steven Moreland42548a02022-10-24 19:57:03 +000097 visibility: [":__subpackages__"],
Stephen Crane2a3c2502020-06-16 17:48:35 -070098}
99
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000100rust_library {
101 name: "libbinder_ndk_sys_on_trusty_mock",
102 crate_name: "binder_ndk_sys",
103 srcs: [
104 "sys/lib.rs",
105 ":libbinder_ndk_bindgen_on_trusty_mock",
106 ],
107 cfgs: [
108 "trusty",
109 ],
110 shared_libs: [
111 "libbinder_ndk_on_trusty_mock",
112 ],
113 vendor: true,
114 // Lints are checked separately for libbinder_ndk_sys.
115 // The Trusty mock copy pulls in extra headers that
116 // don't pass the lints for the bindgen output.
117 lints: "none",
118}
119
Stephen Crane2a3c2502020-06-16 17:48:35 -0700120rust_bindgen {
121 name: "libbinder_ndk_bindgen",
122 crate_name: "binder_ndk_bindgen",
Ivan Lozano7929c082020-09-23 13:33:42 -0400123 wrapper_src: "sys/BinderBindings.hpp",
Stephen Crane994a0f02020-08-11 14:47:29 -0700124 source_stem: "bindings",
Andrei Homescuabf991c2023-07-07 05:10:43 +0000125 bindgen_flag_files: [
Stephen Crane2a3c2502020-06-16 17:48:35 -0700126 // Unfortunately the only way to specify the rust_non_exhaustive enum
127 // style for a type is to make it the default
Stephen Crane2a3c2502020-06-16 17:48:35 -0700128 // and then specify constified enums for the enums we don't want
129 // rustified
Andrei Homescuabf991c2023-07-07 05:10:43 +0000130 "libbinder_ndk_bindgen_flags.txt",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700131 ],
132 shared_libs: [
133 "libbinder_ndk",
134 ],
135 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -0800136 vendor_available: true,
Devin Moore3d5ca6b2023-02-17 02:10:50 +0000137 product_available: true,
Stephen Crane2a3c2502020-06-16 17:48:35 -0700138
139 // Currently necessary for host builds
140 // TODO(b/31559095): bionic on host should define this
141 target: {
Yifan Hongf856a982020-10-30 14:51:17 -0700142 darwin: {
143 enabled: false,
144 },
Stephen Crane2a3c2502020-06-16 17:48:35 -0700145 },
Jiyong Parkb1af7832021-02-16 13:30:57 +0900146 apex_available: [
147 "//apex_available:platform",
Nikita Putikhinea8bac22024-05-28 12:36:56 +0200148 "//apex_available:anyapex",
Jiyong Parkb1af7832021-02-16 13:30:57 +0900149 ],
Roshan Piusbf42e372022-01-20 18:55:59 +0000150 min_sdk_version: "Tiramisu",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700151}
152
Andrei Homescu6dfa8c92024-03-29 04:58:32 +0000153rust_bindgen {
154 name: "libbinder_ndk_bindgen_on_trusty_mock",
155 crate_name: "binder_ndk_bindgen",
156 wrapper_src: "sys/BinderBindings.hpp",
157 source_stem: "bindings",
158 defaults: [
159 "trusty_mock_defaults",
160 ],
161
162 bindgen_flag_files: [
163 // Unfortunately the only way to specify the rust_non_exhaustive enum
164 // style for a type is to make it the default
165 // and then specify constified enums for the enums we don't want
166 // rustified
167 "libbinder_ndk_bindgen_flags.txt",
168 ],
169 shared_libs: [
170 "libbinder_ndk_on_trusty_mock",
171 "libc++",
172 ],
173}
174
Stephen Crane2a3c2502020-06-16 17:48:35 -0700175rust_test {
176 name: "libbinder_rs-internal_test",
177 crate_name: "binder",
178 srcs: ["src/lib.rs"],
179 test_suites: ["general-tests"],
180 auto_gen_config: true,
181 shared_libs: [
182 "libbinder_ndk",
183 ],
184 rustlibs: [
Stephen Crane994a0f02020-08-11 14:47:29 -0700185 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +0000186 "libdowncast_rs",
Andrew Walbran7b0be1f2022-08-04 16:47:46 +0000187 "liblibc",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700188 ],
189}
Joel Galenson52c44da2021-08-23 09:19:35 -0700190
191rust_test {
192 name: "libbinder_ndk_bindgen_test",
193 srcs: [":libbinder_ndk_bindgen"],
194 crate_name: "binder_ndk_bindgen",
195 test_suites: ["general-tests"],
196 auto_gen_config: true,
197 clippy_lints: "none",
198 lints: "none",
199}