blob: 22e23ad453d3fb248227873a2d3335daaaf943fa [file] [log] [blame]
# 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/rust/rustc_binary.gni")
iquery_deps = [
"//garnet/lib/rust/files_async",
"//garnet/lib/rust/io_util",
"//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics-rustc",
"//sdk/fidl/fuchsia.inspect:fuchsia.inspect-rustc",
"//sdk/fidl/fuchsia.inspect.deprecated:fuchsia.inspect.deprecated-rustc",
"//sdk/fidl/fuchsia.io:fuchsia.io-rustc",
"//sdk/fidl/fuchsia.sys:fuchsia.sys-rustc",
"//src/diagnostics/lib/inspect-fidl-load",
"//src/diagnostics/lib/selectors",
"//src/lib/diagnostics/data/rust",
"//src/lib/diagnostics/hierarchy/rust",
"//src/lib/diagnostics/inspect/rust",
"//src/lib/diagnostics/reader/rust",
"//src/lib/diagnostics/testing/rust",
"//src/lib/fdio/rust:fdio",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/syslog/rust:syslog",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:argh",
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:derivative",
"//third_party/rust_crates:difference",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:glob",
"//third_party/rust_crates:lazy_static",
"//third_party/rust_crates:matches",
"//third_party/rust_crates:nom",
"//third_party/rust_crates:num-traits",
"//third_party/rust_crates:pretty_assertions",
"//third_party/rust_crates:regex",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:tempfile",
"//third_party/rust_crates:thiserror",
]
iquery_sources = [
"src/command_line.rs",
"src/commands/list.rs",
"src/commands/list_accessors.rs",
"src/commands/list_files.rs",
"src/commands/logs.rs",
"src/commands/mod.rs",
"src/commands/selectors.rs",
"src/commands/show.rs",
"src/commands/show_file.rs",
"src/commands/types.rs",
"src/commands/utils.rs",
"src/constants.rs",
"src/location.rs",
"src/main.rs",
"src/text_formatter.rs",
"src/types.rs",
]
rustc_binary("bin") {
name = "iquery"
edition = "2018"
force_opt = "z"
# TODO(fxbug.dev/64097): extract to a template
# iquery must always be small (even in debug builds) since it is part of bootfs.
#
# The add/remove/add ensures we get the configuration without producing errors for builds which
# enable ThinLTO themselves.
configs += [ "//build/config/lto:thinlto" ]
configs -= [ "//build/config/lto:thinlto" ]
configs += [ "//build/config/lto:thinlto" ]
# we can't dynamically link std when we're in the zbi
configs -= [ "//build/config/fuchsia:dynamic_rust_standard_library" ]
deps = iquery_deps
sources = iquery_sources
}
rustc_test("bin_test") {
output_name = "iquery_bin_test"
source_root = "src/main.rs"
deps = iquery_deps
sources = iquery_sources
sources += [
"src/tests/commands.rs",
"src/tests/macros.rs",
"src/tests/mod.rs",
"src/tests/utils.rs",
]
inputs = [
"test_data/list_accessors.json",
"test_data/list_accessors.text",
"test_data/list_archive.json",
"test_data/list_archive.text",
"test_data/list_filter_manifest.json",
"test_data/list_filter_manifest.text",
"test_data/list_no_dups.json",
"test_data/list_no_dups.text",
"test_data/list_test.json",
"test_data/list_test.text",
"test_data/list_with_url.json",
"test_data/list_with_url.text",
"test_data/list_files_test.json",
"test_data/list_files_test.text",
"test_data/list_files_cwd.json",
"test_data/list_files_cwd.text",
"test_data/show_file_test.text",
"test_data/show_file_test.json",
"test_data/show_file_vmo.json",
"test_data/show_file_vmo.text",
"test_data/selectors_archive.json",
"test_data/selectors_archive.text",
"test_data/selectors_filter_test.json",
"test_data/selectors_filter_test.text",
"test_data/selectors_test.json",
"test_data/selectors_test.text",
"test_data/show_all_test.json",
"test_data/show_all_test.text",
"test_data/show_archive.json",
"test_data/show_archive.text",
"test_data/show_filter_test.text",
"test_data/show_filter_test.json",
"test_data/show_filter_no_selectors_test.text",
"test_data/show_filter_no_selectors_test.json",
"test_data/show_test.json",
"test_data/show_test.text",
"test_data/log.json",
"test_data/log.text",
]
}
fuchsia_component("iquery-bin-test") {
testonly = true
manifest = "meta/iquery-bin-test.cmx"
deps = [
":bin_test",
"test/basic_component",
"test/test_component",
]
}
fuchsia_test_package("iquery-tests") {
test_components = [ ":iquery-bin-test" ]
}
group("tests") {
testonly = true
deps = [ ":iquery-tests" ]
}
group("iquery") {
deps = [
":bin",
"//build/validate:non_production_tag",
]
}