Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 1 | rust_library { |
| 2 | name: "libbinder_rs", |
| 3 | crate_name: "binder", |
| 4 | srcs: ["src/lib.rs"], |
| 5 | shared_libs: [ |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 6 | "libutils", |
| 7 | ], |
| 8 | rustlibs: [ |
| 9 | "liblibc", |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 10 | "libbinder_ndk_sys", |
| 11 | ], |
| 12 | host_supported: true, |
| 13 | } |
| 14 | |
| 15 | rust_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 Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 24 | ], |
| 25 | host_supported: true, |
| 26 | } |
| 27 | |
| 28 | rust_bindgen { |
| 29 | name: "libbinder_ndk_bindgen", |
| 30 | crate_name: "binder_ndk_bindgen", |
Ivan Lozano | 7929c08 | 2020-09-23 13:33:42 -0400 | [diff] [blame] | 31 | wrapper_src: "sys/BinderBindings.hpp", |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 32 | source_stem: "bindings", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 33 | 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 | |
| 70 | rust_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 Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 81 | "libbinder_ndk_sys", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 82 | ], |
| 83 | } |