1+ load ("@aspect_rules_py//py:defs.bzl" , "py_binary" )
2+
13# *******************************************************************************
24# Copyright (c) 2025 Contributors to the Eclipse Foundation
35#
2628 "unit" ,
2729 "unit_design" ,
2830)
31+ load ("@score_tooling//bazel/rules/rules_score:sphinx_toolchain.bzl" , "sphinx_toolchain" )
2932load ("@trlc//:trlc.bzl" , "trlc_requirements" , "trlc_requirements_test" )
3033load (
3134 ":html_generation_test.bzl" ,
9396
9497package (default_visibility = ["//visibility:public" ])
9598
99+ # ============================================================================
100+ # Sphinx Toolchain — uses score_docs_as_code so score_metamodel is importable
101+ # ============================================================================
102+
103+ exports_files (["template/conf.template.py" ])
104+
105+ py_binary (
106+ name = "score_build" ,
107+ srcs = ["@score_tooling//bazel/rules/rules_score:src/sphinx_wrapper.py" ],
108+ main = "@score_tooling//bazel/rules/rules_score:src/sphinx_wrapper.py" ,
109+ package_collisions = "warning" ,
110+ visibility = ["//visibility:public" ],
111+ deps = [
112+ "@score_docs_as_code//src:plantuml_for_python" ,
113+ "@score_docs_as_code//src/extensions/score_sphinx_bundle" ,
114+ "@score_tooling//bazel/rules/rules_score:bazel_sphinx_needs" ,
115+ "@score_tooling//bazel/rules/rules_score:sphinx_module_ext" ,
116+ ],
117+ )
118+
119+ sphinx_toolchain (
120+ name = "score_sphinx_toolchain" ,
121+ conf_template = "//:template/conf.template.py" ,
122+ html_merge_tool = "@score_tooling//bazel/rules/rules_score:sphinx_html_merge" ,
123+ sphinx = ":score_build" ,
124+ )
125+
126+ toolchain (
127+ name = "score_toolchain" ,
128+ toolchain = ":score_sphinx_toolchain" ,
129+ toolchain_type = "@score_tooling//bazel/rules/rules_score:toolchain_type" ,
130+ )
131+
96132# ============================================================================
97133# Test Fixtures - Module Definitions
98134# ============================================================================
@@ -274,7 +310,7 @@ unit_design(
274310unit (
275311 name = "test_unit" ,
276312 testonly = True ,
277- scope = ["//bazel/rules/rules_score/test :mock_lib1" ],
313+ scope = ["//:mock_lib1" ],
278314 tests = [":test_unit_tests" ],
279315 unit_design = [":test_unit_design" ],
280316 implementation = [
@@ -700,26 +736,11 @@ aous_rst_sphinx_test(
700736requirements_rst_test_suite (name = "requirements_rst_tests" )
701737
702738# ============================================================================
703- # Image srcs Tests
739+ # Image srcs Tests (defined in sub-package to avoid workspace-root edge case)
704740# ============================================================================
705-
706- # Fixture: feature_requirements with image_srcs
707- feature_requirements (
708- name = "feat_req_with_image" ,
709- srcs = ["fixtures/seooc_test/feature_requirements.trlc" ],
710- image_srcs = [
711- "fixtures/image_srcs/diagrams/arch.svg" ,
712- "fixtures/image_srcs/diagrams/arch.png" ,
713- ],
714- deps = [":asr_trlc" ],
715- )
716-
717- image_srcs_sphinx_sources_test (
718- name = "image_srcs_sphinx_sources_test" ,
719- target_under_test = ":feat_req_with_image" ,
720- )
721-
722- requirements_image_test_suite (name = "requirements_image_tests" )
741+ # feat_req_with_image and image_srcs_sphinx_sources_test live in
742+ # //fixtures/image_srcs so that ctx.label.package is non-empty and
743+ # subrule_trlc_image_stage can strip the prefix correctly.
723744
724745# ============================================================================
725746# Combined Test Suite
@@ -736,7 +757,7 @@ requirements_image_test_suite(name = "requirements_image_tests")
736757trlc_requirements (
737758 name = "safety_measures_fixtures" ,
738759 srcs = ["fixtures/seooc_test/safety_measures_fixtures.trlc" ],
739- spec = ["//bazel/rules/rules_score/trlc/config:score_requirements_model" ],
760+ spec = ["@score_tooling //bazel/rules/rules_score/trlc/config:score_requirements_model" ],
740761)
741762
742763trlc_requirements_test (
@@ -748,22 +769,22 @@ py_test(
748769 name = "test_safety_analysis_tools" ,
749770 size = "small" ,
750771 srcs = ["test_safety_analysis_tools.py" ],
751- deps = ["//bazel/rules/rules_score:safety_analysis_tools" ],
772+ deps = ["@score_tooling //bazel/rules/rules_score:safety_analysis_tools" ],
752773)
753774
754775py_test (
755776 name = "test_aou_forwarding_to_lobster" ,
756777 size = "small" ,
757778 srcs = ["test_aou_forwarding_to_lobster.py" ],
758- deps = ["//bazel/rules/rules_score:aou_forwarding_to_lobster" ],
779+ deps = ["@score_tooling //bazel/rules/rules_score:aou_forwarding_to_lobster" ],
759780)
760781
761782py_test (
762783 name = "test_rst_to_trlc" ,
763784 size = "small" ,
764785 srcs = ["rst_to_trlc_test.py" ],
765786 main = "rst_to_trlc_test.py" ,
766- deps = ["//bazel/rules/rules_score:rst_to_trlc_lib" ],
787+ deps = ["@score_tooling //bazel/rules/rules_score:rst_to_trlc_lib" ],
767788)
768789
769790py_test (
@@ -782,7 +803,6 @@ py_test(
782803test_suite (
783804 name = "all_tests" ,
784805 tests = [
785- ":requirements_image_tests" ,
786806 ":requirements_rst_tests" ,
787807 ":seooc_tests" ,
788808 ":sphinx_module_tests" ,
@@ -791,5 +811,6 @@ test_suite(
791811 ":test_safety_analysis_tools" ,
792812 ":test_trlc_rst_image_rendering" ,
793813 ":unit_component_tests" ,
814+ "//fixtures/image_srcs:requirements_image_tests" ,
794815 ],
795816)
0 commit comments