| # Copyright 2024 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") |
| |
| rustc_library("lib") { |
| edition = "2024" |
| deps = [ |
| "//sdk/fidl/fuchsia.fs:fuchsia.fs_rust", |
| "//sdk/fidl/fuchsia.hardware.block:fuchsia.hardware.block_rust", |
| "//sdk/fidl/fuchsia.hardware.block.partition:fuchsia.hardware.block.partition_rust", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle_rust", |
| "//sdk/fidl/fuchsia.storage.partitions:fuchsia.storage.partitions_rust", |
| "//sdk/rust/zx", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-sync", |
| "//src/storage/fidl/fuchsia.fs.startup:fuchsia.fs.startup_rust", |
| "//src/storage/gpt/rust", |
| "//src/storage/lib/block_client/rust", |
| "//src/storage/lib/block_server", |
| "//src/storage/lib/vfs/rust:vfs", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:log", |
| ] |
| test_deps = [ |
| "//sdk/fidl/fuchsia.hardware.block.partition:fuchsia.hardware.block.partition_rust", |
| "//sdk/fidl/fuchsia.hardware.block.volume:fuchsia.hardware.block.volume_rust", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-component", |
| "//src/storage/lib/block_server:vmo_backed_block_server", |
| ] |
| sources = [ |
| "src/config.rs", |
| "src/gpt.rs", |
| "src/lib.rs", |
| "src/partition.rs", |
| "src/partitions_directory.rs", |
| "src/service.rs", |
| ] |
| name = "gpt_component" |
| with_unit_tests = true |
| } |
| |
| fuchsia_unittest_component("gpt-component-test") { |
| deps = [ ":lib_test" ] |
| } |
| |
| rustc_binary("gpt2") { |
| edition = "2024" |
| deps = [ |
| ":lib", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/diagnostics/log/rust", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/trace/rust:trace-provider", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:log", |
| ] |
| sources = [ "src/main.rs" ] |
| |
| # Optimize for size |
| configs += [ "//build/config/rust:bootfs" ] |
| } |
| |
| fuchsia_component("component") { |
| component_name = "gpt2" |
| manifest = "meta/gpt2.cml" |
| deps = [ ":gpt2" ] |
| } |
| |
| fuchsia_package("package") { |
| package_name = "gpt2" |
| deps = [ ":component" ] |
| } |
| |
| rustc_test("gpt_integration_test") { |
| edition = "2024" |
| deps = [ |
| "//sdk/fidl/fuchsia.hardware.block.partition:fuchsia.hardware.block.partition_rust", |
| "//sdk/fidl/fuchsia.hardware.block.volume:fuchsia.hardware.block.volume_rust", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//sdk/fidl/fuchsia.storage.partitions:fuchsia.storage.partitions_rust", |
| "//sdk/rust/zx", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-fs", |
| "//src/storage/lib/block_client/rust:block-client", |
| "//src/storage/lib/block_server:vmo_backed_block_server", |
| "//src/storage/lib/fs_management/rust:fs_management", |
| "//third_party/rust_crates:test-case", |
| ] |
| sources = [ "src/integration_test.rs" ] |
| source_root = "src/integration_test.rs" |
| } |
| |
| fuchsia_unittest_component("gpt-component-integration-test") { |
| manifest = "meta/gpt_integration_test.cml" |
| deps = [ |
| ":gpt_integration_test", |
| "//src/storage/lib/fs_management:fs_management_shard", |
| ] |
| } |
| |
| fuchsia_test_package("gpt-component-tests") { |
| deps = [ ":component" ] |
| test_components = [ |
| ":gpt-component-test", |
| ":gpt-component-integration-test", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":gpt-component-tests" ] |
| } |