blob: d323022b019bff5855682e54bf8196ca3b9b832c [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,
Yifan Hongf856a982020-10-30 14:51:17 -070023 target: {
24 darwin: {
25 enabled: false,
26 }
Jiyong Parkb1af7832021-02-16 13:30:57 +090027 },
28 apex_available: [
29 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -070030 "com.android.compos",
Jiyong Parkb1af7832021-02-16 13:30:57 +090031 "com.android.virt",
32 ],
Stephen Crane994a0f02020-08-11 14:47:29 -070033}
34
35rust_library {
Alice Ryhl05f5a2c2021-09-15 12:56:10 +000036 name: "libbinder_tokio_rs",
37 crate_name: "binder_tokio",
38 srcs: ["binder_tokio/lib.rs"],
39 rustlibs: [
40 "libbinder_rs",
41 "libtokio",
42 ],
43 host_supported: true,
44 target: {
45 darwin: {
46 enabled: false,
47 }
48 },
49 apex_available: [
50 "//apex_available:platform",
51 "com.android.compos",
52 "com.android.virt",
53 ],
54}
55
56rust_library {
Stephen Crane994a0f02020-08-11 14:47:29 -070057 name: "libbinder_ndk_sys",
58 crate_name: "binder_ndk_sys",
59 srcs: [
60 "sys/lib.rs",
61 ":libbinder_ndk_bindgen",
62 ],
63 shared_libs: [
64 "libbinder_ndk",
Stephen Crane2a3c2502020-06-16 17:48:35 -070065 ],
66 host_supported: true,
Yifan Hongf856a982020-10-30 14:51:17 -070067 target: {
68 darwin: {
69 enabled: false,
70 }
Jiyong Parkb1af7832021-02-16 13:30:57 +090071 },
72 apex_available: [
73 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -070074 "com.android.compos",
Jiyong Parkb1af7832021-02-16 13:30:57 +090075 "com.android.virt",
76 ],
ThiƩbaud Weksteen3160ce92021-04-29 20:54:39 +020077 lints: "none",
78 clippy_lints: "none",
Stephen Crane2a3c2502020-06-16 17:48:35 -070079}
80
81rust_bindgen {
82 name: "libbinder_ndk_bindgen",
83 crate_name: "binder_ndk_bindgen",
Ivan Lozano7929c082020-09-23 13:33:42 -040084 wrapper_src: "sys/BinderBindings.hpp",
Stephen Crane994a0f02020-08-11 14:47:29 -070085 source_stem: "bindings",
Stephen Crane2a3c2502020-06-16 17:48:35 -070086 bindgen_flags: [
87 // Unfortunately the only way to specify the rust_non_exhaustive enum
88 // style for a type is to make it the default
89 "--default-enum-style", "rust_non_exhaustive",
90 // and then specify constified enums for the enums we don't want
91 // rustified
92 "--constified-enum", "android::c_interface::consts::.*",
93
Joel Galenson6ad53242021-04-19 09:39:12 -070094 "--allowlist-type", "android::c_interface::.*",
95 "--allowlist-type", "AStatus",
96 "--allowlist-type", "AIBinder_Class",
97 "--allowlist-type", "AIBinder",
98 "--allowlist-type", "AIBinder_Weak",
99 "--allowlist-type", "AIBinder_DeathRecipient",
100 "--allowlist-type", "AParcel",
101 "--allowlist-type", "binder_status_t",
102 "--allowlist-function", ".*",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700103 ],
104 shared_libs: [
105 "libbinder_ndk",
106 ],
107 host_supported: true,
108
109 // Currently necessary for host builds
110 // TODO(b/31559095): bionic on host should define this
111 target: {
112 host: {
113 cflags: [
114 "-D__INTRODUCED_IN(n)=",
115 "-D__assert(a,b,c)=",
116 // We want all the APIs to be available on the host.
117 "-D__ANDROID_API__=10000",
118 ],
119 },
Yifan Hongf856a982020-10-30 14:51:17 -0700120 darwin: {
121 enabled: false,
122 },
Stephen Crane2a3c2502020-06-16 17:48:35 -0700123 },
Jiyong Parkb1af7832021-02-16 13:30:57 +0900124 apex_available: [
125 "//apex_available:platform",
Victor Hsieh7d7de5b2021-05-10 16:28:54 -0700126 "com.android.compos",
Jiyong Parkb1af7832021-02-16 13:30:57 +0900127 "com.android.virt",
128 ],
Stephen Crane2a3c2502020-06-16 17:48:35 -0700129}
130
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700131// TODO(b/184872979): remove once the Rust API is created.
132rust_bindgen {
133 name: "libbinder_rpc_unstable_bindgen",
Inseob Kim01befc82021-08-31 20:28:50 +0900134 wrapper_src: ":libbinder_rpc_unstable_header",
Victor Hsiehd35d31d2021-06-03 11:24:31 -0700135 crate_name: "binder_rpc_unstable_bindgen",
136 source_stem: "bindings",
137 shared_libs: [
138 "libutils",
139 ],
140 apex_available: [
141 "com.android.compos",
142 "com.android.virt",
143 ],
144}
145
Stephen Crane2a3c2502020-06-16 17:48:35 -0700146rust_test {
147 name: "libbinder_rs-internal_test",
148 crate_name: "binder",
149 srcs: ["src/lib.rs"],
150 test_suites: ["general-tests"],
151 auto_gen_config: true,
152 shared_libs: [
153 "libbinder_ndk",
154 ],
155 rustlibs: [
156 "liblibc",
Stephen Crane994a0f02020-08-11 14:47:29 -0700157 "libbinder_ndk_sys",
Andrei Homescuea406212021-09-03 02:55:00 +0000158 "libdowncast_rs",
Stephen Crane2a3c2502020-06-16 17:48:35 -0700159 ],
160}
Joel Galenson52c44da2021-08-23 09:19:35 -0700161
162rust_test {
163 name: "libbinder_ndk_bindgen_test",
164 srcs: [":libbinder_ndk_bindgen"],
165 crate_name: "binder_ndk_bindgen",
166 test_suites: ["general-tests"],
167 auto_gen_config: true,
168 clippy_lints: "none",
169 lints: "none",
170}
171
172rust_test {
173 name: "libbinder_rpc_unstable_bindgen_test",
174 srcs: [":libbinder_rpc_unstable_bindgen"],
175 crate_name: "binder_rpc_unstable_bindgen",
176 test_suites: ["general-tests"],
177 auto_gen_config: true,
178 clippy_lints: "none",
179 lints: "none",
180}