blob: cf26b2e33bb6d940f8eb8a2a07dfecfebd814d5f [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/host.gni")
import("//build/rust/rustc_binary.gni")
import("//build/rust/rustc_test.gni")
import("//build/testing/host_test_data.gni")
if (is_host) {
crate_source_root = "src/main.rs"
crate_sources = [ crate_source_root ]
crate_deps = [
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:argh",
"//third_party/rust_crates:flate2",
"//third_party/rust_crates:lazy_static",
"//third_party/rust_crates:tar",
"//third_party/rust_crates:tracing",
"//third_party/rust_crates:tracing-subscriber",
]
rustc_binary("clidoc_bin") {
edition = "2021"
name = "clidoc"
source_root = crate_source_root
sources = crate_sources
deps = crate_deps
}
rustc_test("clidoc_bin_test") {
edition = "2021"
source_root = crate_source_root
sources = crate_sources
deps = crate_deps + [ "//third_party/rust_crates:tempfile" ]
non_rust_deps = [ ":clidoc_test_scripts($host_toolchain)" ]
}
# Test data for generating reference docs.
# The shell script is the tool that has --help output,
# the markdown file is the expected output.
host_test_data("clidoc_test_scripts") {
sources = [
"src/testdata/tool_with_subcommands.md",
"src/testdata/tool_with_subcommands.sh",
]
outputs = [ "${root_out_dir}/clidoc_test_data/{{source_file_part}}" ]
}
}
install_host_tools("clidoc") {
deps = [ ":clidoc_bin($host_toolchain)" ]
outputs = [ "clidoc" ]
}
group("tests") {
testonly = true
deps = [ ":clidoc_bin_test($host_toolchain)" ]
}