blob: 5c5c343a47693af47a0136653093441f98efaadb [file]
# Copyright 2026 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
load("//build/bazel/rules/idk:idk_cc_source_library.bzl", "idk_cc_source_library")
# Limit visibility for the HLCPP bindings libraries.
# This is primarily locations where libraries with `enable_hlcpp = True` are defined.
# @bazel2gn:transformer=visibility
hlcpp_bindings_libraries_visibility = [
"//build/sdk:__pkg__",
"//examples/components/routing/fidl:__pkg__",
"//examples/components/services/fidl:__pkg__",
"//examples/diagnostics/inspect/codelab/fidl:__pkg__",
"//examples/fidl/fuchsia.examples:__pkg__",
"//examples/intl/wisdom/fidl:__pkg__",
"//sdk:__pkg__",
"//sdk/ctf/tests/examples/fidl/fuchsia.examples/testing/fidl:__pkg__",
"//sdk/ctf/tests/fidl/fuchsia.element/testing/fidl:__pkg__",
"//sdk/ctf/tests/fidl/fuchsia.settings/testing/fidl:__pkg__",
"//sdk/ctf/tests/pkg/fidl/cpp:__pkg__",
"//sdk/fidl:__subpackages__",
"//sdk/lib/component/tests:__pkg__",
"//sdk/lib/driver/power/cpp/testing:__pkg__",
"//sdk/lib/fidl/cpp/tests/hlcpp_conversion/fidl:__pkg__",
"//sdk/lib/fidl/hlcpp:__pkg__",
"//sdk/lib/fuzzing/cpp:__pkg__",
"//sdk/testing/fidl:__pkg__",
"//sdk/testing/fidl/protocols_tests:__pkg__",
"//sdk/testing/fidl/types_tests:__pkg__",
"//src/camera/bin/camera-gym/fidl:__pkg__",
"//src/camera/bin/device_watcher:__pkg__",
"//src/camera/bin/factory:__pkg__",
"//src/camera/bin/virtual_camera:__pkg__",
"//src/connectivity/bluetooth/lib/fidl:__pkg__",
"//src/connectivity/ethernet/drivers/asix-88179:__pkg__",
"//src/connectivity/network/testing/netemul/network-context/fidl:__pkg__",
"//src/connectivity/network/testing/netemul/sync-manager/fidl:__pkg__",
"//src/developer/forensics/exceptions/fidl:__pkg__",
"//src/developer/forensics/public/fakes:__pkg__",
"//src/diagnostics/validator/inspect/fidl:__pkg__",
"//src/diagnostics/validator/logs/fidl:__pkg__",
"//src/lib/fake-clock/fidl:__pkg__",
"//src/lib/fake-clock/named-timer:__pkg__",
"//src/lib/fidl_codec:__pkg__",
"//src/lib/fidl/c/coding_tables_tests:__pkg__",
"//src/lib/fidl/c/walker_tests:__pkg__",
"//src/lib/fostr:__pkg__",
"//src/lib/fostr/test/fuchsia.example.fostr:__pkg__",
"//src/lib/fostr/test/fuchsia.example.fostr2:__pkg__",
"//src/lib/fsl/types:__pkg__",
"//src/lib/intl/examples:__pkg__",
"//src/lib/intl/intl_property_provider_impl:__pkg__",
"//src/lib/intl/lookup/rust:__pkg__",
"//src/lib/ui/input-synthesis:__pkg__",
"//src/power/fidl/testing:__pkg__",
"//src/sys/component_manager/tests/structured_config/fidl:__pkg__",
"//src/sys/fuzzing/fidl:__pkg__",
"//src/sys/fuzzing/libfuzzer/testing:__pkg__",
"//src/sys/test_manager/fidl/fuchsia.test.debug:__pkg__",
"//src/testing/fidl:__pkg__",
"//src/tests/benchmarks/fidl/benchmark_suite:__pkg__",
"//src/tests/fidl/compatibility/fidl:__pkg__",
"//src/tests/fidl/conformance_suite:__pkg__",
"//src/tests/fidl/dangerous_identifiers:__pkg__",
"//src/tests/fidl/dynsuite/client_suite/fidl:__pkg__",
"//src/tests/fidl/dynsuite/server_suite/fidl:__pkg__",
"//src/tests/microbenchmarks:__pkg__",
"//src/ui/a11y/lib/screen_reader/i18n:__pkg__",
"//src/ui/a11y/lib/semantics/util:__pkg__",
"//src/ui/a11y/testing/fidl:__pkg__",
"//tools/fidl/measure-tape/testdata:__pkg__",
"//tools/fidl/fidlc/testdata:__subpackages__",
"//vendor:__subpackages__",
]
# The complete high-level C++ bindings library supporting both asynchronous
# and synchronous APIs.
idk_cc_source_library(
name = "hlcpp",
srcs = [
"internal/message_handler.cc",
"internal/message_reader.cc",
"internal/pending_response.cc",
"internal/proxy.cc",
"internal/proxy_controller.cc",
"internal/stub.cc",
"internal/stub_controller.cc",
"internal/unknown_interactions_table.c",
"internal/weak_stub_controller.cc",
"unknown_interactions_hlcpp.cc",
],
hdrs = [
"include/lib/fidl/cpp/binding.h",
"include/lib/fidl/cpp/binding_set.h",
"include/lib/fidl/cpp/event_sender.h",
"include/lib/fidl/cpp/interface_ptr.h",
"include/lib/fidl/cpp/interface_ptr_set.h",
"include/lib/fidl/cpp/internal/canary.h",
"include/lib/fidl/cpp/internal/header.h",
"include/lib/fidl/cpp/internal/implementation.h",
"include/lib/fidl/cpp/internal/message_handler.h",
"include/lib/fidl/cpp/internal/message_reader.h",
"include/lib/fidl/cpp/internal/pending_response.h",
"include/lib/fidl/cpp/internal/proxy.h",
"include/lib/fidl/cpp/internal/proxy_controller.h",
"include/lib/fidl/cpp/internal/stub.h",
"include/lib/fidl/cpp/internal/stub_controller.h",
"include/lib/fidl/cpp/internal/unknown_interactions_table.h",
"include/lib/fidl/cpp/internal/weak_stub_controller.h",
"include/lib/fidl/cpp/member_connector.h",
"include/lib/fidl/cpp/service_connector.h",
"include/lib/fidl/cpp/service_handler_base.h",
"include/lib/fidl/cpp/type_converter.h",
"include/lib/fidl/cpp/unknown_interactions_hlcpp.h",
],
api_area = "FIDL",
category = "partner",
idk_name = "fidl_cpp",
public_configs = [":config"], # For bazel2gn.
stable = True,
target_compatible_with = ["@platforms//os:fuchsia"],
visibility = hlcpp_bindings_libraries_visibility,
deps = [
":hlcpp_sync",
"//sdk/lib/async",
"//sdk/lib/async-default",
"//sdk/lib/fidl",
"//sdk/lib/fit",
"//sdk/lib/fit-promise",
"//zircon/system/ulib/zx",
],
)
# The synchronous high-level C++ bindings library.
idk_cc_source_library(
name = "hlcpp_sync",
srcs = [
"internal/logging.cc",
"internal/message_sender.cc",
"internal/synchronous_proxy.cc",
],
hdrs = [
"include/lib/fidl/cpp/internal/logging.h",
"include/lib/fidl/cpp/internal/message_sender.h",
"include/lib/fidl/cpp/internal/synchronous_proxy.h",
"include/lib/fidl/cpp/synchronous_interface_ptr.h",
],
api_area = "FIDL",
category = "partner",
idk_name = "fidl_cpp_sync",
public_configs = [":config"], # For bazel2gn.
stable = True,
target_compatible_with = ["@platforms//os:fuchsia"],
visibility = [
"//src/tests/fidl/dynsuite/client_suite:__subpackages__",
# In Bazel, targets are always visible in the current directory. In GN,
# this must be specified. Also, in Bazel, the IDK paths are automatically
# added to the atom sub-target's visibility, but they are not in GN.
# Overwrite a superfluous private visibility with the paths necessary in GN.
"//visibility:private", # @bazel2gn:raw_overwrite:":*", "//build/sdk:*"
],
deps = [
":hlcpp_base",
"//sdk/lib/fidl",
"//sdk/lib/fit",
"//zircon/system/ulib/zx",
],
)
# The base library used to implement the natural domain-object types.
# It should not contain message dispatching functionality.
# buildifier: leave-alone - Do not sort `fuchsia_*`.
idk_cc_source_library(
name = "hlcpp_base",
srcs = [
"clone.cc",
"decoder.cc",
"encoder.cc",
"message.cc",
"message_buffer.cc",
],
hdrs = [
"include/lib/fidl/cpp/clone.h",
"include/lib/fidl/cpp/coding_traits.h",
"include/lib/fidl/cpp/comparison.h",
"include/lib/fidl/cpp/decoder.h",
"include/lib/fidl/cpp/encoder.h",
"include/lib/fidl/cpp/enum.h",
"include/lib/fidl/cpp/internal/bitset.h",
"include/lib/fidl/cpp/internal/header.h",
"include/lib/fidl/cpp/internal/implementation.h",
"include/lib/fidl/cpp/internal/logging.h",
"include/lib/fidl/cpp/internal/natural_types_header.h",
"include/lib/fidl/cpp/internal/natural_types_implementation.h",
"include/lib/fidl/cpp/internal/unknown_interactions_table.h",
"include/lib/fidl/cpp/message.h",
"include/lib/fidl/cpp/message_buffer.h",
"include/lib/fidl/cpp/message_part.h",
"include/lib/fidl/cpp/string.h",
"include/lib/fidl/cpp/traits.h",
"include/lib/fidl/cpp/types.h",
"include/lib/fidl/cpp/unknown_interactions_hlcpp.h",
"include/lib/fidl/cpp/vector.h",
] + select({
"@platforms//os:fuchsia": [
"include/lib/fidl/cpp/interface_handle.h",
"include/lib/fidl/cpp/interface_request.h",
],
"//conditions:default": [],
}),
api_area = "FIDL",
category = "partner",
idk_name = "fidl_cpp_base",
public_configs = [":config"], # For bazel2gn.
stable = True,
visibility = hlcpp_bindings_libraries_visibility,
deps = [
"//sdk/lib/fidl_base",
"//sdk/lib/fit",
"//sdk/lib/fit-promise",
"//sdk/lib/zircon-assert",
],
fuchsia_deps = [
"//sdk/lib/fidl",
"//zircon/system/ulib/zx",
],
)
package(default_applicable_licenses = ["//:license"])