1package { 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 10rust_library { 11 name: "librpcbinder_rs", 12 crate_name: "rpcbinder", 13 srcs: ["src/lib.rs"], 14 shared_libs: [ 15 "libutils", 16 ], 17 rustlibs: [ 18 "libbinder_ndk_sys", 19 "libbinder_rpc_unstable_bindgen_sys", 20 "libbinder_rs", 21 "libcfg_if", 22 "libdowncast_rs", 23 "libforeign_types", 24 "liblibc", 25 "liblog_rust", 26 ], 27 visibility: [ 28 "//device/google/cuttlefish/shared/minidroid/sample", 29 "//packages/modules/Virtualization:__subpackages__", 30 ], 31 apex_available: [ 32 "//apex_available:platform", 33 "com.android.compos", 34 "com.android.microfuchsia", 35 "com.android.uwb", 36 "com.android.virt", 37 ], 38 min_sdk_version: "Tiramisu", 39} 40 41// Build a separate rust_library rather than depending directly on libbinder_rpc_unstable_bindgen, 42// to work around the fact that rust_bindgen targets only produce rlibs and not dylibs, which would 43// result in duplicate conflicting versions of libbinder_ndk_sys. This will hopefully be fixed in 44// the build system, at which point we can delete this target and go back to using 45// libbinder_rpc_unstable_bindgen directly. 46rust_library { 47 name: "libbinder_rpc_unstable_bindgen_sys", 48 crate_name: "binder_rpc_unstable_bindgen", 49 srcs: [ 50 ":libbinder_rpc_unstable_bindgen", 51 ], 52 visibility: [":__subpackages__"], 53 rustlibs: [ 54 "libbinder_ndk_sys", 55 ], 56 shared_libs: [ 57 "libbinder_rpc_unstable", 58 "libutils", 59 ], 60 apex_available: [ 61 "//apex_available:platform", 62 "com.android.compos", 63 "com.android.microfuchsia", 64 "com.android.uwb", 65 "com.android.virt", 66 ], 67 min_sdk_version: "Tiramisu", 68 lints: "none", 69 clippy_lints: "none", 70} 71 72// TODO(b/184872979): remove once the RPC Binder API is stabilised. 73rust_bindgen { 74 name: "libbinder_rpc_unstable_bindgen", 75 wrapper_src: "BinderBindings.hpp", 76 crate_name: "binder_rpc_unstable_bindgen", 77 visibility: [":__subpackages__"], 78 source_stem: "bindings", 79 bindgen_flags: [ 80 "--blocklist-type", 81 "AIBinder", 82 "--raw-line", 83 "use binder_ndk_sys::AIBinder;", 84 "--rustified-enum", 85 "ARpcSession_FileDescriptorTransportMode", 86 ], 87 rustlibs: [ 88 "libbinder_ndk_sys", 89 ], 90 shared_libs: [ 91 "libbinder_rpc_unstable", 92 "libutils", 93 ], 94 apex_available: [ 95 "//apex_available:platform", 96 "com.android.compos", 97 "com.android.microfuchsia", 98 "com.android.uwb", 99 "com.android.virt", 100 ], 101 min_sdk_version: "Tiramisu", 102} 103 104rust_test { 105 name: "libbinder_rpc_unstable_bindgen_test", 106 srcs: [":libbinder_rpc_unstable_bindgen"], 107 crate_name: "binder_rpc_unstable_bindgen", 108 rustlibs: [ 109 "libbinder_ndk_sys", 110 ], 111 test_suites: ["general-tests"], 112 auto_gen_config: true, 113 clippy_lints: "none", 114 lints: "none", 115} 116