2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-11-28 08:43:26 +00:00
rules_foreign_cc/docs/BUILD.bazel
UebelAndre 07e1645dcc
Added test for ensuring docs are always appropriately updated (#576)
* Added test for ensuring docs are always appropriately updated

* Updated docs
2021-03-20 20:11:57 +00:00

52 lines
1 KiB
Python

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
genrule(
name = "flatten_header_vm",
srcs = [
"gen_header.sh",
"docs.bzl",
],
outs = ["flatten_header.vm"],
cmd = "$(location gen_header.sh) $(location docs.bzl) $@",
output_to_bindir = True,
)
stardoc(
name = "docs",
out = "docs.md",
header_template = ":flatten_header_vm",
input = "docs.bzl",
deps = ["@rules_foreign_cc//:bzl_srcs"],
)
build_test(
name = "docs_build_test",
targets = [
":docs",
],
visibility = ["//visibility:public"],
)
genrule(
name = "generate_docs_src",
srcs = [":docs"],
outs = ["generate_docs.sh"],
cmd = """cat << EOF > $@
#!/bin/bash
set -euo pipefail
cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/README.md
EOF
""",
)
sh_binary(
name = "generate_docs",
srcs = [":generate_docs_src"],
data = [":docs"],
)
sh_binary(
name = "test_docs",
srcs = ["test_docs.sh"]
)