blob: bbd36e69cf9eabd7165fb0cc48b70061ab8a5ae3 [file] [log] [blame]
// Copyright (C) 2016 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
cc_library {
name: "libfmq",
shared_libs: [
"libbase",
"liblog",
"libcutils",
"libutils",
],
export_shared_lib_headers: [
"libcutils",
"libutils",
],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
],
export_include_dirs: ["include"],
local_include_dirs: ["include"],
header_libs: [
"libfmq-base",
],
export_header_lib_headers: [
"libfmq-base",
],
srcs: [
"EventFlag.cpp",
"FmqInternal.cpp",
],
cflags: [
"-Wall",
"-Werror",
],
vendor_available: true,
product_available: true,
// TODO(b/153609531): remove when no longer needed.
native_bridge_supported: true,
double_loadable: true,
min_sdk_version: "29",
host_supported: true,
}
// Header only lib to share type between HIDL and AIDL MQDescriptor
cc_library_headers {
name: "libfmq-base",
host_supported: true,
vendor_available: true,
product_available: true,
native_bridge_supported: true,
recovery_available: true,
apex_available: [
"//apex_available:anyapex",
"//apex_available:platform",
],
export_include_dirs: ["base"],
min_sdk_version: "29",
}
cc_library {
name: "libfmq_erased",
shared_libs: [
"libbase",
"liblog",
"libcutils",
"libfmq",
"android.hardware.common.fmq-V1-ndk",
],
srcs: [
"ErasedMessageQueue.cpp",
],
cflags: [
"-Wall",
"-Werror",
],
vendor_available: true,
product_available: true,
min_sdk_version: "29",
host_supported: true,
}
rust_bindgen {
name: "libfmq_bindgen",
wrapper_src: "ErasedMessageQueue.hpp",
crate_name: "fmq_bindgen",
edition: "2021",
host_supported: true,
vendor_available: true,
product_available: true,
visibility: [":__subpackages__"],
source_stem: "fmq",
bindgen_flags: [
"--no-recursive-allowlist",
"--use-core",
"--ctypes-prefix=core::ffi",
"--raw-line=#![no_std]",
"--raw-line=pub use android_hardware_common_fmq::aidl::android::hardware::common::fmq::{MQDescriptor::MQDescriptor, UnsynchronizedWrite::UnsynchronizedWrite, SynchronizedReadWrite::SynchronizedReadWrite, GrantorDescriptor::GrantorDescriptor};",
"--raw-line=pub use android_hardware_common::{aidl::android::hardware::common::NativeHandle::NativeHandle, binder::ParcelFileDescriptor};",
"--raw-line=pub enum android_MQErased {}",
"--raw-line=#[repr(C)]",
"--raw-line=pub struct aidl_android_hardware_common_fmq_GrantorDescriptor {",
"--raw-line= pub fdIndex: i32,",
"--raw-line= pub offset: i32,",
"--raw-line= pub extent: i64,",
"--raw-line=}",
"--opaque-type=ErasedMessageQueueDesc",
"--opaque-type=.*AidlMessageQueue",
"--with-derive-default",
"--no-default=MessageQueueDesc",
"--no-default=ErasedMessageQueue",
"--allowlist-function=convertGrantor",
"--allowlist-function=convertDesc",
"--allowlist-function=freeDesc",
"--allowlist-type=ndk::ScopedFileDescriptor",
"--allowlist-function=descGrantors",
"--allowlist-function=descNumGrantors",
"--allowlist-function=descHandleFDs",
"--allowlist-function=descHandleNumFDs",
"--allowlist-function=descHandleInts",
"--allowlist-function=descHandleNumInts",
"--allowlist-function=descQuantum",
"--allowlist-function=descFlags",
"--allowlist-type=\\bErasedMessageQueue",
"--allowlist-type=\\bErasedMessageQueueDesc",
"--allowlist-type=\\bMemTransaction",
"--allowlist-type=.*MemTransaction.*MemRegion.*",
"--blocklist-type=std::.+",
"--allowlist-function=.*ErasedMessageQueue.*",
"--allowlist-function=.*beginWrite",
"--allowlist-function=.*beginRead",
"--allowlist-function=.*commitWrite",
"--allowlist-function=.*commitRead",
"--allowlist-function=getAddress",
"--allowlist-function=getLength.*",
"--allowlist-function=get(First|Second)Region",
],
rustlibs: [
"android.hardware.common.fmq-V1-rust",
"android.hardware.common-V2-rust",
],
static_libs: [
"libfmq",
],
whole_static_libs: [
"libfmq_erased",
],
shared_libs: [
"libc++",
"liblog",
"android.hardware.common.fmq-V1-ndk",
],
apex_available: [
],
}
rust_test {
host_supported: true,
name: "libfmq_bindgen_test",
srcs: [":libfmq_bindgen"],
crate_name: "fmq_bindgen_test",
test_suites: ["general-tests"],
auto_gen_config: true,
clippy_lints: "none",
lints: "none",
rustlibs: [
"android.hardware.common.fmq-V1-rust",
"android.hardware.common-V2-rust",
],
}
rust_library {
name: "libfmq_rust",
host_supported: true,
vendor_available: true,
product_available: true,
visibility: [":__subpackages__"],
crate_name: "fmq",
srcs: ["libfmq.rs"],
edition: "2021",
rustlibs: [
"libfmq_bindgen",
"liblog_rust",
"libzerocopy",
],
proc_macros: [],
}