blob: 8159eb92735ab35d7370c0e52c9b4255838bc1b9 [file] [log] [blame]
# 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/dist/component_manifest_resources.gni")
import("//build/rust/rustc_binary.gni")
import("//build/rust/rustc_library.gni")
import("//build/rust/rustc_test.gni")
import("//build/security.gni")
group("base-resolver") {
testonly = true
deps = [ ":tests" ]
}
group("tests") {
testonly = true
deps = [
":base-resolver-unittests",
"tests",
]
}
rustc_binary("bin") {
edition = "2021"
output_name = "base_resolver"
with_unit_tests = true
configs += [ "//build/config/rust:bootfs" ]
deps = [
":base_resolver_config",
"//sdk/fidl/fuchsia.boot:fuchsia.boot-rustc",
"//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-component",
"//src/lib/fuchsia-fs",
"//src/lib/fuchsia-url",
"//src/sys/lib/fidl-fuchsia-pkg-ext",
"//src/sys/lib/mem_util",
"//src/sys/lib/routing",
"//src/sys/pkg/lib/blobfs",
"//src/sys/pkg/lib/fuchsia-hash",
"//src/sys/pkg/lib/fuchsia-pkg",
"//src/sys/pkg/lib/fuchsia-pkg-cache-url",
"//src/sys/pkg/lib/package-directory",
"//src/sys/pkg/lib/system-image",
"//third_party/rust_crates:anyhow",
"//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-async",
"//src/lib/storage/vfs/rust:vfs",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/sys/pkg/lib/fuchsia-pkg-testing",
"//third_party/rust_crates:assert_matches",
"//third_party/rust_crates:maplit",
"//third_party/rust_crates:serde_json",
]
sources = [
"src/base_resolver.rs",
"src/main.rs",
"src/pkg_cache_resolver.rs",
]
}
component_manifest_resources("root-manifest") {
sources = [
"meta/base-resolver.cml",
"meta/pkg-cache-resolver.cml",
]
}
fuchsia_component_manifest("base-resolver-manifest") {
component_name = "base-resolver"
manifest = "meta/base-resolver.cml"
}
fuchsia_component("base-resolver-component") {
cm_label = ":base-resolver-manifest"
deps = [ ":bin" ]
}
fuchsia_structured_config_rust_lib("base_resolver_config") {
cm_label = ":base-resolver-manifest"
}
fuchsia_structured_config_values("values_from_gn") {
cm_label = ":base-resolver-manifest"
values = {
enable_subpackages = base_resolver_enable_subpackages
}
}
fuchsia_component("pkg-cache-resolver-component") {
manifest = "meta/pkg-cache-resolver.cml"
component_name = "pkg-cache-resolver"
deps = [ ":bin" ]
}
# Run with `fx test base-resolver-unittests`.
fuchsia_unittest_package("base-resolver-unittests") {
manifest = "meta/base-resolver-unittests.cml"
deps = [
":bin_test",
"//src/sys/pkg/bin/pm:pm_bin",
]
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
}
group("bootfs") {
deps = [
":bin",
":root-manifest",
":values_from_gn",
]
}