| # 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/rust/rustc_library.gni") |
| import("//build/testing/test_spec.gni") |
| |
| assert(is_host, "pkg is for use with the host toolchain only") |
| |
| host_test_data("empty-repo-keys") { |
| sources = [ |
| "//src/sys/pkg/tests/pkg-resolver/template/keys/root.json", |
| "//src/sys/pkg/tests/pkg-resolver/template/keys/snapshot.json", |
| "//src/sys/pkg/tests/pkg-resolver/template/keys/targets.json", |
| "//src/sys/pkg/tests/pkg-resolver/template/keys/timestamp.json", |
| ] |
| outputs = [ |
| "$root_out_dir/test_data/ffx_lib_pkg/empty-repo/keys/{{source_file_part}}", |
| ] |
| } |
| |
| host_test_data("empty-repo-metadata") { |
| sources = [ |
| "//src/sys/pkg/tests/pkg-resolver/template/repository/1.root.json", |
| "//src/sys/pkg/tests/pkg-resolver/template/repository/1.snapshot.json", |
| "//src/sys/pkg/tests/pkg-resolver/template/repository/1.targets.json", |
| "//src/sys/pkg/tests/pkg-resolver/template/repository/root.json", |
| "//src/sys/pkg/tests/pkg-resolver/template/repository/snapshot.json", |
| "//src/sys/pkg/tests/pkg-resolver/template/repository/targets.json", |
| "//src/sys/pkg/tests/pkg-resolver/template/repository/timestamp.json", |
| ] |
| outputs = [ "$root_out_dir/test_data/ffx_lib_pkg/empty-repo/repository/{{source_file_part}}" ] |
| } |
| |
| relative_root_out_dir = rebase_path(root_out_dir, root_build_dir) |
| rustc_library("pkg") { |
| name = "pkg" |
| edition = "2024" |
| with_unit_tests = true |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.pkg:fuchsia.pkg_rust", |
| "//sdk/fidl/fuchsia.pkg.rewrite:fuchsia.pkg.rewrite_rust", |
| "//sdk/rust/zx-status", |
| "//src/developer/ffx/config:lib", |
| "//src/developer/ffx/lib/target_net:lib", |
| "//src/developer/ffx/lib/timeout:lib", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-hyper", |
| "//src/lib/fuchsia-url", |
| "//src/sys/lib/fidl-fuchsia-pkg-ext", |
| "//src/sys/lib/fidl-fuchsia-pkg-rewrite-ext", |
| "//src/sys/pkg/lib/fuchsia-repo", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:async-lock", |
| "//third_party/rust_crates:camino", |
| "//third_party/rust_crates:http", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:nix", |
| "//third_party/rust_crates:schemars", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:tuf", |
| "//third_party/rust_crates:url", |
| ] |
| |
| test_deps = [ |
| ":empty-repo-metadata", |
| "//src/lib/fuchsia", |
| "//third_party/rust_crates:pretty_assertions", |
| "//third_party/rust_crates:tempfile", |
| ] |
| |
| sources = [ |
| "src/config.rs", |
| "src/instance.rs", |
| "src/lib.rs", |
| "src/repo.rs", |
| ] |
| |
| rustenv = [ "ROOT_OUT_DIR=$relative_root_out_dir" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":pkg_test" ] |
| } |