blob: 4561d6e49494d75530a679484d7ac901ba854581 [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,
27 }
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",
Jiyong Parkb1af7832021-02-16 13:30:57 +090032 "com.android.virt",
33 ],
Stephen Crane994a0f02020-08-11 14:47:29 -070034}
35
36rust_library {
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000037 name: "libbinder_tokio_rs",
38 crate_name: "binder_tokio",
39 srcs: ["binder_tokio/lib.rs"],
40 rustlibs: [
41 "libbinder_rs",
42 "libtokio",
43 ],
44 host_supported: true,
45 target: {
46 darwin: {
47 enabled: false,
48 }
49 },
50 apex_available: [
51 "//apex_available:platform",
52 "com.android.compos",
53 "com.android.virt",
54 ],
55}
56
57rust_library {
Stephen Crane994a0f02020-08-11 14:47:29 -070058 name: "libbinder_ndk_sys",
59 crate_name: "binder_ndk_sys",
60 srcs: [
61 "sys/lib.rs",
62 ":libbinder_ndk_bindgen",
63 ],
64 shared_libs: [
65 "libbinder_ndk",
Stephen Crane2a3c2502020-06-16 17:48:35 -070066 ],
67 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -080068 vendor_available: true,
Yifan Hongf856a982020-10-30 14:51:17 -070069 target: {
70 darwin: {
71 enabled: false,
72 }
Jiyong Parkb1af7832021-02-16 13:30:57 +090073 },
74 apex_available: [
75 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -070076 "com.android.compos",
Jiyong Parkb1af7832021-02-16 13:30:57 +090077 "com.android.virt",
78 ],
ThiƩbaud Weksteen3160ce92021-04-29 20:54:39 +020079 lints: "none",
80 clippy_lints: "none",
Stephen Crane2a3c2502020-06-16 17:48:35 -070081}
82
83rust_bindgen {
84 name: "libbinder_ndk_bindgen",
85 crate_name: "binder_ndk_bindgen",
Ivan Lozano7929c082020-09-23 13:33:42 -040086 wrapper_src: "sys/BinderBindings.hpp",
Stephen Crane994a0f02020-08-11 14:47:29 -070087 source_stem: "bindings",
Stephen Crane2a3c2502020-06-16 17:48:35 -070088 bindgen_flags: [
89 // Unfortunately the only way to specify the rust_non_exhaustive enum
90 // style for a type is to make it the default
91 "--default-enum-style", "rust_non_exhaustive",
92 // and then specify constified enums for the enums we don't want
93 // rustified
94 "--constified-enum", "android::c_interface::consts::.*",
95
Joel Galenson6ad53242021-04-19 09:39:12 -070096 "--allowlist-type", "android::c_interface::.*",
97 "--allowlist-type", "AStatus",
98 "--allowlist-type", "AIBinder_Class",
99 "--allowlist-type", "AIBinder",
100 "--allowlist-type", "AIBinder_Weak",
101 "--allowlist-type", "AIBinder_DeathRecipient",
102 "--allowlist-type", "AParcel",
103 "--allowlist-type", "binder_status_t",
104 "--allowlist-function", ".*",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700105 ],
106 shared_libs: [
107 "libbinder_ndk",
108 ],
109 host_supported: true,
Janis Danisevskis1323d512021-11-09 07:48:08 -0800110 vendor_available: true,
Stephen Crane2a3c2502020-06-16 17:48:35 -0700111
112 // Currently necessary for host builds
113 // TODO(b/31559095): bionic on host should define this
114 target: {
115 host: {
116 cflags: [
117 "-D__INTRODUCED_IN(n)=",
118 "-D__assert(a,b,c)=",
119 // We want all the APIs to be available on the host.
120 "-D__ANDROID_API__=10000",
121 ],
122 },
Yifan Hongf856a982020-10-30 14:51:17 -0700123 darwin: {
124 enabled: false,
125 },
Stephen Crane2a3c2502020-06-16 17:48:35 -0700126 },
Jiyong Parkb1af7832021-02-16 13:30:57 +0900127 apex_available: [
128 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -0700129 "com.android.compos",
Jiyong Parkb1af7832021-02-16 13:30:57 +0900130 "com.android.virt",
131 ],
Stephen Crane2a3c2502020-06-16 17:48:35 -0700132}
133
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700134// TODO(b/184872979): remove once the Rust API is created.
135rust_bindgen {
136 name: "libbinder_rpc_unstable_bindgen",
Inseob Kim01befc82021-08-31 20:28:50 +0900137 wrapper_src: ":libbinder_rpc_unstable_header",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700138 crate_name: "binder_rpc_unstable_bindgen",
139 source_stem: "bindings",
140 shared_libs: [
141 "libutils",
142 ],
143 apex_available: [
144 "com.android.compos",
145 "com.android.virt",
146 ],
147}
148
Stephen Crane2a3c2502020-06-16 17:48:35 -0700149rust_test {
150 name: "libbinder_rs-internal_test",
151 crate_name: "binder",
152 srcs: ["src/lib.rs"],
153 test_suites: ["general-tests"],
154 auto_gen_config: true,
155 shared_libs: [
156 "libbinder_ndk",
157 ],
158 rustlibs: [
159 "liblibc",
Stephen Crane994a0f02020-08-11 14:47:29 -0700160 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +0000161 "libdowncast_rs",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700162 ],
163}
Joel Galenson52c44da2021-08-23 09:19:35 -0700164
165rust_test {
166 name: "libbinder_ndk_bindgen_test",
167 srcs: [":libbinder_ndk_bindgen"],
168 crate_name: "binder_ndk_bindgen",
169 test_suites: ["general-tests"],
170 auto_gen_config: true,
171 clippy_lints: "none",
172 lints: "none",
173}
174
175rust_test {
176 name: "libbinder_rpc_unstable_bindgen_test",
177 srcs: [":libbinder_rpc_unstable_bindgen"],
178 crate_name: "binder_rpc_unstable_bindgen",
179 test_suites: ["general-tests"],
180 auto_gen_config: true,
181 clippy_lints: "none",
182 lints: "none",
183}