| # 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/rust:rustc_library.bzl", "rustc_library") | |
| load("//build/bazel/rules/rust:rustc_test.bzl", "rustc_test") | |
| load("//build/bazel/rules/testing:fx_unittest_package.bzl", "fx_unittest_package") | |
| package(default_applicable_licenses = ["//:license"]) | |
| rustc_library( | |
| name = "socket-to-stdio", | |
| srcs = ["src/lib.rs"], | |
| edition = "2024", | |
| visibility = [ | |
| "//src/developer/ffx/plugins:__subpackages__", | |
| "//src/sys/lib/component_debug:__pkg__", | |
| "//src/sys/tools/component:__pkg__", | |
| "//src/sys/tools/package:__pkg__", | |
| ], | |
| deps = [ | |
| "//src/lib/fdomain/client", | |
| "//third_party/rust_crates/vendor:anyhow", | |
| "//third_party/rust_crates/vendor:futures", | |
| "//third_party/rust_crates/vendor:termion", | |
| ] + select({ | |
| "@platforms//os:fuchsia": [ | |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", | |
| "//src/lib/fidl/rust/fidl", | |
| ], | |
| "//conditions:default": ["//sdk/fidl/fuchsia.io:fuchsia.io_rust_common"], | |
| }), | |
| ) | |
| rustc_test( | |
| name = "socket-to-stdio_test", | |
| crate = ":socket-to-stdio", | |
| # Preserves GN `output_name = "socket_to_stdio_lib_test"` for unit test packaging. | |
| crate_name = "socket_to_stdio_lib_test", | |
| target_compatible_with = ["@platforms//os:fuchsia"], | |
| deps = ["//src/lib/fuchsia"], | |
| ) | |
| fx_unittest_package( | |
| name = "socket-to-stdio-tests", | |
| unit_tests = [":socket-to-stdio_test"], | |
| visibility = ["//src/sys:__pkg__"], | |
| ) |