mirror of
https://github.com/bazel-contrib/rules_foreign_cc
synced 2024-12-03 02:52:58 +00:00
47 lines
1 KiB
Python
47 lines
1 KiB
Python
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
|
|
load("@bazel_skylib//rules:write_file.bzl", "write_file")
|
|
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"],
|
|
)
|
|
|
|
# When this test fails, run
|
|
# (cd docs; bazel run :generate_docs)
|
|
diff_test(
|
|
name = "test",
|
|
file1 = ":docs",
|
|
file2 = "README.md",
|
|
)
|
|
|
|
write_file(
|
|
name = "generate_docs_src",
|
|
out = "update.sh",
|
|
content = [
|
|
"#!/usr/bin/env bash",
|
|
"cd $BUILD_WORKSPACE_DIRECTORY",
|
|
"cp -fv bazel-bin/docs.md README.md",
|
|
],
|
|
)
|
|
|
|
sh_binary(
|
|
name = "generate_docs",
|
|
srcs = [":generate_docs_src"],
|
|
data = [":docs"],
|
|
)
|