blob: a1c77ae1244ab32943208e0e355e0bd6111546df [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/packages:fx_package.bzl", "fx_package")
load(
"//build/bazel/rules/packages:fx_packaged_binary.bzl",
"fx_packaged_binary",
)
load("//build/bazel/rules/rust:rustc_binary.bzl", "rustc_binary")
load("//build/bazel/rules/rust:rustc_test.bzl", "rustc_test")
load("//build/bazel/rules/testing:fx_test.bzl", "fx_test")
load(
"//build/bazel/rules/testing:fx_unittest_component.bzl",
"fx_unittest_component",
)
package(default_applicable_licenses = ["//:license"])
test_suite(
name = "tests",
tests = [":factoryctl_tests"],
visibility = ["//src/factory:__pkg__"],
)
rustc_binary(
name = "bin",
srcs = ["src/main.rs"],
crate_name = "factoryctl",
edition = "2024",
rustc_flags = ["-Aunused_imports"],
tags = ["manual"],
deps = [
"//sdk/fidl/fuchsia.boot:fuchsia.boot_rust",
"//sdk/fidl/fuchsia.factory:fuchsia.factory_rust",
"//sdk/fidl/fuchsia.io:fuchsia.io_rust",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-fs",
"//third_party/rust_crates/vendor:anyhow",
"//third_party/rust_crates/vendor:clap",
"//third_party/rust_crates/vendor:futures",
"//third_party/rust_crates/vendor:nom",
],
)
fx_packaged_binary(
name = "factoryctl_packaged_bin",
binary = ":bin",
binary_name = "factoryctl",
)
fx_package(
name = "factoryctl",
resources = [":factoryctl_packaged_bin"],
)
rustc_test(
name = "factoryctl_bin_test",
crate = ":bin",
tags = ["manual"],
target_compatible_with = ["@platforms//os:fuchsia"],
deps = [
"//sdk/rust/zx",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component-test",
"//src/storage/lib/vfs/rust:vfs",
],
)
fx_unittest_component(
name = "factoryctl_tests_component",
binary = ":factoryctl_bin_test",
component_name = "factoryctl_tests",
)
fx_package(
name = "factoryctl_tests_package",
package_name = "factoryctl_tests",
testonly = True,
components = [
"//src/lib/fuchsia-component-test/realm_builder_server:realm_builder_server_component",
],
test_components = [":factoryctl_tests_component"],
)
fx_test(
name = "factoryctl_tests",
package = ":factoryctl_tests_package",
)