| # 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_packaged_binary.bzl", | |
| "fx_packaged_binary", | |
| ) | |
| 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"]) | |
| # `update` is conceptually a binary, but it built as a lib here so it can be | |
| # aggregated into //src/sys/pkg/bin/multi-universal-tool to save disk space. | |
| rustc_library( | |
| name = "lib", | |
| srcs = [ | |
| "src/args.rs", | |
| "src/channel.rs", | |
| "src/check.rs", | |
| "src/commit.rs", | |
| "src/install.rs", | |
| "src/main.rs", | |
| "src/monitor_state.rs", | |
| "src/monitor_updates.rs", | |
| "src/revert.rs", | |
| ], | |
| crate_name = "update", | |
| crate_root = "src/main.rs", | |
| edition = "2024", | |
| lint_config = "//build/config/rust/lints:clippy_warn_all", | |
| visibility = ["//src/sys/pkg/bin/multi-universal-tool:__pkg__"], | |
| deps = [ | |
| "//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol_rust", | |
| "//sdk/fidl/fuchsia.paver:fuchsia.paver_rust", | |
| "//sdk/fidl/fuchsia.update.channel:fuchsia.update.channel_rust", | |
| "//sdk/fidl/fuchsia.update.channelcontrol:fuchsia.update.channelcontrol_rust", | |
| "//sdk/fidl/fuchsia.update:fuchsia.update_rust", | |
| "//sdk/rust/zx", | |
| "//src/lib/fidl/rust/fidl", | |
| "//src/lib/fuchsia-async", | |
| "//src/lib/fuchsia-component", | |
| "//src/sys/pkg/fidl/fuchsia.update.installer:fuchsia.update.installer_rust", | |
| "//src/sys/pkg/lib/fidl-fuchsia-update-ext", | |
| "//src/sys/pkg/lib/fidl-fuchsia-update-installer-ext", | |
| "//third_party/rust_crates/vendor:anyhow", | |
| "//third_party/rust_crates/vendor:argh", | |
| "//third_party/rust_crates/vendor:futures", | |
| "//third_party/rust_crates/vendor:termion", | |
| ], | |
| ) | |
| # Copy the multi_universal_tool as 'bin/update' as required | |
| # by the update package in BUILD.gn. | |
| # @bazel2gn:skip | |
| fx_packaged_binary( | |
| name = "update_packaged_bin", | |
| binary = "//src/sys/pkg/bin/multi-universal-tool", | |
| binary_name = "update", | |
| ) | |
| # @bazel2gn:skip | |
| rustc_test( | |
| name = "lib_test", | |
| crate = ":lib", | |
| edition = "2024", | |
| lint_config = "//build/config/rust/lints:clippy_warn_all", | |
| deps = [ | |
| "//src/lib/fuchsia", | |
| "//src/lib/fuchsia-sync", | |
| "//third_party/rust_crates/vendor:assert_matches", | |
| ], | |
| ) | |
| # @bazel2gn:skip | |
| fx_unittest_package( | |
| name = "update-lib-tests", | |
| unit_tests = [":lib_test"], | |
| ) |