blob: e2fc18d85959b433f9b6438698b824f826cec85d [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: {
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 Hongf856a982020-10-30 14:51:17 -0700138 darwin: {
139 enabled: false,
140 },
Stephen Crane2a3c2502020-06-16 17:48:35 -0700141 },
Jiyong Parkb1af7832021-02-16 13:30:57 +0900142 apex_available: [
143 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -0700144 "com.android.compos",
ziyiwfe1cc952021-12-03 00:07:58 +0000145 "com.android.uwb",
Jiyong Parkb1af7832021-02-16 13:30:57 +0900146 "com.android.virt",
147 ],
ziyiwfe1cc952021-12-03 00:07:58 +0000148 min_sdk_version: "current",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700149}
150
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700151// TODO(b/184872979): remove once the Rust API is created.
152rust_bindgen {
153 name: "libbinder_rpc_unstable_bindgen",
Inseob Kim01befc82021-08-31 20:28:50 +0900154 wrapper_src: ":libbinder_rpc_unstable_header",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700155 crate_name: "binder_rpc_unstable_bindgen",
156 source_stem: "bindings",
157 shared_libs: [
158 "libutils",
159 ],
160 apex_available: [
161 "com.android.compos",
ziyiwfe1cc952021-12-03 00:07:58 +0000162 "com.android.uwb",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700163 "com.android.virt",
164 ],
ziyiwfe1cc952021-12-03 00:07:58 +0000165 min_sdk_version: "current",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700166}
167
Stephen Crane2a3c2502020-06-16 17:48:35 -0700168rust_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 Crane994a0f02020-08-11 14:47:29 -0700179 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +0000180 "libdowncast_rs",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700181 ],
182}
Joel Galenson52c44da2021-08-23 09:19:35 -0700183
184rust_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
194rust_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}