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: { |
Yifan Hong | f856a98 | 2020-10-30 14:51:17 -0700 | [diff] [blame] | 130 | darwin: { |
| 131 | enabled: false, |
| 132 | }, |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 133 | }, |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 134 | apex_available: [ |
| 135 | "//apex_available:platform", |
Victor Hsieh | 7d7de5b | 2021-05-10 16:28:54 -0700 | [diff] [blame] | 136 | "com.android.compos", |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame] | 137 | "com.android.uwb", |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame] | 138 | "com.android.virt", |
| 139 | ], |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame] | 140 | min_sdk_version: "current", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 141 | } |
| 142 | |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 143 | // TODO(b/184872979): remove once the Rust API is created. |
| 144 | rust_bindgen { |
| 145 | name: "libbinder_rpc_unstable_bindgen", |
Inseob Kim | 01befc8 | 2021-08-31 20:28:50 +0900 | [diff] [blame] | 146 | wrapper_src: ":libbinder_rpc_unstable_header", |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 147 | crate_name: "binder_rpc_unstable_bindgen", |
| 148 | source_stem: "bindings", |
| 149 | shared_libs: [ |
| 150 | "libutils", |
| 151 | ], |
| 152 | apex_available: [ |
| 153 | "com.android.compos", |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame] | 154 | "com.android.uwb", |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 155 | "com.android.virt", |
| 156 | ], |
ziyiw | fe1cc95 | 2021-12-03 00:07:58 +0000 | [diff] [blame] | 157 | min_sdk_version: "current", |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 158 | } |
| 159 | |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 160 | rust_test { |
| 161 | name: "libbinder_rs-internal_test", |
| 162 | crate_name: "binder", |
| 163 | srcs: ["src/lib.rs"], |
| 164 | test_suites: ["general-tests"], |
| 165 | auto_gen_config: true, |
| 166 | shared_libs: [ |
| 167 | "libbinder_ndk", |
| 168 | ], |
| 169 | rustlibs: [ |
| 170 | "liblibc", |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 171 | "libbinder_ndk_sys", |
Andrei Homescu | ea40621 | 2021-09-03 02:55:00 +0000 | [diff] [blame] | 172 | "libdowncast_rs", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 173 | ], |
| 174 | } |
Joel Galenson | 52c44da | 2021-08-23 09:19:35 -0700 | [diff] [blame] | 175 | |
| 176 | rust_test { |
| 177 | name: "libbinder_ndk_bindgen_test", |
| 178 | srcs: [":libbinder_ndk_bindgen"], |
| 179 | crate_name: "binder_ndk_bindgen", |
| 180 | test_suites: ["general-tests"], |
| 181 | auto_gen_config: true, |
| 182 | clippy_lints: "none", |
| 183 | lints: "none", |
| 184 | } |
| 185 | |
| 186 | rust_test { |
| 187 | name: "libbinder_rpc_unstable_bindgen_test", |
| 188 | srcs: [":libbinder_rpc_unstable_bindgen"], |
| 189 | crate_name: "binder_rpc_unstable_bindgen", |
| 190 | test_suites: ["general-tests"], |
| 191 | auto_gen_config: true, |
| 192 | clippy_lints: "none", |
| 193 | lints: "none", |
| 194 | } |