blob: 84cd05e8256b9208b490a802b283f37f20575bd1 [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/rust:rustc_library.bzl", "rustc_library")
load("//build/bazel/rules/rust:rustc_test.bzl", "rustc_test")
package(default_applicable_licenses = ["//:license"])
# The unit tests (`:block-client_test`) stay in BUILD.gn because they
# depend on //src/storage/lib/block_server and
# //src/storage/lib/ramdevice_client, which have no Bazel build yet.
rustc_library(
name = "block-client",
srcs = [
"src/cache.rs",
"src/lib.rs",
],
edition = "2024",
target_compatible_with = ["@platforms//os:fuchsia"],
visibility = [
"//src/firmware/paver/rust:__subpackages__",
"//src/starnix/kernel/core:__pkg__",
"//src/storage:__subpackages__",
"//src/virtualization/tests/virtio_block_test_util:__pkg__",
"//vendor/google:__subpackages__",
],
deps = [
"//sdk/fidl/fuchsia.storage.block:fuchsia.storage.block_rust",
"//sdk/rust/zx",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-sync",
"//src/storage/lib/block_protocol",
"//src/storage/lib/trace",
"//third_party/rust_crates/vendor:anyhow",
"//third_party/rust_crates/vendor:futures",
"//third_party/rust_crates/vendor:linked-hash-map",
"//third_party/rust_crates/vendor:log",
],
)
rustc_library(
name = "fake-block-client",
srcs = ["src/fake_block_client.rs"],
crate_root = "src/fake_block_client.rs",
edition = "2024",
target_compatible_with = ["@platforms//os:fuchsia"],
visibility = [
"//src/firmware/paver/rust:__subpackages__",
"//src/storage/fvm:__pkg__",
"//src/storage/lib/storage_device:__pkg__",
"//vendor/google:__subpackages__",
],
deps = [
":block-client",
"//sdk/fidl/fuchsia.storage.block:fuchsia.storage.block_rust",
"//sdk/rust/zx",
"//src/lib/fuchsia-sync",
],
)
# The libraries are defined in BUILD.bazel. The block-client unit tests stay
# in GN because //src/storage/lib/block_server and
# //src/storage/lib/ramdevice_client have no Bazel build yet.
rustc_test(
name = "block-client_test",
crate = ":block-client",
# Avoids a name collision in GN.
crate_name = "block_client_lib_test",
target_compatible_with = ["@platforms//os:fuchsia"],
deps = [
"//src/lib/fuchsia",
"//src/storage/lib/block_server",
"//src/storage/lib/ramdevice_client",
],
)