blob: 90cbf9d45dfbd0888057d38c2e9eb39f29c2efb5 [file] [log] [blame]
package {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "frameworks_native_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["frameworks_native_license"],
}
rust_library {
name: "libbinder_rs",
crate_name: "binder",
srcs: ["src/lib.rs"],
shared_libs: [
"libutils",
],
rustlibs: [
"liblibc",
"libbinder_ndk_sys",
"libdowncast_rs",
],
host_supported: true,
vendor_available: true,
target: {
darwin: {
enabled: false,
},
},
apex_available: [
"//apex_available:platform",
"com.android.compos",
"com.android.uwb",
"com.android.virt",
],
min_sdk_version: "Tiramisu",
}
rust_library {
name: "libbinder_tokio_rs",
crate_name: "binder_tokio",
srcs: ["binder_tokio/lib.rs"],
rustlibs: [
"libbinder_rs",
"libtokio",
],
host_supported: true,
target: {
darwin: {
enabled: false,
},
},
apex_available: [
"//apex_available:platform",
"com.android.compos",
"com.android.virt",
],
}
rust_library {
name: "libbinder_ndk_sys",
crate_name: "binder_ndk_sys",
srcs: [
"sys/lib.rs",
":libbinder_ndk_bindgen",
],
shared_libs: [
"libbinder_ndk",
],
host_supported: true,
vendor_available: true,
target: {
darwin: {
enabled: false,
},
},
apex_available: [
"//apex_available:platform",
"com.android.compos",
"com.android.uwb",
"com.android.virt",
],
min_sdk_version: "Tiramisu",
lints: "none",
clippy_lints: "none",
}
rust_bindgen {
name: "libbinder_ndk_bindgen",
crate_name: "binder_ndk_bindgen",
wrapper_src: "sys/BinderBindings.hpp",
source_stem: "bindings",
bindgen_flags: [
// Unfortunately the only way to specify the rust_non_exhaustive enum
// style for a type is to make it the default
"--default-enum-style",
"rust_non_exhaustive",
// and then specify constified enums for the enums we don't want
// rustified
"--constified-enum",
"android::c_interface::consts::.*",
"--allowlist-type",
"android::c_interface::.*",
"--allowlist-type",
"AStatus",
"--allowlist-type",
"AIBinder_Class",
"--allowlist-type",
"AIBinder",
"--allowlist-type",
"AIBinder_Weak",
"--allowlist-type",
"AIBinder_DeathRecipient",
"--allowlist-type",
"AParcel",
"--allowlist-type",
"binder_status_t",
"--allowlist-function",
".*",
],
shared_libs: [
"libbinder_ndk",
],
host_supported: true,
vendor_available: true,
// Currently necessary for host builds
// TODO(b/31559095): bionic on host should define this
target: {
darwin: {
enabled: false,
},
},
apex_available: [
"//apex_available:platform",
"com.android.compos",
"com.android.uwb",
"com.android.virt",
],
min_sdk_version: "Tiramisu",
}
// TODO(b/184872979): remove once the Rust API is created.
rust_bindgen {
name: "libbinder_rpc_unstable_bindgen",
wrapper_src: ":libbinder_rpc_unstable_header",
crate_name: "binder_rpc_unstable_bindgen",
source_stem: "bindings",
shared_libs: [
"libutils",
],
apex_available: [
"com.android.compos",
"com.android.uwb",
"com.android.virt",
],
min_sdk_version: "Tiramisu",
}
rust_test {
name: "libbinder_rs-internal_test",
crate_name: "binder",
srcs: ["src/lib.rs"],
test_suites: ["general-tests"],
auto_gen_config: true,
shared_libs: [
"libbinder_ndk",
],
rustlibs: [
"liblibc",
"libbinder_ndk_sys",
"libdowncast_rs",
],
}
rust_test {
name: "libbinder_ndk_bindgen_test",
srcs: [":libbinder_ndk_bindgen"],
crate_name: "binder_ndk_bindgen",
test_suites: ["general-tests"],
auto_gen_config: true,
clippy_lints: "none",
lints: "none",
}
rust_test {
name: "libbinder_rpc_unstable_bindgen_test",
srcs: [":libbinder_rpc_unstable_bindgen"],
crate_name: "binder_rpc_unstable_bindgen",
test_suites: ["general-tests"],
auto_gen_config: true,
clippy_lints: "none",
lints: "none",
}