Bob Badour | 3c53823 | 2021-02-12 21:26:48 -0800 | [diff] [blame] | 1 | package { |
| 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 Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 10 | rust_library { |
| 11 | name: "libbinder_rs", |
| 12 | crate_name: "binder", |
| 13 | srcs: ["src/lib.rs"], |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 14 | rustlibs: [ |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 15 | "libbinder_ndk_sys", |
Andrei Homescu | ea40621 | 2021-09-03 02:55:00 +0000 | [diff] [blame] | 16 | "libdowncast_rs", |
Andrew Walbran | 7b0be1f | 2022-08-04 16:47:46 +0000 | [diff] [blame] | 17 | "liblibc", |
Devin Moore | bbd71b1 | 2024-08-09 23:20:03 +0000 | [diff] [blame] | 18 | "liblog_rust", |
| 19 | "libnix", |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 20 | ], |
| 21 | host_supported: true, |
Janis Danisevskis | 1323d51 | 2021-11-09 07:48:08 -0800 | [diff] [blame] | 22 | vendor_available: true, |
Devin Moore | 3d5ca6b | 2023-02-17 02:10:50 +0000 | [diff] [blame] | 23 | product_available: true, |
Yifan Hong | f856a98 | 2020-10-30 14:51:17 -0700 | [diff] [blame] | 24 | target: { |
| 25 | darwin: { |
| 26 | enabled: false, |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame] | 27 | }, |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 28 | }, |
| 29 | apex_available: [ |
| 30 | "//apex_available:platform", |
Nikita Putikhin | ea8bac2 | 2024-05-28 12:36:56 +0200 | [diff] [blame] | 31 | "//apex_available:anyapex", |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 32 | ], |
Roshan Pius | bf42e37 | 2022-01-20 18:55:59 +0000 | [diff] [blame] | 33 | min_sdk_version: "Tiramisu", |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | rust_library { |
Andrei Homescu | 6dfa8c9 | 2024-03-29 04:58:32 +0000 | [diff] [blame] | 37 | 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 | |
| 51 | rust_library { |
Alice Ryhl | 05f5a2c | 2021-09-15 12:56:10 +0000 | [diff] [blame] | 52 | 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 Maurer | 88e713a | 2022-01-14 22:15:38 +0000 | [diff] [blame] | 60 | vendor_available: true, |
Nikita Putikhin | d057848 | 2024-05-06 15:15:33 +0200 | [diff] [blame] | 61 | product_available: true, |
Alice Ryhl | 05f5a2c | 2021-09-15 12:56:10 +0000 | [diff] [blame] | 62 | target: { |
| 63 | darwin: { |
| 64 | enabled: false, |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame] | 65 | }, |
Alice Ryhl | 05f5a2c | 2021-09-15 12:56:10 +0000 | [diff] [blame] | 66 | }, |
| 67 | apex_available: [ |
| 68 | "//apex_available:platform", |
Nikita Putikhin | ea8bac2 | 2024-05-28 12:36:56 +0200 | [diff] [blame] | 69 | "//apex_available:anyapex", |
Alice Ryhl | 05f5a2c | 2021-09-15 12:56:10 +0000 | [diff] [blame] | 70 | ], |
Matthew Maurer | 88e713a | 2022-01-14 22:15:38 +0000 | [diff] [blame] | 71 | min_sdk_version: "Tiramisu", |
Alice Ryhl | 05f5a2c | 2021-09-15 12:56:10 +0000 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | rust_library { |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 75 | 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 Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 83 | ], |
Devin Moore | bbd71b1 | 2024-08-09 23:20:03 +0000 | [diff] [blame] | 84 | rustlibs: [ |
| 85 | "liblibc", |
| 86 | ], |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 87 | host_supported: true, |
Janis Danisevskis | 1323d51 | 2021-11-09 07:48:08 -0800 | [diff] [blame] | 88 | vendor_available: true, |
Devin Moore | 3d5ca6b | 2023-02-17 02:10:50 +0000 | [diff] [blame] | 89 | product_available: true, |
Yifan Hong | f856a98 | 2020-10-30 14:51:17 -0700 | [diff] [blame] | 90 | target: { |
| 91 | darwin: { |
| 92 | enabled: false, |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame] | 93 | }, |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 94 | }, |
| 95 | apex_available: [ |
| 96 | "//apex_available:platform", |
Nikita Putikhin | ea8bac2 | 2024-05-28 12:36:56 +0200 | [diff] [blame] | 97 | "//apex_available:anyapex", |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 98 | ], |
Roshan Pius | bf42e37 | 2022-01-20 18:55:59 +0000 | [diff] [blame] | 99 | min_sdk_version: "Tiramisu", |
ThiƩbaud Weksteen | 3160ce9 | 2021-04-29 20:54:39 +0200 | [diff] [blame] | 100 | lints: "none", |
| 101 | clippy_lints: "none", |
Steven Moreland | 42548a0 | 2022-10-24 19:57:03 +0000 | [diff] [blame] | 102 | visibility: [":__subpackages__"], |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 103 | } |
| 104 | |
Andrei Homescu | 6dfa8c9 | 2024-03-29 04:58:32 +0000 | [diff] [blame] | 105 | rust_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 Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 125 | rust_bindgen { |
| 126 | name: "libbinder_ndk_bindgen", |
| 127 | crate_name: "binder_ndk_bindgen", |
Ivan Lozano | 7929c08 | 2020-09-23 13:33:42 -0400 | [diff] [blame] | 128 | wrapper_src: "sys/BinderBindings.hpp", |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 129 | source_stem: "bindings", |
Andrei Homescu | abf991c | 2023-07-07 05:10:43 +0000 | [diff] [blame] | 130 | bindgen_flag_files: [ |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 131 | // Unfortunately the only way to specify the rust_non_exhaustive enum |
| 132 | // style for a type is to make it the default |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 133 | // and then specify constified enums for the enums we don't want |
| 134 | // rustified |
Andrei Homescu | abf991c | 2023-07-07 05:10:43 +0000 | [diff] [blame] | 135 | "libbinder_ndk_bindgen_flags.txt", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 136 | ], |
Devin Moore | bbd71b1 | 2024-08-09 23:20:03 +0000 | [diff] [blame] | 137 | bindgen_flags: [ |
| 138 | "--blocklist-type", |
| 139 | "sockaddr", |
| 140 | "--raw-line", |
| 141 | "use libc::sockaddr;", |
| 142 | ], |
Matthew Maurer | cf0037d | 2024-10-09 21:38:29 +0000 | [diff] [blame^] | 143 | cflags: [ |
| 144 | "-DANDROID_PLATFORM", |
| 145 | ], |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 146 | shared_libs: [ |
| 147 | "libbinder_ndk", |
| 148 | ], |
Devin Moore | bbd71b1 | 2024-08-09 23:20:03 +0000 | [diff] [blame] | 149 | rustlibs: [ |
| 150 | "liblibc", |
| 151 | ], |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 152 | host_supported: true, |
Janis Danisevskis | 1323d51 | 2021-11-09 07:48:08 -0800 | [diff] [blame] | 153 | vendor_available: true, |
Devin Moore | 3d5ca6b | 2023-02-17 02:10:50 +0000 | [diff] [blame] | 154 | product_available: true, |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 155 | |
| 156 | // Currently necessary for host builds |
| 157 | // TODO(b/31559095): bionic on host should define this |
| 158 | target: { |
Yifan Hong | f856a98 | 2020-10-30 14:51:17 -0700 | [diff] [blame] | 159 | darwin: { |
| 160 | enabled: false, |
| 161 | }, |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 162 | }, |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 163 | apex_available: [ |
| 164 | "//apex_available:platform", |
Nikita Putikhin | ea8bac2 | 2024-05-28 12:36:56 +0200 | [diff] [blame] | 165 | "//apex_available:anyapex", |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 166 | ], |
Roshan Pius | bf42e37 | 2022-01-20 18:55:59 +0000 | [diff] [blame] | 167 | min_sdk_version: "Tiramisu", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 168 | } |
| 169 | |
Andrei Homescu | 6dfa8c9 | 2024-03-29 04:58:32 +0000 | [diff] [blame] | 170 | rust_bindgen { |
| 171 | name: "libbinder_ndk_bindgen_on_trusty_mock", |
| 172 | crate_name: "binder_ndk_bindgen", |
| 173 | wrapper_src: "sys/BinderBindings.hpp", |
| 174 | source_stem: "bindings", |
| 175 | defaults: [ |
| 176 | "trusty_mock_defaults", |
| 177 | ], |
| 178 | |
| 179 | bindgen_flag_files: [ |
| 180 | // Unfortunately the only way to specify the rust_non_exhaustive enum |
| 181 | // style for a type is to make it the default |
| 182 | // and then specify constified enums for the enums we don't want |
| 183 | // rustified |
| 184 | "libbinder_ndk_bindgen_flags.txt", |
| 185 | ], |
Matthew Maurer | cf0037d | 2024-10-09 21:38:29 +0000 | [diff] [blame^] | 186 | cflags: [ |
| 187 | "-DANDROID_PLATFORM", |
| 188 | ], |
Andrei Homescu | 6dfa8c9 | 2024-03-29 04:58:32 +0000 | [diff] [blame] | 189 | shared_libs: [ |
| 190 | "libbinder_ndk_on_trusty_mock", |
| 191 | "libc++", |
| 192 | ], |
| 193 | } |
| 194 | |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 195 | rust_test { |
| 196 | name: "libbinder_rs-internal_test", |
| 197 | crate_name: "binder", |
| 198 | srcs: ["src/lib.rs"], |
| 199 | test_suites: ["general-tests"], |
| 200 | auto_gen_config: true, |
| 201 | shared_libs: [ |
| 202 | "libbinder_ndk", |
| 203 | ], |
| 204 | rustlibs: [ |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 205 | "libbinder_ndk_sys", |
Andrei Homescu | ea40621 | 2021-09-03 02:55:00 +0000 | [diff] [blame] | 206 | "libdowncast_rs", |
Andrew Walbran | 7b0be1f | 2022-08-04 16:47:46 +0000 | [diff] [blame] | 207 | "liblibc", |
Devin Moore | bbd71b1 | 2024-08-09 23:20:03 +0000 | [diff] [blame] | 208 | "liblog_rust", |
| 209 | "libnix", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 210 | ], |
| 211 | } |
Joel Galenson | 52c44da | 2021-08-23 09:19:35 -0700 | [diff] [blame] | 212 | |
| 213 | rust_test { |
| 214 | name: "libbinder_ndk_bindgen_test", |
| 215 | srcs: [":libbinder_ndk_bindgen"], |
| 216 | crate_name: "binder_ndk_bindgen", |
| 217 | test_suites: ["general-tests"], |
| 218 | auto_gen_config: true, |
| 219 | clippy_lints: "none", |
| 220 | lints: "none", |
Devin Moore | bbd71b1 | 2024-08-09 23:20:03 +0000 | [diff] [blame] | 221 | rustlibs: [ |
| 222 | "liblibc", |
| 223 | ], |
Joel Galenson | 52c44da | 2021-08-23 09:19:35 -0700 | [diff] [blame] | 224 | } |