| 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, | 
| Yifan Hong | f856a98 | 2020-10-30 14:51:17 -0700 | [diff] [blame] | 13 | target: { | 
|  | 14 | darwin: { | 
|  | 15 | enabled: false, | 
|  | 16 | } | 
|  | 17 | } | 
| Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 18 | } | 
|  | 19 |  | 
|  | 20 | rust_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 Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 29 | ], | 
|  | 30 | host_supported: true, | 
| Yifan Hong | f856a98 | 2020-10-30 14:51:17 -0700 | [diff] [blame] | 31 | target: { | 
|  | 32 | darwin: { | 
|  | 33 | enabled: false, | 
|  | 34 | } | 
|  | 35 | } | 
| Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 36 | } | 
|  | 37 |  | 
|  | 38 | rust_bindgen { | 
|  | 39 | name: "libbinder_ndk_bindgen", | 
|  | 40 | crate_name: "binder_ndk_bindgen", | 
| Ivan Lozano | 7929c08 | 2020-09-23 13:33:42 -0400 | [diff] [blame] | 41 | wrapper_src: "sys/BinderBindings.hpp", | 
| Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 42 | source_stem: "bindings", | 
| Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 43 | 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 Hong | f856a98 | 2020-10-30 14:51:17 -0700 | [diff] [blame] | 77 | darwin: { | 
|  | 78 | enabled: false, | 
|  | 79 | }, | 
| Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 80 | }, | 
|  | 81 | } | 
|  | 82 |  | 
|  | 83 | rust_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 Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 94 | "libbinder_ndk_sys", | 
| Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 95 | ], | 
|  | 96 | } |