blob: dc8270eeebb95c592f02668b9a1315d57b83b075 [file] [log] [blame]
Stephen Crane2a3c2502020-06-16 17:48:35 -07001rust_library {
2 name: "libbinder_rs",
3 crate_name: "binder",
4 srcs: ["src/lib.rs"],
5 shared_libs: [
Stephen Crane2a3c2502020-06-16 17:48:35 -07006 "libutils",
7 ],
8 rustlibs: [
9 "liblibc",
Stephen Crane994a0f02020-08-11 14:47:29 -070010 "libbinder_ndk_sys",
11 ],
12 host_supported: true,
13}
14
15rust_library {
16 name: "libbinder_ndk_sys",
17 crate_name: "binder_ndk_sys",
18 srcs: [
19 "sys/lib.rs",
20 ":libbinder_ndk_bindgen",
21 ],
22 shared_libs: [
23 "libbinder_ndk",
Stephen Crane2a3c2502020-06-16 17:48:35 -070024 ],
25 host_supported: true,
26}
27
28rust_bindgen {
29 name: "libbinder_ndk_bindgen",
30 crate_name: "binder_ndk_bindgen",
Ivan Lozano7929c082020-09-23 13:33:42 -040031 wrapper_src: "sys/BinderBindings.hpp",
Stephen Crane994a0f02020-08-11 14:47:29 -070032 source_stem: "bindings",
Stephen Crane2a3c2502020-06-16 17:48:35 -070033 bindgen_flags: [
34 // Unfortunately the only way to specify the rust_non_exhaustive enum
35 // style for a type is to make it the default
36 "--default-enum-style", "rust_non_exhaustive",
37 // and then specify constified enums for the enums we don't want
38 // rustified
39 "--constified-enum", "android::c_interface::consts::.*",
40
41 "--whitelist-type", "android::c_interface::.*",
42 "--whitelist-type", "AStatus",
43 "--whitelist-type", "AIBinder_Class",
44 "--whitelist-type", "AIBinder",
45 "--whitelist-type", "AIBinder_Weak",
46 "--whitelist-type", "AIBinder_DeathRecipient",
47 "--whitelist-type", "AParcel",
48 "--whitelist-type", "binder_status_t",
49 "--whitelist-function", ".*",
50 ],
51 shared_libs: [
52 "libbinder_ndk",
53 ],
54 host_supported: true,
55
56 // Currently necessary for host builds
57 // TODO(b/31559095): bionic on host should define this
58 target: {
59 host: {
60 cflags: [
61 "-D__INTRODUCED_IN(n)=",
62 "-D__assert(a,b,c)=",
63 // We want all the APIs to be available on the host.
64 "-D__ANDROID_API__=10000",
65 ],
66 },
67 },
68}
69
70rust_test {
71 name: "libbinder_rs-internal_test",
72 crate_name: "binder",
73 srcs: ["src/lib.rs"],
74 test_suites: ["general-tests"],
75 auto_gen_config: true,
76 shared_libs: [
77 "libbinder_ndk",
78 ],
79 rustlibs: [
80 "liblibc",
Stephen Crane994a0f02020-08-11 14:47:29 -070081 "libbinder_ndk_sys",
Stephen Crane2a3c2502020-06-16 17:48:35 -070082 ],
83}