forked from tweag/rules_nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.bazel
72 lines (67 loc) · 1.54 KB
/
BUILD.bazel
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
load("stardoc.bzl", "stardoc")
stardoc(
name = "nixpkgs",
out = "nixpkgs.md",
input = "//nixpkgs:nixpkgs.bzl",
symbol_names = [
"nixpkgs_git_repository",
"nixpkgs_local_repository",
"nixpkgs_package",
"nixpkgs_cc_configure",
"nixpkgs_cc_configure_deprecated",
"nixpkgs_python_configure",
"nixpkgs_sh_posix_configure",
],
deps = ["//nixpkgs"],
)
stardoc(
name = "go",
out = "toolchains/go.md",
input = "//nixpkgs:toolchains/go.bzl",
symbol_names = [
"nixpkgs_go_configure",
],
deps = ["//nixpkgs:toolchains_go"],
)
genrule(
name = "readme",
srcs = [
"README.md.tpl",
"nixpkgs.md",
"toolchains/go.md",
],
outs = ["README.md"],
cmd = """$(POSIX_AWK) \\
<$(execpath README.md.tpl) \\
>$(OUTS) \\
'{
if (/{{nixpkgs}}/) {
RS="\\0";
getline content <"$(execpath nixpkgs.md)";
print content
} else if (/{{toolchains_go}}/) {
RS="\\0";
getline content <"$(execpath toolchains/go.md)";
print content
} else {
print
}
}'
""",
toolchains = ["@rules_sh//sh/posix:make_variables"],
)
sh_test(
name = "check-readme",
srcs = ["check-readme.sh"],
data = [
"README.md",
"//:README.md",
],
deps = ["@bazel_tools//tools/bash/runfiles"],
)
sh_binary(
name = "update-readme",
srcs = ["update-readme.sh"],
data = ["README.md"],
deps = ["@bazel_tools//tools/bash/runfiles"],
)