| # 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") | |
| load( | |
| "//build/bazel/rules/testing:fx_unittest_package.bzl", | |
| "fx_unittest_package", | |
| ) | |
| package(default_applicable_licenses = ["//:license"]) | |
| rustc_library( | |
| name = "f2fs_reader", | |
| srcs = [ | |
| "src/block_cache.rs", | |
| "src/checkpoint.rs", | |
| "src/crypto.rs", | |
| "src/dir.rs", | |
| "src/fsverity.rs", | |
| "src/inode.rs", | |
| "src/lib.rs", | |
| "src/nat.rs", | |
| "src/reader.rs", | |
| "src/superblock.rs", | |
| "src/xattr.rs", | |
| ], | |
| edition = "2024", | |
| proc_macro_deps = [ | |
| "//third_party/rust_crates/vendor:async-trait", | |
| "//third_party/rust_crates/vendor:enumn", | |
| ], | |
| visibility = [ | |
| "//src/storage/f2fs_reader/fuzzers:__pkg__", | |
| "//src/storage/f2fs_reader/migrate:__pkg__", | |
| "//vendor/google:__subpackages__", | |
| ], | |
| deps = [ | |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", | |
| "//src/lib/fuchsia-sync", | |
| "//src/storage/lib/fscrypt", | |
| "//src/storage/lib/fsverity-merkle", | |
| "//src/storage/lib/storage_device", | |
| "//third_party/rust_crates/vendor:aes", | |
| "//third_party/rust_crates/vendor:anyhow", | |
| "//third_party/rust_crates/vendor:bitflags", | |
| "//third_party/rust_crates/vendor:hex", | |
| "//third_party/rust_crates/vendor:log", | |
| "//third_party/rust_crates/vendor:lru", | |
| "//third_party/rust_crates/vendor:siphasher", | |
| "//third_party/rust_crates/vendor:zerocopy", | |
| ], | |
| ) | |
| rustc_test( | |
| name = "f2fs_reader_test", | |
| crate = ":f2fs_reader", | |
| link_deps = ["//third_party/zstd"], | |
| tags = ["manual"], | |
| target_compatible_with = ["@platforms//os:fuchsia"], | |
| deps = [ | |
| "//src/lib/fuchsia", | |
| "//src/storage/lib/units", | |
| "//third_party/rust_crates/vendor:zstd", | |
| ], | |
| ) | |
| # TODO(https://fxbug.dev/570694755): bazel2gn does not yet support resources or | |
| # parallel on fx_unittest_package(), so the GN copy is defined by hand in | |
| # BUILD.gn while GN callers remain. | |
| # LINT.IfChange(f2fs_reader_tests) | |
| # @bazel2gn:skip | |
| fx_unittest_package( | |
| name = "f2fs-reader-tests", | |
| # Several tests load the f2fs.img.zst image which expands to 256MiB. Running | |
| # the tests in parallel can cause the system to OOM. | |
| parallel = 1, | |
| resources = ["//src/storage/f2fs_reader/testdata:images"], | |
| unit_tests = [":f2fs_reader_test"], | |
| ) | |
| # LINT.ThenChange(BUILD.gn:f2fs_reader_tests) |