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