blob: 3a03e8bf5c825986726e35076f4ecb4269d4a179 [file] [log] [blame]
# Copyright 2024 The Fuchsia Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//src/lib/android/aidl/aidl.gni")
group("tests") {
testonly = true
deps = [ "rust:tests" ]
}
aidl_cpp("libbinder") {
is_bootstrap = true
base = "//third_party/android/platform/frameworks/native/libs/binder/aidl"
parcelables = [
"//third_party/android/platform/frameworks/native/libs/binder/aidl/android/os/ConnectionInfo.aidl",
"//third_party/android/platform/frameworks/native/libs/binder/aidl/android/os/Service.aidl",
"//third_party/android/platform/frameworks/native/libs/binder/aidl/android/os/ServiceWithMetadata.aidl",
"//third_party/android/platform/frameworks/native/libs/binder/aidl/android/os/ServiceDebugInfo.aidl",
]
interfaces = [
"//third_party/android/platform/frameworks/native/libs/binder/aidl/android/os/IClientCallback.aidl",
"//third_party/android/platform/frameworks/native/libs/binder/aidl/android/os/IServiceCallback.aidl",
"//third_party/android/platform/frameworks/native/libs/binder/aidl/android/os/IServiceManager.aidl",
]
}
aidl_cpp("libbinder_accessor") {
is_bootstrap = true
base = "//third_party/android/platform/frameworks/native/libs/binder/aidl"
interfaces = [ "//third_party/android/platform/frameworks/native/libs/binder/aidl/android/os/IAccessor.aidl" ]
}
config("binder_config") {
include_dirs = [
"include",
"//third_party/android/platform/frameworks/native/libs/binder/include",
"//third_party/android/platform/frameworks/native/libs/binder/ndk/include_ndk",
"//third_party/android/platform/frameworks/native/libs/binder/ndk/include_platform",
"//third_party/android/platform/frameworks/native/libs/binder/ndk/include_cpp",
]
configs = [
"//src/lib/android:android_config",
# TODO(https://fxbug.dev/42085293): delete the below and fix compiler warnings
"//build/config:Wno-vla-cxx-extension",
]
defines = [
# "libbinder_addservice_cache_flag" upstream.
"LIBBINDER_ADDSERVICE_CACHE",
# "libbinder_client_cache_flag" upstream.
"LIBBINDER_CLIENT_CACHE",
# "libbinder_remove_cache_static_list_flag" upstream.
"LIBBINDER_REMOVE_CACHE_STATIC_LIST",
]
}
binder_source_base =
"//third_party/android/platform/frameworks/native/libs/binder/"
source_set("binder") {
header_files = [
"Binder.h",
"BinderService.h",
"BpBinder.h",
"Common.h",
"Delegate.h",
"Enums.h",
"Functional.h",
"IBinder.h",
"IInterface.h",
"IMemory.h",
"IResultReceiver.h",
"IShellCallback.h",
"LazyServiceRegistrar.h",
"MemoryBase.h",
"MemoryDealer.h",
"MemoryHeapBase.h",
"Parcelable.h",
"ParcelableHolder.h",
"ParcelFileDescriptor.h",
"Parcel.h",
"PersistableBundle.h",
"RecordedTransaction.h",
"RpcCertificateFormat.h",
"RpcKeyFormat.h",
"RpcServer.h",
"RpcSession.h",
"RpcThreads.h",
"RpcTransport.h",
"RpcTransportRaw.h",
"SafeInterface.h",
"Stability.h",
"Status.h",
"TextOutput.h",
"Trace.h",
"unique_fd.h",
]
source_files = [
"Binder.cpp",
"BpBinder.cpp",
"Debug.cpp",
"FdTrigger.cpp",
"IInterface.cpp",
"IResultReceiver.cpp",
"OS_android.cpp",
"OS_unix_base.cpp",
"Parcel.cpp",
"ParcelFileDescriptor.cpp",
"RecordedTransaction.cpp",
"RpcServer.cpp",
"RpcSession.cpp",
"RpcState.cpp",
"RpcTransportRaw.cpp",
"Stability.cpp",
"Status.cpp",
"TextOutput.cpp",
"Utils.cpp",
"ndk/ibinder.cpp",
"ndk/libbinder.cpp",
"ndk/parcel.cpp",
"ndk/process.cpp",
"ndk/service_manager.cpp",
"ndk/stability.cpp",
"ndk/status.cpp",
]
if (is_fuchsia) {
defines = [ "BINDER_WITH_KERNEL_IPC" ]
header_files += [
"ProcessState.h",
"IPCThreadState.h",
"IServiceManager.h",
]
source_files += [
"BackendUnifiedServiceManager.cpp",
"BufferedTextOutput.cpp",
"IPCThreadState.cpp",
"IServiceManager.cpp",
"ProcessState.cpp",
"Static.cpp",
]
}
public = rebase_path(header_files, "", binder_source_base + "include/binder")
sources = rebase_path(source_files, "", binder_source_base)
# These headers:
# "IPermissionController.h",
# "PermissionCache.h",
# "PermissionController.h",
# and corresponding source files:
# "IPermissionController.cpp",
# "PermissionCache.cpp",
# "PermissionController.cpp",
# Are intentionally omitted and will be moved out of the binder library at some
# point in the future. See b/183654927 and binder's Android.bp for details.
aidl_target_outputs = get_target_outputs(":libbinder_aidl") +
get_target_outputs(":libbinder_accessor_aidl")
foreach(f, aidl_target_outputs) {
name = get_path_info(f, "name")
if (name != "aidl_package" && name != "aidl_rust_glue_args" &&
name != "aidl_bases") {
sources += [ f ]
}
}
public_deps = [
"//src/lib/android/bionic_compat",
"//src/lib/android/core",
"//src/lib/android/libbase",
]
deps = [
":libbinder",
":libbinder_accessor",
]
public_configs = [
":binder_config",
":libbinder_include",
]
configs += [
":libbinder_accessor_include",
"//src/lib/android:android_config_no_thread_safety_analysis",
]
cflags_cc = [
# See https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=130665 for explanation.
"-fno-sanitize=alignment",
# IPCThreadState.cpp contains unused variables.
"-Wno-unused-variable",
]
include_dirs = [ binder_source_base ]
if (is_host) {
cflags_cc += [
# Parcel.cpp contains unused functions in the host build
"-Wno-unused-function",
]
}
}
# Temporary library to support the unstable Rust API bindings.
# TODO: Once b/184872979 is resolved, this should no longer be needed
source_set("libbinder_rpc_unstable") {
source_files = [ "libbinder_rpc_unstable.cpp" ]
sources = rebase_path(source_files, "", binder_source_base)
include_dirs = [
binder_source_base,
binder_source_base + "/include_rpc_unstable",
"src/paravirtualization/vsock/lib",
]
deps = [ ":binder" ]
}