| # 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("@platforms//host:constraints.bzl", "HOST_CONSTRAINTS") |
| load("//build/bazel/rules/host_tests:host_test_data.bzl", "host_test_data_files") |
| load("//build/bazel/rules/rust:defs.bzl", "rustc_library") |
| |
| package(default_applicable_licenses = ["//:license"]) |
| |
| # @bazel2gn:skip |
| host_test_data_files( |
| name = "test_data_key_parsing", |
| srcs = [ |
| "testdata/key_parsing/key.pub", |
| "testdata/key_parsing/key_copy.pub", |
| "testdata/key_parsing/non_key", |
| "testdata/key_parsing/other_key.pub", |
| ], |
| dest_dir = "testdata/key_parsing", |
| ) |
| |
| # @bazel2gn:skip |
| host_test_data_files( |
| name = "test_data_only_private_key", |
| srcs = [ |
| "testdata/key_parsing/only_private_key/only_private", |
| ], |
| dest_dir = "testdata/key_parsing/only_private_key", |
| ) |
| |
| # @bazel2gn:skip |
| host_test_data_files( |
| name = "test_data_other_dir", |
| srcs = [ |
| "testdata/key_parsing/other_dir/key_other_copy.pub", |
| ], |
| dest_dir = "testdata/key_parsing/other_dir", |
| ) |
| |
| rustc_library( |
| name = "lib", |
| srcs = [ |
| "src/config.rs", |
| "src/keys.rs", |
| "src/lib.rs", |
| "src/parse.rs", |
| "src/ssh.rs", |
| ], |
| compile_data = [ |
| "default_ssh_config", |
| "testdata/test1_authorized_keys", |
| "testdata/test1_ed25519", |
| ], |
| crate_name = "ffx_ssh", |
| # @bazel2gn:skip |
| data = [ |
| ":test_data_key_parsing", |
| ":test_data_only_private_key", |
| ":test_data_other_dir", |
| ], |
| edition = "2024", |
| target_compatible_with = HOST_CONSTRAINTS, |
| # The unit test is built and run by Bazel only, see |
| # //src/developer/ffx:tests, so it is not synced back to GN. |
| # @bazel2gn:skip |
| test_deps = [ |
| "//src/lib/fuchsia", |
| "//third_party/rust_crates/vendor:assert_matches", |
| "//third_party/rust_crates/vendor:pretty_assertions", |
| "//third_party/rust_crates/vendor:tempfile", |
| ], |
| visibility = ["//src/developer/ffx:__subpackages__"], |
| with_host_unit_tests = True, # @bazel2gn:skip |
| deps = [ |
| "//src/developer/ffx/config:lib", |
| "//src/developer/ffx/lib/fho:lib", |
| "//src/developer/ffx/lib/netext:lib", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-sync", |
| "//third_party/rust_crates/vendor:anyhow", |
| "//third_party/rust_crates/vendor:base64", |
| "//third_party/rust_crates/vendor:chrono", |
| "//third_party/rust_crates/vendor:http-body-util", |
| "//third_party/rust_crates/vendor:hyper", |
| "//third_party/rust_crates/vendor:hyper-util", |
| "//third_party/rust_crates/vendor:log", |
| "//third_party/rust_crates/vendor:ring", |
| "//third_party/rust_crates/vendor:serde", |
| "//third_party/rust_crates/vendor:serde_json", |
| "//third_party/rust_crates/vendor:thiserror", |
| "//third_party/rust_crates/vendor:tokio", |
| ], |
| ) |