| # Copyright 2019 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/dist/resource.gni") |
| import("//build/rust/rustc_library.gni") |
| |
| lib_deps = [ |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-fs", |
| "//src/lib/fuchsia-url", |
| "//src/lib/tempfile-ext", |
| "//src/lib/utf8_path", |
| "//src/lib/versioning/version-history/rust:version-history", |
| "//src/lib/zircon/rust:fuchsia-zircon-status", |
| "//src/storage/lib/delivery_blob", |
| "//src/sys/pkg/lib/far/rust:fuchsia-archive", |
| "//src/sys/pkg/lib/fuchsia-hash", |
| "//src/sys/pkg/lib/fuchsia-merkle", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:camino", |
| "//third_party/rust_crates:proptest", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:tempfile", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:walkdir", |
| ] |
| |
| test_deps = [ |
| "//src/lib/fuchsia-async", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:lazy_static", |
| "//third_party/rust_crates:maplit", |
| "//third_party/rust_crates:pretty_assertions", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:regex", |
| "//third_party/rust_crates:tempfile", |
| ] |
| |
| lib_sources = [ |
| "src/build.rs", |
| "src/errors.rs", |
| "src/lib.rs", |
| "src/meta_contents.rs", |
| "src/meta_package.rs", |
| "src/meta_subpackages.rs", |
| "src/package.rs", |
| "src/package_archive.rs", |
| "src/package_build_manifest.rs", |
| "src/package_builder.rs", |
| "src/package_directory.rs", |
| "src/package_manifest.rs", |
| "src/package_manifest_list.rs", |
| "src/path.rs", |
| "src/path_to_string.rs", |
| "src/subpackages_build_manifest.rs", |
| "src/test.rs", |
| ] |
| |
| rustc_library("fuchsia-pkg") { |
| version = "0.1.0" |
| edition = "2021" |
| |
| # fuchsia-pkg should not depend on host-side assembly tooling |
| assert_no_deps = [ "//src/lib/assembly/*" ] |
| |
| deps = lib_deps |
| sources = lib_sources |
| configs += [ "//build/config/rust/lints:clippy_warn_all" ] |
| } |
| |
| if (is_fuchsia) { |
| resource("dup1") { |
| testonly = true |
| sources = [ "duplicate-blob.txt" ] |
| outputs = [ "data/dup1" ] |
| } |
| |
| resource("dup2") { |
| testonly = true |
| sources = [ "duplicate-blob.txt" ] |
| outputs = [ "data/dup2" ] |
| } |
| |
| resource("dup3") { |
| testonly = true |
| sources = [ "duplicate-blob.txt" ] |
| outputs = [ "data/dup3" ] |
| } |
| |
| rustc_test("lib_test") { |
| edition = "2021" |
| output_name = "fuchsia_pkg_lib_test" |
| deps = lib_deps + test_deps |
| sources = lib_sources |
| } |
| |
| fuchsia_component("test-component") { |
| component_name = "fuchsia-pkg-lib-test" |
| visibility = [ ":*" ] |
| testonly = true |
| deps = [ |
| ":dup1", |
| ":dup2", |
| ":lib_test", |
| ] |
| manifest = "meta/fuchsia-pkg-tests.cml" |
| } |
| |
| fuchsia_test_package("fuchsia-pkg-tests") { |
| test_components = [ ":test-component" ] |
| } |
| } |
| |
| if (is_host) { |
| rustc_test("lib_test") { |
| edition = "2021" |
| output_name = "fuchsia_pkg_lib_test" |
| deps = lib_deps + test_deps |
| sources = lib_sources |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| public_deps = [ |
| ":fuchsia-pkg-tests($default_toolchain)", |
| ":lib_test($host_toolchain)", |
| ] |
| } |