| # Copyright 2021 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. |
| |
| import("//build/components.gni") |
| import("//build/components/fuchsia_unittest_component.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_library.gni") |
| |
| fxfs_deps = [ |
| "//src/lib/async-utils", |
| "//src/lib/fuchsia-async", |
| "//src/lib/storage/storage_device", |
| "//src/storage/lib/interval_tree", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:bincode", |
| "//third_party/rust_crates:byteorder", |
| "//third_party/rust_crates:either-v1_5_0", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:once_cell", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| fxfs_test_deps = [ "//third_party/rust_crates:matches" ] |
| |
| fxfs_sources = [ |
| "src/debug_assert_not_too_long.rs", |
| "src/errors.rs", |
| "src/lib.rs", |
| "src/lsm_tree.rs", |
| "src/lsm_tree/merge.rs", |
| "src/lsm_tree/simple_persistent_layer.rs", |
| "src/lsm_tree/skip_list_layer.rs", |
| "src/lsm_tree/types.rs", |
| "src/mkfs.rs", |
| "src/mount.rs", |
| "src/object_handle.rs", |
| "src/object_store.rs", |
| "src/object_store/allocator.rs", |
| "src/object_store/allocator/merge.rs", |
| "src/object_store/constants.rs", |
| "src/object_store/directory.rs", |
| "src/object_store/filesystem.rs", |
| "src/object_store/fsck.rs", |
| "src/object_store/graveyard.rs", |
| "src/object_store/journal.rs", |
| "src/object_store/journal/checksum_list.rs", |
| "src/object_store/journal/handle.rs", |
| "src/object_store/journal/reader.rs", |
| "src/object_store/journal/super_block.rs", |
| "src/object_store/journal/writer.rs", |
| "src/object_store/merge.rs", |
| "src/object_store/object_manager.rs", |
| "src/object_store/record.rs", |
| "src/object_store/testing.rs", |
| "src/object_store/testing/fake_allocator.rs", |
| "src/object_store/testing/fake_filesystem.rs", |
| "src/object_store/transaction.rs", |
| "src/testing.rs", |
| "src/testing/fake_object.rs", |
| "src/trace.rs", |
| "src/volume.rs", |
| ] |
| |
| if (is_fuchsia) { |
| fxfs_deps += [ |
| "//sdk/fidl/fuchsia.fs:fuchsia.fs-rustc", |
| "//sdk/fidl/fuchsia.io:fuchsia.io-rustc", |
| "//sdk/fidl/fuchsia.io2:fuchsia.io2-rustc", |
| "//sdk/fidl/fuchsia.mem:fuchsia.mem-rustc", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/storage/vfs/rust:vfs", |
| "//src/lib/trace/rust:trace", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| ] |
| fxfs_test_deps += [ |
| "//garnet/lib/rust/files_async", |
| "//garnet/lib/rust/io_util", |
| ] |
| fxfs_sources += [ |
| "src/server.rs", |
| "src/server/directory.rs", |
| "src/server/errors.rs", |
| "src/server/file.rs", |
| "src/server/node.rs", |
| "src/server/testing.rs", |
| "src/server/volume.rs", |
| "src/trace.rs", |
| ] |
| } else { |
| fxfs_sources += [ "src/trace_stub.rs" ] |
| } |
| |
| rustc_library("lib") { |
| edition = "2018" |
| with_unit_tests = true |
| name = "fxfs" |
| |
| deps = fxfs_deps |
| sources = fxfs_sources |
| test_deps = fxfs_test_deps |
| } |
| |
| fuchsia_unittest_component("fxfs-test") { |
| deps = [ ":lib_test" ] |
| } |
| |
| fuchsia_test_package("fxfs-tests") { |
| test_components = [ ":fxfs-test" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fxfs-tests", |
| ":lib_test($host_toolchain)", |
| ] |
| } |
| |
| rustc_binary("fxfs") { |
| edition = "2018" |
| deps = [ |
| ":lib", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/storage/block_client/rust:remote-block-device", |
| "//src/lib/storage/storage_device", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| ] |
| sources = [ "src/main.rs" ] |
| } |
| |
| fuchsia_shell_package("fxfs-bin") { |
| deps = [ ":fxfs" ] |
| } |