| # Copyright 2020 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/rust/rustc_binary.gni") |
| import("//build/security.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":example", |
| ":universe-resolver-unittests", |
| ] |
| } |
| |
| rustc_binary("bin") { |
| edition = "2021" |
| output_name = "universe_resolver" |
| |
| # Generates a GN target for unit-tests with the label `bin_test`, and |
| # a binary named `universe_resolver_bin_test`. |
| with_unit_tests = true |
| |
| deps = [ |
| ":universe_resolver_config", |
| "//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl-rustc", |
| "//sdk/fidl/fuchsia.component.resolution:fuchsia.component.resolution-rustc", |
| "//sdk/fidl/fuchsia.data:fuchsia.data-rustc", |
| "//sdk/fidl/fuchsia.io:fuchsia.io-rustc", |
| "//sdk/fidl/fuchsia.pkg:fuchsia.pkg-rustc", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-fs", |
| "//src/lib/fuchsia-url", |
| "//src/lib/syslog/rust:syslog", |
| "//src/sys/lib/mem_util", |
| "//src/sys/lib/routing", |
| "//src/sys/pkg/lib/fuchsia-pkg", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| test_deps = [ |
| "//sdk/fidl/fuchsia.component.config:fuchsia.component.config-rustc", |
| "//sdk/fidl/fuchsia.mem:fuchsia.mem-rustc", |
| "//src/lib/fuchsia-component-test", |
| "//src/lib/storage/vfs/rust:vfs", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/sys/pkg/lib/fuchsia-hash", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:serde_json", |
| ] |
| |
| sources = [ "src/main.rs" ] |
| } |
| |
| fuchsia_component_manifest("manifest") { |
| component_name = "universe-resolver" |
| manifest = "meta/universe-resolver.cml" |
| } |
| |
| fuchsia_component("component") { |
| cm_label = ":manifest" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_structured_config_rust_lib("universe_resolver_config") { |
| cm_label = ":manifest" |
| } |
| |
| fuchsia_structured_config_values("values_from_gn") { |
| cm_label = ":manifest" |
| values = { |
| enable_subpackages = universe_resolver_enable_subpackages |
| } |
| } |
| |
| fuchsia_component_manifest("manifest-for-test") { |
| component_name = "universe-resolver-for-test" |
| manifest = "meta/universe-resolver-for-test.cml" |
| } |
| |
| fuchsia_component("component-for-test") { |
| testonly = true |
| cm_label = ":manifest-for-test" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_structured_config_rust_lib("universe_resolver_config_for_test") { |
| cm_label = ":manifest-for-test" |
| } |
| |
| fuchsia_structured_config_values("values_from_gn_for_test") { |
| cm_label = ":manifest-for-test" |
| values = { |
| enable_subpackages = universe_resolver_enable_subpackages |
| } |
| } |
| |
| fuchsia_component_manifest("manifest-base-only-for-test") { |
| component_name = "universe-resolver-base-only-for-test" |
| manifest = "meta/universe-resolver-base-only-for-test.cml" |
| } |
| |
| fuchsia_component("component-base-only-for-test") { |
| testonly = true |
| cm_label = ":manifest-base-only-for-test" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_structured_config_rust_lib( |
| "universe_resolver_config_base_only_for_test") { |
| cm_label = ":manifest-base-only-for-test" |
| } |
| |
| fuchsia_structured_config_values("values_from_gn_base_only_for_test") { |
| cm_label = ":manifest-base-only-for-test" |
| values = { |
| enable_subpackages = universe_resolver_enable_subpackages |
| } |
| } |
| |
| fuchsia_package("universe-resolver") { |
| deps = [ |
| ":component", |
| ":values_from_gn", |
| ] |
| } |
| |
| fuchsia_component("example") { |
| manifest = "meta/example.cml" |
| } |
| |
| fuchsia_component("unittests") { |
| manifest = "meta/universe-resolver-unittests.cml" |
| component_name = "universe-resolver-unittests" |
| deps = [ ":bin_test" ] |
| testonly = true |
| } |
| |
| # Run with `fx test universe-resolver-unittests`. |
| fuchsia_unittest_package("universe-resolver-unittests") { |
| manifest = "meta/universe-resolver-unittests.cml" |
| deps = [ |
| ":bin_test", |
| ":component-base-only-for-test", |
| ":component-for-test", |
| ":values_from_gn_base_only_for_test", |
| ":values_from_gn_for_test", |
| ] |
| } |