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