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