@@ -280,6 +280,21 @@ def _process_artifact_files(ctx, artifact_name, label):
280280 .replace (".md" , "" )
281281 index_refs .append (doc_ref )
282282
283+ # Symlink ancillary files (present for sub-toctrees / .. uml:: resolution,
284+ # but NOT added to the outer toctree index).
285+ if SphinxSourcesInfo in label :
286+ for anc_file in label [SphinxSourcesInfo ].ancillary .to_list ():
287+ if anc_file .extension not in ["rst" , "md" , "puml" , "plantuml" , "png" , "svg" , "inc" , "json" ]:
288+ continue
289+ relative_path = _compute_relative_path (anc_file , _find_common_directory ([anc_file ]))
290+ output_file = _create_artifact_symlink (
291+ ctx ,
292+ artifact_name ,
293+ anc_file ,
294+ relative_path ,
295+ )
296+ output_files .append (output_file )
297+
283298 return (output_files , index_refs )
284299
285300def _process_artifact_type (ctx , artifact_name ):
@@ -686,10 +701,8 @@ def _dependable_element_index_impl(ctx):
686701
687702 # Process each well-known artifact type into symlinked output files and
688703 # toctree references for the index template.
689- # "requirements" covers both feature_requirements and component_requirements.
690704 artifact_types = [
691705 "assumptions_of_use" ,
692- "requirements" ,
693706 "architectural_design" ,
694707 "dependability_analysis" ,
695708 "checklists" ,
@@ -701,6 +714,24 @@ def _dependable_element_index_impl(ctx):
701714 output_files .extend (files )
702715 artifacts_by_type [artifact_name ] = refs
703716
717+ # Collect feature_requirements refs from requirements targets that
718+ # carry FeatureRequirementsInfo.
719+ feature_req_refs = []
720+ for req_target in ctx .attr .requirements :
721+ if FeatureRequirementsInfo in req_target :
722+ label_files , label_refs = _process_artifact_files (ctx , "feature_requirements" , req_target )
723+ output_files .extend (label_files )
724+ feature_req_refs .extend (label_refs )
725+
726+ # Collect assumed_system_requirements refs from requirements targets that
727+ # carry AssumedSystemRequirementsInfo.
728+ assumed_system_req_refs = []
729+ for req_target in ctx .attr .requirements :
730+ if AssumedSystemRequirementsInfo in req_target :
731+ label_files , label_refs = _process_artifact_files (ctx , "assumed_system_requirements" , req_target )
732+ output_files .extend (label_files )
733+ assumed_system_req_refs .extend (label_refs )
734+
704735 # Collect all units recursively from components
705736 all_units = _collect_units_recursive (ctx .attr .components )
706737
@@ -746,18 +777,11 @@ def _dependable_element_index_impl(ctx):
746777 if CertifiedScope in dep :
747778 collected_certified_scopes .append (dep [CertifiedScope ].transitive_scopes )
748779
749- # Generate an intermediate components/index.rst that groups all component pages
750- # under a single "Components" navigation entry in the Sphinx sidebar.
780+ # Reference component pages directly in the outer toctree, avoiding an
781+ # intermediate components/index.rst that would repeat "Components" in the
782+ # Sphinx sidebar navigation.
751783 if component_refs :
752- comp_index_rst = ctx .actions .declare_file (ctx .label .name + "/components/index.rst" )
753- comp_index_underline = "=" * len ("Components" )
754- comp_toctree_entries = "\n " .join (component_refs )
755- ctx .actions .write (
756- output = comp_index_rst ,
757- content = "Components\n " + comp_index_underline + "\n \n .. toctree::\n :maxdepth: 2\n \n " + comp_toctree_entries + "\n " ,
758- )
759- output_files .append (comp_index_rst )
760- components_ref = "components/index"
784+ components_ref = "\n " .join (["components/" + name for name in component_refs ])
761785 else :
762786 components_ref = ""
763787
@@ -775,8 +799,9 @@ def _dependable_element_index_impl(ctx):
775799 "{title}" : title ,
776800 "{underline}" : underline ,
777801 "{components}" : components_ref ,
802+ "{assumed_system_requirements}" : "\n " .join (assumed_system_req_refs ),
778803 "{assumptions_of_use}" : "\n " .join (artifacts_by_type ["assumptions_of_use" ]),
779- "{requirements }" : "\n " .join (artifacts_by_type [ "requirements" ] ),
804+ "{feature_requirements }" : "\n " .join (feature_req_refs ),
780805 "{architectural_design}" : "\n " .join (artifacts_by_type ["architectural_design" ]),
781806 "{dependability_analysis}" : "\n " .join (artifacts_by_type ["dependability_analysis" ]),
782807 "{checklists}" : "\n " .join (artifacts_by_type ["checklists" ]),
@@ -1000,8 +1025,8 @@ _dependable_element_index = rule(
10001025 ),
10011026 "requirements" : attr .label_list (
10021027 mandatory = True ,
1003- providers = [FeatureRequirementsInfo ],
1004- doc = "Feature requirements targets (feature_requirements only) ." ,
1028+ providers = [[ FeatureRequirementsInfo ], [ AssumedSystemRequirementsInfo ] ],
1029+ doc = "Feature or assumed system requirements targets ." ,
10051030 ),
10061031 "architectural_design" : attr .label_list (
10071032 mandatory = True ,
0 commit comments