blob: 0234820b02b94e9db5896ac6da4aacf0cad20aa7 [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",
Stephen Crane994a0f02020-08-11 14:47:29 -070031 wrapper_src: "sys/BinderBindings.h",
32 source_stem: "bindings",
Stephen Crane2a3c2502020-06-16 17:48:35 -070033 cflags: [
34 "-x c++",
35 ],
36 bindgen_flags: [
37 // Unfortunately the only way to specify the rust_non_exhaustive enum
38 // style for a type is to make it the default
39 "--default-enum-style", "rust_non_exhaustive",
40 // and then specify constified enums for the enums we don't want
41 // rustified
42 "--constified-enum", "android::c_interface::consts::.*",
43
44 "--whitelist-type", "android::c_interface::.*",
45 "--whitelist-type", "AStatus",
46 "--whitelist-type", "AIBinder_Class",
47 "--whitelist-type", "AIBinder",
48 "--whitelist-type", "AIBinder_Weak",
49 "--whitelist-type", "AIBinder_DeathRecipient",
50 "--whitelist-type", "AParcel",
51 "--whitelist-type", "binder_status_t",
52 "--whitelist-function", ".*",
53 ],
54 shared_libs: [
55 "libbinder_ndk",
56 ],
57 host_supported: true,
58
59 // Currently necessary for host builds
60 // TODO(b/31559095): bionic on host should define this
61 target: {
62 host: {
63 cflags: [
64 "-D__INTRODUCED_IN(n)=",
65 "-D__assert(a,b,c)=",
66 // We want all the APIs to be available on the host.
67 "-D__ANDROID_API__=10000",
68 ],
69 },
70 },
71}
72
73rust_test {
74 name: "libbinder_rs-internal_test",
75 crate_name: "binder",
76 srcs: ["src/lib.rs"],
77 test_suites: ["general-tests"],
78 auto_gen_config: true,
79 shared_libs: [
80 "libbinder_ndk",
81 ],
82 rustlibs: [
83 "liblibc",
Stephen Crane994a0f02020-08-11 14:47:29 -070084 "libbinder_ndk_sys",
Stephen Crane2a3c2502020-06-16 17:48:35 -070085 ],
86}