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 | ], |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 142 | shared_libs: [ |
| 143 | "libbinder_ndk", |
| 144 | ], |
Devin Moore | bbd71b1 | 2024-08-09 23:20:03 +0000 | [diff] [blame] | 145 | rustlibs: [ |
| 146 | "liblibc", |
| 147 | ], |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 148 | host_supported: true, |
Janis Danisevskis | 1323d51 | 2021-11-09 07:48:08 -0800 | [diff] [blame] | 149 | vendor_available: true, |
Devin Moore | 3d5ca6b | 2023-02-17 02:10:50 +0000 | [diff] [blame] | 150 | product_available: true, |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 151 | |
| 152 | // Currently necessary for host builds |
| 153 | // TODO(b/31559095): bionic on host should define this |
| 154 | target: { |
Yifan Hong | f856a98 | 2020-10-30 14:51:17 -0700 | [diff] [blame] | 155 | darwin: { |
| 156 | enabled: false, |
| 157 | }, |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 158 | }, |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 159 | apex_available: [ |
| 160 | "//apex_available:platform", |
Nikita Putikhin | ea8bac2 | 2024-05-28 12:36:56 +0200 | [diff] [blame] | 161 | "//apex_available:anyapex", |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 162 | ], |
Roshan Pius | bf42e37 | 2022-01-20 18:55:59 +0000 | [diff] [blame] | 163 | min_sdk_version: "Tiramisu", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 164 | } |
| 165 | |
Andrei Homescu | 6dfa8c9 | 2024-03-29 04:58:32 +0000 | [diff] [blame] | 166 | rust_bindgen { |
| 167 | name: "libbinder_ndk_bindgen_on_trusty_mock", |
| 168 | crate_name: "binder_ndk_bindgen", |
| 169 | wrapper_src: "sys/BinderBindings.hpp", |
| 170 | source_stem: "bindings", |
| 171 | defaults: [ |
| 172 | "trusty_mock_defaults", |
| 173 | ], |
| 174 | |
| 175 | bindgen_flag_files: [ |
| 176 | // Unfortunately the only way to specify the rust_non_exhaustive enum |
| 177 | // style for a type is to make it the default |
| 178 | // and then specify constified enums for the enums we don't want |
| 179 | // rustified |
| 180 | "libbinder_ndk_bindgen_flags.txt", |
| 181 | ], |
| 182 | shared_libs: [ |
| 183 | "libbinder_ndk_on_trusty_mock", |
| 184 | "libc++", |
| 185 | ], |
| 186 | } |
| 187 | |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 188 | rust_test { |
| 189 | name: "libbinder_rs-internal_test", |
| 190 | crate_name: "binder", |
| 191 | srcs: ["src/lib.rs"], |
| 192 | test_suites: ["general-tests"], |
| 193 | auto_gen_config: true, |
| 194 | shared_libs: [ |
| 195 | "libbinder_ndk", |
| 196 | ], |
| 197 | rustlibs: [ |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 198 | "libbinder_ndk_sys", |
Andrei Homescu | ea40621 | 2021-09-03 02:55:00 +0000 | [diff] [blame] | 199 | "libdowncast_rs", |
Andrew Walbran | 7b0be1f | 2022-08-04 16:47:46 +0000 | [diff] [blame] | 200 | "liblibc", |
Devin Moore | bbd71b1 | 2024-08-09 23:20:03 +0000 | [diff] [blame] | 201 | "liblog_rust", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 202 | ], |
| 203 | } |
Joel Galenson | 52c44da | 2021-08-23 09:19:35 -0700 | [diff] [blame] | 204 | |
| 205 | rust_test { |
| 206 | name: "libbinder_ndk_bindgen_test", |
| 207 | srcs: [":libbinder_ndk_bindgen"], |
| 208 | crate_name: "binder_ndk_bindgen", |
| 209 | test_suites: ["general-tests"], |
| 210 | auto_gen_config: true, |
| 211 | clippy_lints: "none", |
| 212 | lints: "none", |
Devin Moore | bbd71b1 | 2024-08-09 23:20:03 +0000 | [diff] [blame] | 213 | rustlibs: [ |
| 214 | "liblibc", |
| 215 | ], |
Joel Galenson | 52c44da | 2021-08-23 09:19:35 -0700 | [diff] [blame] | 216 | } |