You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Creates a stardoc target, diff test, and an executable to rule to write the generated doc to the source tree and test that it's up to date.
10
+
"""Creates a stardoc target that can be auto-detected by update_docs to write the generated doc to the source tree and test that it's up to date.
12
11
13
12
This is helpful for minimizing boilerplate in repos wih lots of stardoc targets.
14
13
15
14
Args:
16
15
name: the name of the stardoc file to be written to the current source directory (.md will be appended to the name). Call bazel run on this target to update the file.
17
16
bzl_library_target: the label of the `bzl_library` target to generate documentation for
18
-
suggested_update_target: the target suggested to be run when a doc is out of date (should be the label for [update_docs](#update_docs))
19
17
**kwargs: additional attributes passed to the stardoc() rule, such as for overriding the templates
20
18
"""
21
19
22
-
stardoc_label=name+"-docgen"
23
-
out_file=name+".md"
24
-
25
20
# Generate MD from .bzl
26
-
stardoc(
27
-
name=stardoc_label,
21
+
_stardoc(
22
+
name=name,
28
23
out=name+"-docgen.md",
29
24
input=bzl_library_target+".bzl",
30
25
deps= [bzl_library_target],
31
26
tags= ["package:"+native.package_name()], # Tag the package name which will help us reconstruct the write_source_files label in update_docs
32
27
**kwargs
33
28
)
34
29
35
-
write_source_files(
36
-
name=name,
37
-
suggested_update_target=suggested_update_target,
38
-
files= {
39
-
out_file: ":"+stardoc_label,
40
-
},
41
-
)
42
-
43
30
defupdate_docs(name="update"):
44
31
"""Stamps an executable run for writing all stardocs declared with stardoc_with_diff_test to the source tree.
0 commit comments