forked from bazel-contrib/bazel-gazelle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stardoc generates repository.md (bazel-contrib#1123)
* Stardoc generates repository.md This is a mirror of the content in repository.rst, allowing us to manually inspect the delta between them. As soon as we are satisfied that the generated content is correct, we'll delete repository.rst and update any links to it. Technique: copied doc strings out of existing rst file into the starlark files. Transcribed rst syntax to markdown. * Replace repository.rst content with link to markdown version
- Loading branch information
Showing
11 changed files
with
708 additions
and
471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
"""Documentation generation with stardoc | ||
This is in a separate package from both the stardoc source files and the | ||
resulting documentation markdown files, to prevent users trying to load() | ||
the stardoc repository, which is not a dependency users should install. | ||
""" | ||
load("@bazel_skylib//rules:write_file.bzl", "write_file") | ||
load("@bazel_skylib//rules:diff_test.bzl", "diff_test") | ||
load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc") | ||
|
||
_DOC_SRCS = { | ||
"//internal:repository_docs": "repository.md", | ||
} | ||
|
||
[ | ||
stardoc( | ||
name = out.replace(".md", "_docgen"), | ||
out = out, | ||
# Convention: foo.bzl has bzl_library named "foo" | ||
input = input + ".bzl", | ||
deps = [input], | ||
) | ||
for [input, out] in _DOC_SRCS.items() | ||
] | ||
|
||
[ | ||
diff_test( | ||
name = "check_" + out, | ||
failure_message = "Please run bazel run //docs:update", | ||
# source file (InputArtifact) | ||
file1 = "//:" + out, | ||
# result from stardoc rule above | ||
file2 = out, | ||
) | ||
for out in _DOC_SRCS.values() | ||
] | ||
|
||
write_file( | ||
name = "gen_update", | ||
out = "update.sh", | ||
content = [ | ||
"#!/usr/bin/env bash", | ||
"cd $BUILD_WORKSPACE_DIRECTORY", | ||
] + [ | ||
"cp -fv bazel-bin/docs/{0} {0}".format(v) | ||
for v in _DOC_SRCS.values() | ||
], | ||
) | ||
|
||
sh_binary( | ||
name = "update", | ||
srcs = ["update.sh"], | ||
data = _DOC_SRCS.values(), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.