2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-11-30 16:42:07 +00:00
rules_foreign_cc/docs/BUILD.bazel
UebelAndre 8b8f31dd1b
Created a ./docs directory to house documentation (#466)
* Added links to docs to top level README

* Updated more docs

* Added generated header
2021-01-24 15:23:19 -08:00

47 lines
994 B
Python

load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
load("@bazel_skylib//rules:build_test.bzl", "build_test")
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 -e
cat \\$${BUILD_WORKSPACE_DIRECTORY}/$(location //:docs) > \\$${BUILD_WORKSPACE_DIRECTORY}/README.md
""",
)
sh_binary(
name = "generate_docs",
srcs = [":generate_docs_src"],
data = [":docs"],
)