blob: a13197fc6b616ae44a580c4e8a0ae8e47959dfea [file] [log] [blame]
# Copyright 2017 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/dart/dart_tool.gni")
import("//build/dart/test.gni")
import("//build/host.gni")
import("//build/rust/rustc_binary.gni")
# Group added to enable easy building of both the
# legacy Dart version and the Rust version.
group("doc_checker") {
testonly = true
deps = [
":doc_checker_darttool",
":doc_checker_host_tool($host_toolchain)",
]
}
group("tests") {
testonly = true
deps = [
":doc-checker-tests($host_toolchain)",
":doc_checker_bin_test($host_toolchain)",
]
}
# Builds doc_checker, a Rust based binary.
#
# Currently the name is `doc-checker-new` so as
# not to collide with the legacy doc-checker.
if (is_host) {
rustc_binary("doc_checker_bin") {
edition = "2021"
# TODO: Rename to doc-checker when migration is completed.
output_name = "doc-checker-new"
with_unit_tests = true
testonly = true
sources = [
"src/checker.rs",
"src/link_checker.rs",
"src/main.rs",
"src/md_element.rs",
"src/parser.rs",
"src/yaml.rs",
"src/yaml/toc_checker.rs",
]
deps = [
"//src/lib/fuchsia",
"//src/lib/fuchsia-hyper:fuchsia-hyper",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:argh",
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:cfg-if",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:glob",
"//third_party/rust_crates:http",
"//third_party/rust_crates:hyper",
"//third_party/rust_crates:pulldown-cmark",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_yaml",
"//third_party/rust_crates:url",
]
test_deps = [ "//src/lib/fuchsia-async" ]
non_rust_deps = [ ":doc_checker_test_data($host_toolchain)" ]
}
install_host_tools("doc_checker_host_tool") {
testonly = true
deps = [ ":doc_checker_bin($host_toolchain)" ]
outputs = [ "doc-checker-new" ]
}
# Test data for doc_checker.
host_test_data("doc_checker_test_data") {
sources = [
"doc_checker_test_data/docs/README.md",
"doc_checker_test_data/docs/_toc.yaml",
"doc_checker_test_data/docs/images/fuchsia_icon_256x256.png",
"doc_checker_test_data/docs/no_readme/_toc.yaml",
"doc_checker_test_data/docs/no_readme/details.md",
"doc_checker_test_data/docs/path.md",
"doc_checker_test_data/docs/second.md",
"doc_checker_test_data/docs/unreachable.md",
"doc_checker_test_data/docs/unused/_toc.yaml",
]
outputs = [ "${root_out_dir}/{{source_target_relative}}" ]
}
}
# Legacy Dart implementation. This will be removed
# once the Rust implementation is completed and
# stable.
dart_tool("doc_checker_darttool") {
package_name = "doc_checker"
output_name = "doc-checker"
main_dart = "bin/main.dart"
sources = [
"errors.dart",
"graph.dart",
"image_scraper.dart",
"link_checker.dart",
"link_scraper.dart",
"link_verifier.dart",
"projects.dart",
"yaml_checker.dart",
]
deps = [
"//third_party/dart-pkg/pub/args",
"//third_party/dart-pkg/pub/http",
"//third_party/dart-pkg/pub/markdown",
"//third_party/dart-pkg/pub/meta",
"//third_party/dart-pkg/pub/path",
"//third_party/dart-pkg/pub/yaml",
]
}
dart_test("doc-checker-tests") {
sources = [
"graph_test.dart",
"image_scraper_test.dart",
"link_checker_test.dart",
"link_scraper_test.dart",
"link_verifier_test.dart",
"yaml_checker_test.dart",
]
deps = [
":doc_checker_darttool_dart_library",
"//third_party/dart-pkg/pub/http",
"//third_party/dart-pkg/pub/meta",
"//third_party/dart-pkg/pub/path",
"//third_party/dart-pkg/pub/test",
]
}