Skip to content

Generate API documentation using Stardoc#139

Merged
mergify[bot] merged 14 commits intomasterfrom
stardoc
Nov 30, 2020
Merged

Generate API documentation using Stardoc#139
mergify[bot] merged 14 commits intomasterfrom
stardoc

Conversation

@aherrmann
Copy link
Copy Markdown
Contributor

Closes #138

  • Extends the docstrings of the various rules to match the documentation in the project README.
  • Updates rules_go for stardoc compatibility, see Add bzl_library targets for Stardoc compatibility bazel-contrib/rules_go#2620.
  • Defines stardoc targets for nixpkgs/nixpkgs.bzl and nixpkgs/toolchains/go.bzl.
  • Defines a README template that can be used to generate the project README by substituting Stardoc generated documentation.
  • Defines automation to update the project README and check that it is up-to-date on CI.
  • Updates the project README.

@aherrmann aherrmann requested review from Profpatsch and mboes August 24, 2020 14:52
Copy link
Copy Markdown
Contributor

@Profpatsch Profpatsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you still need to add the check script to CI.

Other than that, LGTM.

Comment thread docs/README.md.tpl Outdated

%nixpkgs%

%toolchains_go%
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slight nitpick: if you use {{}} instead, it’s a bit more visible

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Profpatsch
Copy link
Copy Markdown
Contributor

Nvm, the test is automatically picked up by bazel test.

Some functionality was only documented in the README but not in the
docstrings of the corresponding rules. This adds such missing
documentation to the docstrings.
These `bzl_library` targets are required to build Stardoc documentation
for `//nixpkgs:toolchains/go.bzl` which loads `rules_go`.
We use custom templates to match the header levels with the README.
This substitutes the Stardoc generated API documentation into the README
template and defines automation to update the project README file and
test that it is up-to-date on CI.
The stardoc templates applied `htmlEscape` when this is not necessary
for markdown output. As a result `<>` characters that appeared within
code snippets where translated to html entities which would then render
as `&lt;`/`&gt;`.
A PR fixing the issue of unexposed bzl_library targets for rules_go has
been fixed on rules_go master by now.
To avoid the following type of error on CI
```
ERROR: /var/lib/buildkite-agent-agent/.cache/bazel/_bazel_buildkite-agent-agent/3cdbb0e8c4afb0ca9493ed6bd8d63bbb/external/bazel_tools/tools/jdk/BUILD:346:14: Action external/bazel_tools/tools/jdk/platformclasspath_classes/DumpPlatformClassPath.class failed (Exit 1) javac failed: error executing command external/remotejdk11_linux/bin/javac -source 8 -target 8 -Xlint:-options -cp external/remotejdk11_linux/lib/tools.jar -d bazel-out/host/bin/external/bazel_tools/tools/jdk/platformclasspath_classes ... (remaining 1 argument(s) skipped)
```
Copy link
Copy Markdown
Contributor Author

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Rebased this PR on latest master.
  • Update the README to include nixpkgs_cc_configure_deprecated.
  • The docstring of the new nixpkgs_cc_configure triggered an issue with the stardoc templates which applied html escape which is not necessary for markdown output. This caused verbatim entities like &lt; to show up in the rendered README. This is fixed by not applying html escape.
  • Updated rules_go which now includes the necessary bzl_library targets upstream: bazel-contrib/rules_go#2621 .
  • The use of Starlark triggered issues with the JDK on NixOS on CI. These are fixed by updating nixpkgs to include NixOS/nixpkgs#98611 and including a JDK in the Nix shell.

@aherrmann aherrmann added the merge-queue merge on green CI label Nov 30, 2020
@mergify mergify Bot merged commit acb9e36 into master Nov 30, 2020
@mergify mergify Bot deleted the stardoc branch November 30, 2020 17:03
@mergify mergify Bot removed the merge-queue merge on green CI label Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API docs in README and docstrings are not synced

2 participants