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