| # 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/assembly/bootfs_files_for_assembly.gni") |
| import("//build/components.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_library.gni") |
| |
| iquery_deps = [ |
| "//sdk/fidl/fuchsia.developer.remotecontrol:fuchsia.developer.remotecontrol_rust", |
| "//sdk/fidl/fuchsia.sys2:fuchsia.sys2_rust", |
| "//src/lib/diagnostics/data/rust", |
| "//src/lib/diagnostics/hierarchy/rust", |
| "//src/lib/diagnostics/selectors", |
| "//src/lib/fidl/rust/fidl", |
| "//src/sys/lib/cm_rust", |
| "//src/sys/lib/component_debug", |
| "//src/sys/lib/moniker", |
| "//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:either", |
| "//third_party/rust_crates:lazy_static", |
| "//third_party/rust_crates:nom", |
| "//third_party/rust_crates:num-traits", |
| "//third_party/rust_crates:regex", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| if (is_fuchsia) { |
| iquery_deps += [ |
| "//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics_rust", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//src/lib/diagnostics/reader/rust", |
| "//src/lib/fuchsia-component", |
| ] |
| } |
| |
| iquery_sources = [ |
| "src/commands/list.rs", |
| "src/commands/list_accessors.rs", |
| "src/commands/mod.rs", |
| "src/commands/selectors.rs", |
| "src/commands/show.rs", |
| "src/commands/types.rs", |
| "src/commands/utils.rs", |
| "src/text_formatter.rs", |
| "src/types.rs", |
| ] |
| |
| if (is_fuchsia) { |
| iquery_sources += [ |
| "src/command_line.rs", |
| "src/commands/target.rs", |
| ] |
| } |
| |
| rustc_library("lib") { |
| name = "iquery" |
| edition = "2021" |
| with_unit_tests = true |
| source_root = "src/lib.rs" |
| |
| visibility = [ |
| "//src/developer/ffx/plugins/inspect/*", |
| "//src/developer/remote-control/diagnostics-bridge/*", |
| "//src/diagnostics/iquery/*", |
| "//vendor/google/starnix/tests/*", |
| ] |
| |
| deps = iquery_deps |
| |
| test_deps = [ |
| "//src/diagnostics/iquery/test_support:iquery_test_support", |
| "//src/lib/fuchsia", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:test-case", |
| ] |
| |
| sources = iquery_sources |
| sources += [ "src/lib.rs" ] |
| } |
| |
| rustc_binary("bin") { |
| output_name = "iquery" |
| edition = "2021" |
| source_root = "src/main.rs" |
| |
| if (is_fuchsia) { |
| configs += [ "//build/config/rust:bootfs" ] |
| } |
| |
| deps = [ |
| ":lib", |
| "//src/lib/fuchsia-async", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| ] |
| |
| sources = [ "src/main.rs" ] |
| } |
| |
| fuchsia_unittest_package("test_iquery_lib_unittests") { |
| deps = [ |
| ":lib_test", |
| "//src/diagnostics/iquery/test_support:iquery_test_support", |
| "//third_party/rust_crates:assert_matches", |
| ] |
| } |
| |
| rustc_test("iquery_test") { |
| edition = "2021" |
| output_name = "iquery_test" |
| source_root = "src/main.rs" |
| deps = [ |
| ":lib", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component-test", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:pretty_assertions", |
| "//third_party/rust_crates:regex", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| ] |
| sources = [ |
| "src/main.rs", |
| "src/tests/commands.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/selectors_filter_test_serve_fs.json", |
| "test_data/selectors_filter_test_serve_fs.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_filter_test.text", |
| "test_data/show_filter_test.json", |
| "test_data/show_filter_test_serve_fs.text", |
| "test_data/show_filter_test_serve_fs.json", |
| "test_data/show_test.json", |
| "test_data/show_test.text", |
| ] |
| } |
| |
| fuchsia_component("iquery-test") { |
| testonly = true |
| manifest = "meta/iquery-test.cml" |
| deps = [ ":iquery_test" ] |
| check_includes = false |
| } |
| |
| fuchsia_test_package("iquery-tests") { |
| test_components = [ ":iquery-test" ] |
| deps = [ |
| "test/basic_component", |
| "test/test_component", |
| "test_data:goldens", |
| "//src/diagnostics/archivist:archivist-for-embedding-bundle", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":iquery-tests", |
| ":lib_test($host_toolchain)", |
| ":test_iquery_lib_unittests", |
| ] |
| } |
| |
| group("iquery") { |
| deps = [ |
| ":bin", |
| "//build/validate:non_production_tag", |
| ] |
| } |
| |
| bootfs_files_for_assembly("bootfs") { |
| deps = [ ":iquery" ] |
| } |