Skip to content

Commit

Permalink
Generate setup.md from sources (#619)
Browse files Browse the repository at this point in the history
This is the last doc that should be generated from sources, but wasn't, from what I can tell.
  • Loading branch information
alexeagle authored May 19, 2021
1 parent ae0c5bd commit 9f42d75
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 11 deletions.
21 changes: 19 additions & 2 deletions doc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ write_file(
],
)

write_file(
name = "setup_header",
out = "setup_header.vm",
content = [
"<!-- Generated with Stardoc, Do Not Edit! -->",
"# Workspace Setup",
],
)

[
stardoc(
name = file + "_doc",
Expand All @@ -105,6 +114,14 @@ write_file(
] in _DOC_SRCS.items()
]

stardoc(
name = "setup_doc",
out = "setup.md_",
header_template = "setup_header.vm",
input = "//swift:repositories.bzl",
deps = ["//swift:repositories"],
)

# To make these tests pass, run
# bazel run //doc:update
[
Expand All @@ -113,7 +130,7 @@ write_file(
file1 = file + ".md_",
file2 = file + ".md",
)
for file in _DOC_SRCS.keys()
for file in _DOC_SRCS.keys() + ["setup"]
]

write_file(
Expand All @@ -126,7 +143,7 @@ write_file(
"cp -fv bazel-bin/doc/{0}.md_ doc/{0}.md".format(
file,
)
for file in _DOC_SRCS.keys()
for file in _DOC_SRCS.keys() + ["setup"]
],
)

Expand Down
15 changes: 9 additions & 6 deletions doc/setup.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
<!-- Generated with Stardoc, Do Not Edit! -->
# Workspace Setup
<a id="#swift_rules_dependencies"></a>


<a href="swift_rules_dependencies"></a>
## swift_rules_dependencies

<pre style="white-space: pre-wrap">
<pre>
swift_rules_dependencies()
</pre>

Fetches repositories that are dependencies of the `rules_swift` workspace.
Fetches repositories that are dependencies of `rules_swift`.

Users should call this macro in their `WORKSPACE` to ensure that all of the
dependencies of the Swift rules are downloaded and that they are isolated from
changes to those dependencies.
dependencies of the Swift rules are downloaded and that they are isolated
from changes to those dependencies.




6 changes: 4 additions & 2 deletions doc/stardoc.pr103.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ diff stardoc/templates/markdown_tables/func.vm stardoc/templates/markdown_tables
index e53e639..1b7bd7a 100644
--- stardoc/templates/markdown_tables/func.vm
+++ stardoc/templates/markdown_tables/func.vm
@@ -18,3 +18,7 @@ ${funcInfo.docString}
@@ -18,3 +18,9 @@ ${funcInfo.docString}
| <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|
#end
#end
+
+#if (!$funcInfo.return.docString.isEmpty())
+**RETURNS**
+
+${funcInfo.return.docString}
+${funcInfo.return.docString}
+#end
7 changes: 6 additions & 1 deletion swift/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ package(default_visibility = ["//visibility:public"])

licenses(["notice"])

bzl_library(
name = "bazel_tools_bzl",
srcs = ["@bazel_tools//tools:bzl_srcs"],
)

bzl_library(
name = "repositories",
srcs = ["repositories.bzl"],
deps = [
":bazel_tools_bzl",
"//swift/internal:swift_autoconfiguration",
"@bazel_tools//tools/build_defs/repo:http.bzl",
],
)

Expand Down

0 comments on commit 9f42d75

Please sign in to comment.