blob: 16811eebe4bcf0d315dd860ef8e4c78a07db1d18 [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: [
6 "libbinder_ndk",
7 "libutils",
8 ],
9 rustlibs: [
10 "liblibc",
11 "libbinder_ndk_bindgen",
12 ],
13 host_supported: true,
14}
15
16rust_bindgen {
17 name: "libbinder_ndk_bindgen",
18 crate_name: "binder_ndk_bindgen",
19 wrapper_src: "BinderBindings.h",
20 source_stem: "ndk_bindings",
21 cflags: [
22 "-x c++",
23 ],
24 bindgen_flags: [
25 // Unfortunately the only way to specify the rust_non_exhaustive enum
26 // style for a type is to make it the default
27 "--default-enum-style", "rust_non_exhaustive",
28 // and then specify constified enums for the enums we don't want
29 // rustified
30 "--constified-enum", "android::c_interface::consts::.*",
31
32 "--whitelist-type", "android::c_interface::.*",
33 "--whitelist-type", "AStatus",
34 "--whitelist-type", "AIBinder_Class",
35 "--whitelist-type", "AIBinder",
36 "--whitelist-type", "AIBinder_Weak",
37 "--whitelist-type", "AIBinder_DeathRecipient",
38 "--whitelist-type", "AParcel",
39 "--whitelist-type", "binder_status_t",
40 "--whitelist-function", ".*",
41 ],
42 shared_libs: [
43 "libbinder_ndk",
44 ],
45 host_supported: true,
46
47 // Currently necessary for host builds
48 // TODO(b/31559095): bionic on host should define this
49 target: {
50 host: {
51 cflags: [
52 "-D__INTRODUCED_IN(n)=",
53 "-D__assert(a,b,c)=",
54 // We want all the APIs to be available on the host.
55 "-D__ANDROID_API__=10000",
56 ],
57 },
58 },
59}
60
61rust_test {
62 name: "libbinder_rs-internal_test",
63 crate_name: "binder",
64 srcs: ["src/lib.rs"],
65 test_suites: ["general-tests"],
66 auto_gen_config: true,
67 shared_libs: [
68 "libbinder_ndk",
69 ],
70 rustlibs: [
71 "liblibc",
72 "libbinder_ndk_bindgen",
73 ],
74}