blob: e4df98aa4f2007321c73a3cbb4ef5c65065a9f1b [file] [log] [blame]
Bob Badour3c538232021-02-12 21:26:48 -08001package {
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 Crane2a3c2502020-06-16 17:48:35 -070010rust_library {
11 name: "libbinder_rs",
12 crate_name: "binder",
13 srcs: ["src/lib.rs"],
14 shared_libs: [
Stephen Crane2a3c2502020-06-16 17:48:35 -070015 "libutils",
16 ],
17 rustlibs: [
18 "liblibc",
Stephen Crane994a0f02020-08-11 14:47:29 -070019 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +000020 "libdowncast_rs",
Stephen Crane994a0f02020-08-11 14:47:29 -070021 ],
22 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080023 vendor_available: true,
Yifan Hongf856a982020-10-30 14:51:17 -070024 target: {
25 darwin: {
26 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000027 },
Jiyong Parkb1af7832021-02-16 13:30:57 +090028 },
29 apex_available: [
30 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -070031 "com.android.compos",
ziyiwfe1cc952021-12-03 00:07:58 +000032 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +090033 "com.android.virt",
34 ],
ziyiwfe1cc952021-12-03 00:07:58 +000035 min_sdk_version: "current",
Stephen Crane994a0f02020-08-11 14:47:29 -070036}
37
38rust_library {
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000039 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,
ziyiwfe1cc952021-12-03 00:07:58 +000050 },
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000051 },
52 apex_available: [
53 "//apex_available:platform",
54 "com.android.compos",
55 "com.android.virt",
56 ],
57}
58
59rust_library {
Stephen Crane994a0f02020-08-11 14:47:29 -070060 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 Crane2a3c2502020-06-16 17:48:35 -070068 ],
69 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080070 vendor_available: true,
Yifan Hongf856a982020-10-30 14:51:17 -070071 target: {
72 darwin: {
73 enabled: false,
ziyiwfe1cc952021-12-03 00:07:58 +000074 },
Jiyong Parkb1af7832021-02-16 13:30:57 +090075 },
76 apex_available: [
77 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -070078 "com.android.compos",
ziyiwfe1cc952021-12-03 00:07:58 +000079 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +090080 "com.android.virt",
81 ],
ziyiwfe1cc952021-12-03 00:07:58 +000082 min_sdk_version: "current",
ThiƩbaud Weksteen3160ce92021-04-29 20:54:39 +020083 lints: "none",
84 clippy_lints: "none",
Stephen Crane2a3c2502020-06-16 17:48:35 -070085}
86
87rust_bindgen {
88 name: "libbinder_ndk_bindgen",
89 crate_name: "binder_ndk_bindgen",
Ivan Lozano7929c082020-09-23 13:33:42 -040090 wrapper_src: "sys/BinderBindings.hpp",
Stephen Crane994a0f02020-08-11 14:47:29 -070091 source_stem: "bindings",
Stephen Crane2a3c2502020-06-16 17:48:35 -070092 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
ziyiwfe1cc952021-12-03 00:07:58 +000095 "--default-enum-style",
96 "rust_non_exhaustive",
Stephen Crane2a3c2502020-06-16 17:48:35 -070097 // and then specify constified enums for the enums we don't want
98 // rustified
ziyiwfe1cc952021-12-03 00:07:58 +000099 "--constified-enum",
100 "android::c_interface::consts::.*",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700101
ziyiwfe1cc952021-12-03 00:07:58 +0000102 "--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 Crane2a3c2502020-06-16 17:48:35 -0700120 ],
121 shared_libs: [
122 "libbinder_ndk",
123 ],
124 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -0800125 vendor_available: true,
Stephen Crane2a3c2502020-06-16 17:48:35 -0700126
127 // Currently necessary for host builds
128 // TODO(b/31559095): bionic on host should define this
129 target: {
Yifan Hongf856a982020-10-30 14:51:17 -0700130 darwin: {
131 enabled: false,
132 },
Stephen Crane2a3c2502020-06-16 17:48:35 -0700133 },
Jiyong Parkb1af7832021-02-16 13:30:57 +0900134 apex_available: [
135 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -0700136 "com.android.compos",
ziyiwfe1cc952021-12-03 00:07:58 +0000137 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +0900138 "com.android.virt",
139 ],
ziyiwfe1cc952021-12-03 00:07:58 +0000140 min_sdk_version: "current",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700141}
142
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700143// TODO(b/184872979): remove once the Rust API is created.
144rust_bindgen {
145 name: "libbinder_rpc_unstable_bindgen",
Inseob Kim01befc82021-08-31 20:28:50 +0900146 wrapper_src: ":libbinder_rpc_unstable_header",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700147 crate_name: "binder_rpc_unstable_bindgen",
148 source_stem: "bindings",
149 shared_libs: [
150 "libutils",
151 ],
152 apex_available: [
153 "com.android.compos",
ziyiwfe1cc952021-12-03 00:07:58 +0000154 "com.android.uwb",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700155 "com.android.virt",
156 ],
ziyiwfe1cc952021-12-03 00:07:58 +0000157 min_sdk_version: "current",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700158}
159
Stephen Crane2a3c2502020-06-16 17:48:35 -0700160rust_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 Crane994a0f02020-08-11 14:47:29 -0700171 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +0000172 "libdowncast_rs",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700173 ],
174}
Joel Galenson52c44da2021-08-23 09:19:35 -0700175
176rust_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
186rust_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}