blob: fd5f2f5d9cfcaf5d829e037afa6655509e4872b9 [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,
Yifan Hongf856a982020-10-30 14:51:17 -070013 target: {
14 darwin: {
15 enabled: false,
16 }
17 }
Stephen Crane994a0f02020-08-11 14:47:29 -070018}
19
20rust_library {
21 name: "libbinder_ndk_sys",
22 crate_name: "binder_ndk_sys",
23 srcs: [
24 "sys/lib.rs",
25 ":libbinder_ndk_bindgen",
26 ],
27 shared_libs: [
28 "libbinder_ndk",
Stephen Crane2a3c2502020-06-16 17:48:35 -070029 ],
30 host_supported: true,
Yifan Hongf856a982020-10-30 14:51:17 -070031 target: {
32 darwin: {
33 enabled: false,
34 }
35 }
Stephen Crane2a3c2502020-06-16 17:48:35 -070036}
37
38rust_bindgen {
39 name: "libbinder_ndk_bindgen",
40 crate_name: "binder_ndk_bindgen",
Ivan Lozano7929c082020-09-23 13:33:42 -040041 wrapper_src: "sys/BinderBindings.hpp",
Stephen Crane994a0f02020-08-11 14:47:29 -070042 source_stem: "bindings",
Stephen Crane2a3c2502020-06-16 17:48:35 -070043 bindgen_flags: [
44 // Unfortunately the only way to specify the rust_non_exhaustive enum
45 // style for a type is to make it the default
46 "--default-enum-style", "rust_non_exhaustive",
47 // and then specify constified enums for the enums we don't want
48 // rustified
49 "--constified-enum", "android::c_interface::consts::.*",
50
51 "--whitelist-type", "android::c_interface::.*",
52 "--whitelist-type", "AStatus",
53 "--whitelist-type", "AIBinder_Class",
54 "--whitelist-type", "AIBinder",
55 "--whitelist-type", "AIBinder_Weak",
56 "--whitelist-type", "AIBinder_DeathRecipient",
57 "--whitelist-type", "AParcel",
58 "--whitelist-type", "binder_status_t",
59 "--whitelist-function", ".*",
60 ],
61 shared_libs: [
62 "libbinder_ndk",
63 ],
64 host_supported: true,
65
66 // Currently necessary for host builds
67 // TODO(b/31559095): bionic on host should define this
68 target: {
69 host: {
70 cflags: [
71 "-D__INTRODUCED_IN(n)=",
72 "-D__assert(a,b,c)=",
73 // We want all the APIs to be available on the host.
74 "-D__ANDROID_API__=10000",
75 ],
76 },
Yifan Hongf856a982020-10-30 14:51:17 -070077 darwin: {
78 enabled: false,
79 },
Stephen Crane2a3c2502020-06-16 17:48:35 -070080 },
81}
82
83rust_test {
84 name: "libbinder_rs-internal_test",
85 crate_name: "binder",
86 srcs: ["src/lib.rs"],
87 test_suites: ["general-tests"],
88 auto_gen_config: true,
89 shared_libs: [
90 "libbinder_ndk",
91 ],
92 rustlibs: [
93 "liblibc",
Stephen Crane994a0f02020-08-11 14:47:29 -070094 "libbinder_ndk_sys",
Stephen Crane2a3c2502020-06-16 17:48:35 -070095 ],
96}