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"], |
| 14 | shared_libs: [ |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 15 | "libutils", |
| 16 | ], |
| 17 | rustlibs: [ |
| 18 | "liblibc", |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 19 | "libbinder_ndk_sys", |
Andrei Homescu | ea40621 | 2021-09-03 02:55:00 +0000 | [diff] [blame] | 20 | "libdowncast_rs", |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 21 | ], |
| 22 | host_supported: true, |
Janis Danisevskis | 1323d51 | 2021-11-09 07:48:08 -0800 | [diff] [blame] | 23 | vendor_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", |
Victor Hsieh | 7d7de5b | 2021-05-10 16:28:54 -0700 | [diff] [blame] | 31 | "com.android.compos", |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame^] | 32 | "com.android.uwb", |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 33 | "com.android.virt", |
| 34 | ], |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame^] | 35 | min_sdk_version: "current", |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | rust_library { |
Alice Ryhl | 05f5a2c | 2021-09-15 12:56:10 +0000 | [diff] [blame] | 39 | name: "libbinder_tokio_rs", |
| 40 | crate_name: "binder_tokio", |
| 41 | srcs: ["binder_tokio/lib.rs"], |
| 42 | rustlibs: [ |
| 43 | "libbinder_rs", |
| 44 | "libtokio", |
| 45 | ], |
| 46 | host_supported: true, |
| 47 | target: { |
| 48 | darwin: { |
| 49 | enabled: false, |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame^] | 50 | }, |
Alice Ryhl | 05f5a2c | 2021-09-15 12:56:10 +0000 | [diff] [blame] | 51 | }, |
| 52 | apex_available: [ |
| 53 | "//apex_available:platform", |
| 54 | "com.android.compos", |
| 55 | "com.android.virt", |
| 56 | ], |
| 57 | } |
| 58 | |
| 59 | rust_library { |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 60 | name: "libbinder_ndk_sys", |
| 61 | crate_name: "binder_ndk_sys", |
| 62 | srcs: [ |
| 63 | "sys/lib.rs", |
| 64 | ":libbinder_ndk_bindgen", |
| 65 | ], |
| 66 | shared_libs: [ |
| 67 | "libbinder_ndk", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 68 | ], |
| 69 | host_supported: true, |
Janis Danisevskis | 1323d51 | 2021-11-09 07:48:08 -0800 | [diff] [blame] | 70 | vendor_available: true, |
Yifan Hong | f856a98 | 2020-10-30 14:51:17 -0700 | [diff] [blame] | 71 | target: { |
| 72 | darwin: { |
| 73 | enabled: false, |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame^] | 74 | }, |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 75 | }, |
| 76 | apex_available: [ |
| 77 | "//apex_available:platform", |
Victor Hsieh | 7d7de5b | 2021-05-10 16:28:54 -0700 | [diff] [blame] | 78 | "com.android.compos", |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame^] | 79 | "com.android.uwb", |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 80 | "com.android.virt", |
| 81 | ], |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame^] | 82 | min_sdk_version: "current", |
ThiƩbaud Weksteen | 3160ce9 | 2021-04-29 20:54:39 +0200 | [diff] [blame] | 83 | lints: "none", |
| 84 | clippy_lints: "none", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | rust_bindgen { |
| 88 | name: "libbinder_ndk_bindgen", |
| 89 | crate_name: "binder_ndk_bindgen", |
Ivan Lozano | 7929c08 | 2020-09-23 13:33:42 -0400 | [diff] [blame] | 90 | wrapper_src: "sys/BinderBindings.hpp", |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 91 | source_stem: "bindings", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 92 | bindgen_flags: [ |
| 93 | // Unfortunately the only way to specify the rust_non_exhaustive enum |
| 94 | // style for a type is to make it the default |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame^] | 95 | "--default-enum-style", |
| 96 | "rust_non_exhaustive", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 97 | // and then specify constified enums for the enums we don't want |
| 98 | // rustified |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame^] | 99 | "--constified-enum", |
| 100 | "android::c_interface::consts::.*", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 101 | |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame^] | 102 | "--allowlist-type", |
| 103 | "android::c_interface::.*", |
| 104 | "--allowlist-type", |
| 105 | "AStatus", |
| 106 | "--allowlist-type", |
| 107 | "AIBinder_Class", |
| 108 | "--allowlist-type", |
| 109 | "AIBinder", |
| 110 | "--allowlist-type", |
| 111 | "AIBinder_Weak", |
| 112 | "--allowlist-type", |
| 113 | "AIBinder_DeathRecipient", |
| 114 | "--allowlist-type", |
| 115 | "AParcel", |
| 116 | "--allowlist-type", |
| 117 | "binder_status_t", |
| 118 | "--allowlist-function", |
| 119 | ".*", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 120 | ], |
| 121 | shared_libs: [ |
| 122 | "libbinder_ndk", |
| 123 | ], |
| 124 | host_supported: true, |
Janis Danisevskis | 1323d51 | 2021-11-09 07:48:08 -0800 | [diff] [blame] | 125 | vendor_available: true, |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 126 | |
| 127 | // Currently necessary for host builds |
| 128 | // TODO(b/31559095): bionic on host should define this |
| 129 | target: { |
| 130 | host: { |
| 131 | cflags: [ |
| 132 | "-D__INTRODUCED_IN(n)=", |
| 133 | "-D__assert(a,b,c)=", |
| 134 | // We want all the APIs to be available on the host. |
| 135 | "-D__ANDROID_API__=10000", |
| 136 | ], |
| 137 | }, |
Yifan Hong | f856a98 | 2020-10-30 14:51:17 -0700 | [diff] [blame] | 138 | darwin: { |
| 139 | enabled: false, |
| 140 | }, |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 141 | }, |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 142 | apex_available: [ |
| 143 | "//apex_available:platform", |
Victor Hsieh | 7d7de5b | 2021-05-10 16:28:54 -0700 | [diff] [blame] | 144 | "com.android.compos", |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame^] | 145 | "com.android.uwb", |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 146 | "com.android.virt", |
| 147 | ], |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame^] | 148 | min_sdk_version: "current", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 149 | } |
| 150 | |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 151 | // TODO(b/184872979): remove once the Rust API is created. |
| 152 | rust_bindgen { |
| 153 | name: "libbinder_rpc_unstable_bindgen", |
Inseob Kim | 01befc8 | 2021-08-31 20:28:50 +0900 | [diff] [blame] | 154 | wrapper_src: ":libbinder_rpc_unstable_header", |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 155 | crate_name: "binder_rpc_unstable_bindgen", |
| 156 | source_stem: "bindings", |
| 157 | shared_libs: [ |
| 158 | "libutils", |
| 159 | ], |
| 160 | apex_available: [ |
| 161 | "com.android.compos", |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame^] | 162 | "com.android.uwb", |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 163 | "com.android.virt", |
| 164 | ], |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame^] | 165 | min_sdk_version: "current", |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 166 | } |
| 167 | |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 168 | rust_test { |
| 169 | name: "libbinder_rs-internal_test", |
| 170 | crate_name: "binder", |
| 171 | srcs: ["src/lib.rs"], |
| 172 | test_suites: ["general-tests"], |
| 173 | auto_gen_config: true, |
| 174 | shared_libs: [ |
| 175 | "libbinder_ndk", |
| 176 | ], |
| 177 | rustlibs: [ |
| 178 | "liblibc", |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 179 | "libbinder_ndk_sys", |
Andrei Homescu | ea40621 | 2021-09-03 02:55:00 +0000 | [diff] [blame] | 180 | "libdowncast_rs", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 181 | ], |
| 182 | } |
Joel Galenson | 52c44da | 2021-08-23 09:19:35 -0700 | [diff] [blame] | 183 | |
| 184 | rust_test { |
| 185 | name: "libbinder_ndk_bindgen_test", |
| 186 | srcs: [":libbinder_ndk_bindgen"], |
| 187 | crate_name: "binder_ndk_bindgen", |
| 188 | test_suites: ["general-tests"], |
| 189 | auto_gen_config: true, |
| 190 | clippy_lints: "none", |
| 191 | lints: "none", |
| 192 | } |
| 193 | |
| 194 | rust_test { |
| 195 | name: "libbinder_rpc_unstable_bindgen_test", |
| 196 | srcs: [":libbinder_rpc_unstable_bindgen"], |
| 197 | crate_name: "binder_rpc_unstable_bindgen", |
| 198 | test_suites: ["general-tests"], |
| 199 | auto_gen_config: true, |
| 200 | clippy_lints: "none", |
| 201 | lints: "none", |
| 202 | } |