| # 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") | |
| package(default_applicable_licenses = ["//:license"]) | |
| rustc_library( | |
| name = "system-image", | |
| srcs = [ | |
| "src/anchored_packages.rs", | |
| "src/cache_packages.rs", | |
| "src/errors.rs", | |
| "src/lib.rs", | |
| "src/path_hash_mapping.rs", | |
| "src/system_image.rs", | |
| ], | |
| edition = "2024", | |
| lint_config = "//build/config/rust/lints:clippy_warn_all", | |
| visibility = [ | |
| "//src/sys/component_manager:__pkg__", | |
| "//src/sys/pkg:__subpackages__", | |
| ], | |
| deps = [ | |
| "//src/lib/buf-read-ext", | |
| "//src/lib/collections/sorted-vec-map", | |
| "//src/lib/diagnostics/inspect/rust:fuchsia-inspect", # @bazel2gn:path_overwrite://src/lib/diagnostics/inspect/rust | |
| "//src/lib/fuchsia-url", | |
| "//src/sys/pkg/lib/blobfs", | |
| "//src/sys/pkg/lib/fuchsia-hash", | |
| "//src/sys/pkg/lib/fuchsia-pkg", | |
| "//src/sys/pkg/lib/package-directory", | |
| "//third_party/rust_crates/vendor:anyhow", | |
| "//third_party/rust_crates/vendor:futures", | |
| "//third_party/rust_crates/vendor:serde", | |
| "//third_party/rust_crates/vendor:serde_json", | |
| "//third_party/rust_crates/vendor:thiserror", | |
| ], | |
| ) | |
| # `:system-image-test-component` and `:system-image-tests` stay in BUILD.gn | |
| # because they depend on `//src/storage/testing:storage_driver_test_realm` and | |
| # `//src/storage/testing/driver_test_realm/meta/client.shard.cml`, which remain | |
| # in GN. | |
| rustc_test( | |
| name = "system-image_test", | |
| crate = ":system-image", | |
| # Sets GN `output_name` via bazel2gn to match `bin/system_image_lib_test` | |
| # in `meta/system-image-lib-test.cml`. | |
| crate_name = "system_image_lib_test", | |
| lint_config = "//build/config/rust/lints:clippy_warn_all", | |
| deps = [ | |
| "//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions", | |
| "//src/lib/fuchsia", | |
| "//src/sys/pkg/lib/fuchsia-pkg-testing", | |
| "//src/sys/pkg/testing/blobfs-ramdisk", | |
| "//third_party/rust_crates/vendor:assert_matches", | |
| "//third_party/rust_crates/vendor:proptest", | |
| ], | |
| ) |