@@ -23,6 +23,7 @@ to produce FlatBuffers binary representations of the parsed diagrams.
2323"""
2424
2525load ("//bazel/rules/rules_score:providers.bzl" , "ArchitecturalDesignInfo" , "SphinxSourcesInfo" )
26+ load ("//bazel/rules/rules_score/private:puml_utils.bzl" , "make_puml_rst_wrappers" )
2627load ("//bazel/rules/rules_score/private:verbosity.bzl" , "VERBOSITY_ATTR" , "get_log_level" )
2728
2829# ============================================================================
@@ -149,6 +150,17 @@ def _architectural_design_impl(ctx):
149150 transitive = [all_source_files ],
150151 )
151152
153+ # Generate a thin RST wrapper for every .puml diagram so it appears as a
154+ # toctree entry in the dependable_element index.
155+ rst_wrappers = make_puml_rst_wrappers (
156+ ctx ,
157+ ctx .files .static + ctx .files .dynamic ,
158+ ctx .label .name ,
159+ ctx .file ._puml_rst_template ,
160+ )
161+
162+ sphinx_srcs = depset (rst_wrappers , transitive = [sphinx_files ])
163+
152164 return [
153165 DefaultInfo (files = all_source_files ),
154166 ArchitecturalDesignInfo (
@@ -160,8 +172,9 @@ def _architectural_design_impl(ctx):
160172 ),
161173 # Source diagram files + plantuml_links.json for the sphinx documentation build
162174 SphinxSourcesInfo (
163- srcs = sphinx_files ,
164- deps = sphinx_files ,
175+ srcs = sphinx_srcs ,
176+ deps = sphinx_srcs ,
177+ ancillary = depset (),
165178 ),
166179 ]
167180
@@ -205,6 +218,11 @@ _architectural_design = rule(
205218 cfg = "exec" ,
206219 doc = "Tool that generates plantuml_links.json from FlatBuffers diagram outputs" ,
207220 ),
221+ "_puml_rst_template" : attr .label (
222+ default = Label ("//bazel/rules/rules_score:templates/puml_diagram.template.rst" ),
223+ allow_single_file = True ,
224+ doc = "RST template for PlantUML diagram wrapper pages." ,
225+ ),
208226 },
209227 ** VERBOSITY_ATTR
210228 ),
0 commit comments