Skip to content

Commit 7fd7aa5

Browse files
authored
Generate setup.md from sources (bazelbuild#619)
This is the last doc that should be generated from sources, but wasn't, from what I can tell.
1 parent b170ee0 commit 7fd7aa5

File tree

4 files changed

+38
-11
lines changed

4 files changed

+38
-11
lines changed

doc/BUILD.bazel

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ write_file(
9090
],
9191
)
9292

93+
write_file(
94+
name = "setup_header",
95+
out = "setup_header.vm",
96+
content = [
97+
"<!-- Generated with Stardoc, Do Not Edit! -->",
98+
"# Workspace Setup",
99+
],
100+
)
101+
93102
[
94103
stardoc(
95104
name = file + "_doc",
@@ -105,6 +114,14 @@ write_file(
105114
] in _DOC_SRCS.items()
106115
]
107116

117+
stardoc(
118+
name = "setup_doc",
119+
out = "setup.md_",
120+
header_template = "setup_header.vm",
121+
input = "//swift:repositories.bzl",
122+
deps = ["//swift:repositories"],
123+
)
124+
108125
# To make these tests pass, run
109126
# bazel run //doc:update
110127
[
@@ -113,7 +130,7 @@ write_file(
113130
file1 = file + ".md_",
114131
file2 = file + ".md",
115132
)
116-
for file in _DOC_SRCS.keys()
133+
for file in _DOC_SRCS.keys() + ["setup"]
117134
]
118135

119136
write_file(
@@ -126,7 +143,7 @@ write_file(
126143
"cp -fv bazel-bin/doc/{0}.md_ doc/{0}.md".format(
127144
file,
128145
)
129-
for file in _DOC_SRCS.keys()
146+
for file in _DOC_SRCS.keys() + ["setup"]
130147
],
131148
)
132149

doc/setup.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1+
<!-- Generated with Stardoc, Do Not Edit! -->
12
# Workspace Setup
3+
<a id="#swift_rules_dependencies"></a>
24

3-
4-
<a href="swift_rules_dependencies"></a>
55
## swift_rules_dependencies
66

7-
<pre style="white-space: pre-wrap">
7+
<pre>
88
swift_rules_dependencies()
99
</pre>
1010

11-
Fetches repositories that are dependencies of the `rules_swift` workspace.
11+
Fetches repositories that are dependencies of `rules_swift`.
1212

1313
Users should call this macro in their `WORKSPACE` to ensure that all of the
14-
dependencies of the Swift rules are downloaded and that they are isolated from
15-
changes to those dependencies.
14+
dependencies of the Swift rules are downloaded and that they are isolated
15+
from changes to those dependencies.
16+
17+
18+
1619

doc/stardoc.pr103.patch

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ diff stardoc/templates/markdown_tables/func.vm stardoc/templates/markdown_tables
22
index e53e639..1b7bd7a 100644
33
--- stardoc/templates/markdown_tables/func.vm
44
+++ stardoc/templates/markdown_tables/func.vm
5-
@@ -18,3 +18,7 @@ ${funcInfo.docString}
5+
@@ -18,3 +18,9 @@ ${funcInfo.docString}
66
| <a id="${funcInfo.functionName}-${param.name}"></a>$param.name | #if(!$param.docString.isEmpty()) ${util.markdownCellFormat($param.docString)} #else <p align="center"> - </p> #end | #if(!$param.getDefaultValue().isEmpty()) <code>$param.getDefaultValue()</code> #else none #end|
77
#end
88
#end
99
+
10+
+#if (!$funcInfo.return.docString.isEmpty())
1011
+**RETURNS**
1112
+
12-
+${funcInfo.return.docString}
13+
+${funcInfo.return.docString}
14+
+#end

swift/BUILD

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ package(default_visibility = ["//visibility:public"])
99

1010
licenses(["notice"])
1111

12+
bzl_library(
13+
name = "bazel_tools_bzl",
14+
srcs = ["@bazel_tools//tools:bzl_srcs"],
15+
)
16+
1217
bzl_library(
1318
name = "repositories",
1419
srcs = ["repositories.bzl"],
1520
deps = [
21+
":bazel_tools_bzl",
1622
"//swift/internal:swift_autoconfiguration",
17-
"@bazel_tools//tools/build_defs/repo:http.bzl",
1823
],
1924
)
2025

0 commit comments

Comments
 (0)