-
Notifications
You must be signed in to change notification settings - Fork 4
/
BUILD.bazel
116 lines (101 loc) · 2.37 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
load(
"//bazeldoc:defs.bzl",
"doc_for_provs",
"write_file_list",
"write_header",
doc_providers = "providers",
)
load("//bzlformat:defs.bzl", "bzlformat_pkg")
bzlformat_pkg(name = "bzlformat")
filegroup(
name = "doc_files",
srcs = glob(["*.md"]),
visibility = ["//:markdown_test_visibility"],
)
# MARK: - Documentation Providers
_RULE_NAMES = [
"create_release",
"generate_release_notes",
"generate_workspace_snippet",
"hash_sha256",
"release_archive",
"update_readme",
]
_RULE_DOC_PROVIDERS = [
doc_providers.create(
name = rule,
stardoc_input = "//bzlrelease:defs.bzl",
symbols = [rule],
deps = ["//bzlrelease:defs"],
)
for rule in _RULE_NAMES
]
_API_DOC_PROVIDERS = []
_ALL_DOC_PROVIDERS = [
doc_providers.create(
name = "api",
is_stardoc = False,
stardoc_input = "",
deps = [],
),
doc_providers.create(
name = "rules",
is_stardoc = False,
stardoc_input = "",
deps = [],
),
] + _RULE_DOC_PROVIDERS + _API_DOC_PROVIDERS
# MARK: - Headers
# Write rule headers
[
write_header(
name = doc_prov.header_label,
out = doc_prov.header_basename,
header_content = [
"# `{name}` Rule".format(name = doc_prov.name),
],
)
for doc_prov in _RULE_DOC_PROVIDERS
if doc_prov.is_stardoc
]
# Write the API headers
[
write_header(
name = doc_prov.header_label,
out = doc_prov.header_basename,
header_content = [
"# `{name}` API".format(name = doc_prov.name),
],
)
for doc_prov in _API_DOC_PROVIDERS
if doc_prov.is_stardoc
]
# MARK: - Special Case api.md
# Write the api.md_ file as a special case.
write_file_list(
name = "api_doc",
out = "api.md_",
doc_provs = _API_DOC_PROVIDERS,
header_content = [
"# Build API",
"",
"The APIs listed below are available in this repository.",
"",
],
)
# Write the rules.md_ file as a special case.
write_file_list(
name = "rules_doc",
out = "rules.md_",
doc_provs = _RULE_DOC_PROVIDERS,
header_content = [
"# Rules",
"",
"The rules listed below are available in this repository.",
"",
],
)
# MARK: - Generate Documentation from Providers
doc_for_provs(
doc_provs = _ALL_DOC_PROVIDERS,
)