@@ -59,6 +59,141 @@ Builds Sphinx-based HTML documentation from RST source files with support for de
5959**Output: ** ``<name>/html/ `` with merged dependency documentation
6060
6161
62+ Artifact Rules
63+ --------------
64+
65+ Artifact rules define S-CORE process work products. All provide ``SphinxSourcesInfo `` for documentation generation.
66+
67+ **feature_requirements **
68+
69+ .. code-block :: python
70+
71+ feature_requirements(
72+ name = " features" ,
73+ srcs = [" docs/features.rst" ],
74+ )
75+
76+ **component_requirements **
77+
78+ .. code-block :: python
79+
80+ component_requirements(
81+ name = " requirements" ,
82+ srcs = [" docs/requirements.rst" ],
83+ )
84+
85+ **assumptions_of_use **
86+
87+ .. code-block :: python
88+
89+ assumptions_of_use(
90+ name = " aous" ,
91+ srcs = [" docs/assumptions.rst" ],
92+ )
93+
94+ **architectural_design **
95+
96+ .. code-block :: python
97+
98+ architectural_design(
99+ name = " architecture" ,
100+ static = [" docs/static_arch.rst" ],
101+ dynamic = [" docs/dynamic_arch.rst" ],
102+ )
103+
104+ **safety_analysis **
105+
106+ .. code-block :: python
107+
108+ safety_analysis(
109+ name = " safety" ,
110+ controlmeasures = [" docs/controls.rst" ],
111+ failuremodes = [" docs/failures.rst" ],
112+ fta = [" docs/fta.rst" ],
113+ arch_design = " :architecture" ,
114+ )
115+
116+ **dependability_analysis **
117+
118+ .. code-block :: python
119+
120+ dependability_analysis(
121+ name = " analysis" ,
122+ arch_design = " :architecture" ,
123+ dfa = [" docs/dfa.rst" ],
124+ safety_analysis = [" :safety" ],
125+ )
126+
127+
128+ Structural Rules
129+ ----------------
130+
131+ **unit **
132+
133+ Define the smallest testable software element.
134+
135+ .. code-block :: python
136+
137+ unit(
138+ name = " my_unit" ,
139+ unit_design = [" :architecture" ],
140+ implementation = [" //src:lib" ],
141+ tests = [" //tests:unit_test" ],
142+ )
143+
144+ **component **
145+
146+ Define a collection of units.
147+
148+ .. code-block :: python
149+
150+ component(
151+ name = " my_component" ,
152+ component_requirements = [" :requirements" ],
153+ units = [" :my_unit" ],
154+ implementation = [" //src:binary" ],
155+ tests = [" //tests:integration_test" ],
156+ )
157+
158+ **dependable_element **
159+
160+ Define a complete SEooC with automatic documentation generation.
161+
162+ .. code-block :: python
163+
164+ dependable_element(
165+ name = " my_seooc" ,
166+ description = " My safety-critical component" ,
167+ assumptions_of_use = [" :aous" ],
168+ requirements = [" :requirements" ],
169+ architectural_design = [" :architecture" ],
170+ dependability_analysis = [" :analysis" ],
171+ components = [" :my_component" ],
172+ tests = [" //tests:system_test" ],
173+ deps = [" @platform//:platform_module" ],
174+ )
175+
176+ **Generated Targets: **
177+
178+ - ``<name> ``: Sphinx module with HTML documentation
179+ - ``<name>_needs ``: Sphinx-needs JSON for cross-referencing
180+ - ``<name>_index ``: Generated index.rst with artifact structure
181+
182+ srcs = glob(["docs/**/*.rst"]),
183+ index = "docs/index.rst",
184+ deps = ["@external_module//:docs"],
185+ )
186+
187+ **Key Parameters: **
188+
189+ - ``srcs ``: RST/MD source files
190+ - ``index ``: Main index.rst file
191+ - ``deps ``: Other sphinx_module or dependable_element targets for cross-referencing
192+ - ``sphinx ``: Sphinx build binary (default: ``//bazel/rules/rules_score:score_build ``)
193+
194+ **Output: ** ``<name>/html/ `` with merged dependency documentation
195+
196+
62197Artifact Rules
63198--------------
64199
@@ -180,6 +315,14 @@ Define a complete SEooC with automatic documentation generation.
180315- ``<name>_needs ``: Sphinx-needs JSON for cross-referencing
181316- ``<name>_index ``: Generated index.rst with artifact structure
182317
318+ **Implementation Details: **
319+
320+ The macro automatically:
321+
322+ - Generates an index.rst file with a toctree referencing all provided artifacts
323+ - Creates symlinks to artifact files (assumptions of use, requirements, architecture, safety analysis) for co-location with the generated index
324+ - Delegates to ``sphinx_module `` for actual Sphinx build and HTML generation
325+ - Integrates dependencies for cross-module referencing and HTML merging
183326
184327Dependency Management
185328---------------------
@@ -248,6 +391,49 @@ Build:
248391 bazel build //:persistency_kvs
249392 # Output: bazel-bin/persistency_kvs/html/
250393
394+ # Implementation
395+ cc_library(name = " kvs_lib" , srcs = [" kvs.cpp" ], hdrs = [" kvs.h" ])
396+ cc_test(name = " kvs_test" , srcs = [" kvs_test.cpp" ], deps = [" :kvs_lib" ])
397+
398+ # Structure
399+ unit(name = " kvs_unit" , unit_design = [" :arch" ],
400+ implementation = [" :kvs_lib" ], tests = [" :kvs_test" ])
401+ component(name = " kvs_component" , component_requirements = [" :reqs" ],
402+ units = [" :kvs_unit" ], implementation = [" :kvs_lib" ], tests = [])
403+
404+ # SEooC
405+ dependable_element(
406+ name = " persistency_kvs" ,
407+ description = " Key-Value Store for persistent data storage" ,
408+ assumptions_of_use = [" :aous" ],
409+ requirements = [" :reqs" ],
410+ architectural_design = [" :arch" ],
411+ dependability_analysis = [" :analysis" ],
412+ components = [" :kvs_component" ],
413+ tests = [],
414+ deps = [" @score_process//:score_process_module" ],
415+ )
416+
417+ Build:
418+
419+ .. code-block :: bash
420+
421+ bazel build //:kvs_seooc
422+ # Output: bazel-bin/kvs_seooc/html/
423+ # Includes merged HTML from score_platform and score_process modules
424+
425+ Design Rationale
426+ ----------------
427+
428+ These rules provide a structured approach to documentation by:
429+
430+ 1. **Two-Tier Architecture **: Generic ``sphinx_module `` for flexibility, specialized ``score_component `` for safety-critical work
431+ 2. **Dependency Management **: Automatic cross-referencing and HTML merging across modules
432+ 3. **Standardization **: SEooC enforces consistent structure for safety documentation
433+ 4. **Traceability **: Sphinx-needs integration enables bidirectional traceability
434+ 5. **Automation **: Index generation, symlinking, and configuration management are automatic
435+ 6. **Build System Integration **: Bazel ensures reproducible, cacheable documentation builds
436+
251437Reference Implementation
252438------------------------
253439
0 commit comments