forked from keith/rules_multirun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD
50 lines (45 loc) · 1.07 KB
/
BUILD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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")
_DOC_SRCS = [
"defs",
]
[
stardoc(
name = file + "_doc",
out = file + ".gen.md",
input = "//:{}.bzl".format(file),
tags = ["no-cache"],
deps = [
"//:" + file,
],
)
for file in _DOC_SRCS
]
write_file(
name = "gen_update",
out = "update.sh",
content = [
"#!/usr/bin/env bash",
"set -euo pipefail",
] + [
'cp -fv doc/{file}.gen.md "$BUILD_WORKSPACE_DIRECTORY/doc/README.md"'.format(
file = file,
)
for file in _DOC_SRCS
],
)
sh_binary(
name = "update",
srcs = ["update.sh"],
data = [file + ".gen.md" for file in _DOC_SRCS],
)
[
diff_test(
name = "check_" + file,
failure_message = "\nPlease update the docs by running\n bazel run //doc:update",
file1 = file + ".gen.md",
file2 = "README.md",
)
for file in _DOC_SRCS
]