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 | } |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame^] | 17 | }, |
| 18 | apex_available: [ |
| 19 | "//apex_available:platform", |
| 20 | "com.android.virt", |
| 21 | ], |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | rust_library { |
| 25 | name: "libbinder_ndk_sys", |
| 26 | crate_name: "binder_ndk_sys", |
| 27 | srcs: [ |
| 28 | "sys/lib.rs", |
| 29 | ":libbinder_ndk_bindgen", |
| 30 | ], |
| 31 | shared_libs: [ |
| 32 | "libbinder_ndk", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 33 | ], |
| 34 | host_supported: true, |
Yifan Hong | f856a98 | 2020-10-30 14:51:17 -0700 | [diff] [blame] | 35 | target: { |
| 36 | darwin: { |
| 37 | enabled: false, |
| 38 | } |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame^] | 39 | }, |
| 40 | apex_available: [ |
| 41 | "//apex_available:platform", |
| 42 | "com.android.virt", |
| 43 | ], |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | rust_bindgen { |
| 47 | name: "libbinder_ndk_bindgen", |
| 48 | crate_name: "binder_ndk_bindgen", |
Ivan Lozano | 7929c08 | 2020-09-23 13:33:42 -0400 | [diff] [blame] | 49 | wrapper_src: "sys/BinderBindings.hpp", |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 50 | source_stem: "bindings", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 51 | bindgen_flags: [ |
| 52 | // Unfortunately the only way to specify the rust_non_exhaustive enum |
| 53 | // style for a type is to make it the default |
| 54 | "--default-enum-style", "rust_non_exhaustive", |
| 55 | // and then specify constified enums for the enums we don't want |
| 56 | // rustified |
| 57 | "--constified-enum", "android::c_interface::consts::.*", |
| 58 | |
| 59 | "--whitelist-type", "android::c_interface::.*", |
| 60 | "--whitelist-type", "AStatus", |
| 61 | "--whitelist-type", "AIBinder_Class", |
| 62 | "--whitelist-type", "AIBinder", |
| 63 | "--whitelist-type", "AIBinder_Weak", |
| 64 | "--whitelist-type", "AIBinder_DeathRecipient", |
| 65 | "--whitelist-type", "AParcel", |
| 66 | "--whitelist-type", "binder_status_t", |
| 67 | "--whitelist-function", ".*", |
| 68 | ], |
| 69 | shared_libs: [ |
| 70 | "libbinder_ndk", |
| 71 | ], |
| 72 | host_supported: true, |
| 73 | |
| 74 | // Currently necessary for host builds |
| 75 | // TODO(b/31559095): bionic on host should define this |
| 76 | target: { |
| 77 | host: { |
| 78 | cflags: [ |
| 79 | "-D__INTRODUCED_IN(n)=", |
| 80 | "-D__assert(a,b,c)=", |
| 81 | // We want all the APIs to be available on the host. |
| 82 | "-D__ANDROID_API__=10000", |
| 83 | ], |
| 84 | }, |
Yifan Hong | f856a98 | 2020-10-30 14:51:17 -0700 | [diff] [blame] | 85 | darwin: { |
| 86 | enabled: false, |
| 87 | }, |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 88 | }, |
Jiyong Park | b1af783 | 2021-02-16 13:30:57 +0900 | [diff] [blame^] | 89 | apex_available: [ |
| 90 | "//apex_available:platform", |
| 91 | "com.android.virt", |
| 92 | ], |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | rust_test { |
| 96 | name: "libbinder_rs-internal_test", |
| 97 | crate_name: "binder", |
| 98 | srcs: ["src/lib.rs"], |
| 99 | test_suites: ["general-tests"], |
| 100 | auto_gen_config: true, |
| 101 | shared_libs: [ |
| 102 | "libbinder_ndk", |
| 103 | ], |
| 104 | rustlibs: [ |
| 105 | "liblibc", |
Stephen Crane | 994a0f0 | 2020-08-11 14:47:29 -0700 | [diff] [blame] | 106 | "libbinder_ndk_sys", |
Stephen Crane | 2a3c250 | 2020-06-16 17:48:35 -0700 | [diff] [blame] | 107 | ], |
| 108 | } |