blob: c1f1288bf1034aa65d249518b45fcd06f248b9af [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/cc:fx_cc_binary.bzl", "fx_cc_binary")
load(
"//build/bazel/rules/components:fx_component.bzl",
"fx_component",
"fx_component_manifest",
)
load("//build/bazel/rules/packages:fx_package.bzl", "fx_package")
load(
"//build/bazel/rules/packages:fx_packaged_binary.bzl",
"fx_packaged_binary",
)
package(default_applicable_licenses = ["//:license"])
# [START bin]
fx_cc_binary(
name = "bin",
srcs = ["main.cc"],
gn_output_name = "fidl_echo_cpp_wire_server",
# Uses Fuchsia-only FIDL headers and //sdk/lib/component/outgoing/cpp.
target_compatible_with = ["@platforms//os:fuchsia"],
deps = [
"//examples/fidl/fuchsia.examples:fuchsia.examples_cpp",
"//sdk/lib/async-loop:async-loop-cpp",
"//sdk/lib/component/outgoing/cpp",
"//sdk/lib/syslog/cpp",
],
)
# [END bin]
fx_packaged_binary(
name = "bin_packaged",
binary = ":bin",
binary_name = "fidl_echo_cpp_wire_server",
target_compatible_with = ["@platforms//os:fuchsia"],
)
# [START rest]
fx_component_manifest(
name = "echo-server_manifest",
component_name = "echo_server",
includes = ["//sdk/lib/syslog:client.shard"],
manifest = "meta/server.cml",
target_compatible_with = ["@platforms//os:fuchsia"],
)
# Declare a component for the server, which consists of the manifest and the
# binary that the component will run.
fx_component(
name = "echo-server",
compiled_manifest = ":echo-server_manifest",
target_compatible_with = ["@platforms//os:fuchsia"],
visibility = [
"//examples/fidl/cpp/client/wire:__pkg__",
"//examples/fidl/cpp/client_sync/wire:__pkg__",
"//examples/fidl/echo-realm:__pkg__",
],
deps = [":bin_packaged"],
)
# Declare a package that contains a single component, our server.
fx_package(
name = "echo-cpp-wire-server",
components = [":echo-server"],
visibility = ["//examples/fidl/cpp:__pkg__"],
)
# [END rest]