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