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" )
32+ load ("@score_tooling//cpp/libclang:libclang_toolchain.bzl" , "libclang_toolchain" )
2933load ("@trlc//:trlc.bzl" , "trlc_requirements" , "trlc_requirements_test" )
3034load (
3135 ":html_generation_test.bzl" ,
9397
9498package (default_visibility = ["//visibility:public" ])
9599
100+ # ============================================================================
101+ # Sphinx Toolchain — uses score_docs_as_code so score_metamodel is importable
102+ # ============================================================================
103+
104+ exports_files (["template/conf.template.py" ])
105+
106+ py_binary (
107+ name = "score_build" ,
108+ srcs = ["@score_tooling//bazel/rules/rules_score:src/sphinx_wrapper.py" ],
109+ main = "@score_tooling//bazel/rules/rules_score:src/sphinx_wrapper.py" ,
110+ package_collisions = "warning" ,
111+ visibility = ["//visibility:public" ],
112+ deps = [
113+ "@score_docs_as_code//src:plantuml_for_python" ,
114+ "@score_docs_as_code//src/extensions/score_sphinx_bundle" ,
115+ "@score_tooling//bazel/rules/rules_score:bazel_sphinx_needs" ,
116+ "@score_tooling//bazel/rules/rules_score:sphinx_module_ext" ,
117+ ],
118+ )
119+
120+ sphinx_toolchain (
121+ name = "score_sphinx_toolchain" ,
122+ conf_template = "//:template/conf.template.py" ,
123+ html_merge_tool = "@score_tooling//bazel/rules/rules_score:sphinx_html_merge" ,
124+ sphinx = ":score_build" ,
125+ )
126+
127+ toolchain (
128+ name = "score_toolchain" ,
129+ toolchain = ":score_sphinx_toolchain" ,
130+ toolchain_type = "@score_tooling//bazel/rules/rules_score:toolchain_type" ,
131+ )
132+
133+ # ============================================================================
134+ # libclang Toolchain — this integrating repo supplies its own libclang/C++
135+ # toolchain for the score libclang-based C/C++ parser.
136+ # ============================================================================
137+ libclang_toolchain (
138+ name = "test_libclang" ,
139+ cxx_builtin_include = "@llvm_toolchain_llvm//:cxx_builtin_include" ,
140+ extra_config_site = "@llvm_toolchain_llvm//:extra_config_site" ,
141+ libclang = "@llvm_toolchain_llvm//:lib/libclang.so" ,
142+ )
143+
144+ toolchain (
145+ name = "test_libclang_toolchain" ,
146+ toolchain = ":test_libclang" ,
147+ toolchain_type = "@score_tooling//cpp/libclang:libclang_toolchain_type" ,
148+ )
149+
96150# ============================================================================
97151# Test Fixtures - Module Definitions
98152# ============================================================================
@@ -126,15 +180,6 @@ sphinx_module(
126180 ],
127181)
128182
129- # Test 2: Graphviz Rendering
130- # Tests hermetic graphviz support via sphinx.ext.graphviz directive
131- sphinx_module (
132- name = "graphviz_test_lib" ,
133- srcs = glob (["fixtures/graphviz_test/*.rst" ]),
134- index = "fixtures/graphviz_test/index.rst" ,
135- sphinx = "@score_tooling//bazel/rules/rules_score:score_build" ,
136- )
137-
138183# Test 3: SEooC (Safety Element out of Context) Module
139184# Tests the score_component macro with S-CORE process artifacts
140185
@@ -283,7 +328,7 @@ unit_design(
283328unit (
284329 name = "test_unit" ,
285330 testonly = True ,
286- scope = ["//bazel/rules/rules_score/test :mock_lib1" ],
331+ scope = ["//:mock_lib1" ],
287332 tests = [":test_unit_tests" ],
288333 unit_design = [":test_unit_design" ],
289334 implementation = [
@@ -709,26 +754,11 @@ aous_rst_sphinx_test(
709754requirements_rst_test_suite (name = "requirements_rst_tests" )
710755
711756# ============================================================================
712- # Image srcs Tests
757+ # Image srcs Tests (defined in sub-package to avoid workspace-root edge case)
713758# ============================================================================
714-
715- # Fixture: feature_requirements with image_srcs
716- feature_requirements (
717- name = "feat_req_with_image" ,
718- srcs = ["fixtures/seooc_test/feature_requirements.trlc" ],
719- image_srcs = [
720- "fixtures/image_srcs/diagrams/arch.svg" ,
721- "fixtures/image_srcs/diagrams/arch.png" ,
722- ],
723- deps = [":asr_trlc" ],
724- )
725-
726- image_srcs_sphinx_sources_test (
727- name = "image_srcs_sphinx_sources_test" ,
728- target_under_test = ":feat_req_with_image" ,
729- )
730-
731- requirements_image_test_suite (name = "requirements_image_tests" )
759+ # feat_req_with_image and image_srcs_sphinx_sources_test live in
760+ # //fixtures/image_srcs so that ctx.label.package is non-empty and
761+ # subrule_trlc_image_stage can strip the prefix correctly.
732762
733763# ============================================================================
734764# Combined Test Suite
@@ -745,7 +775,7 @@ requirements_image_test_suite(name = "requirements_image_tests")
745775trlc_requirements (
746776 name = "safety_measures_fixtures" ,
747777 srcs = ["fixtures/seooc_test/safety_measures_fixtures.trlc" ],
748- spec = ["//bazel/rules/rules_score/trlc/config:score_requirements_model" ],
778+ spec = ["@score_tooling //bazel/rules/rules_score/trlc/config:score_requirements_model" ],
749779)
750780
751781trlc_requirements_test (
@@ -757,22 +787,22 @@ py_test(
757787 name = "test_safety_analysis_tools" ,
758788 size = "small" ,
759789 srcs = ["test_safety_analysis_tools.py" ],
760- deps = ["//bazel/rules/rules_score:safety_analysis_tools" ],
790+ deps = ["@score_tooling //bazel/rules/rules_score:safety_analysis_tools" ],
761791)
762792
763793py_test (
764794 name = "test_aou_forwarding_to_lobster" ,
765795 size = "small" ,
766796 srcs = ["test_aou_forwarding_to_lobster.py" ],
767- deps = ["//bazel/rules/rules_score:aou_forwarding_to_lobster" ],
797+ deps = ["@score_tooling //bazel/rules/rules_score:aou_forwarding_to_lobster" ],
768798)
769799
770800py_test (
771801 name = "test_rst_to_trlc" ,
772802 size = "small" ,
773803 srcs = ["rst_to_trlc_test.py" ],
774804 main = "rst_to_trlc_test.py" ,
775- deps = ["//bazel/rules/rules_score:rst_to_trlc_lib" ],
805+ deps = ["@score_tooling //bazel/rules/rules_score:rst_to_trlc_lib" ],
776806)
777807
778808py_test (
@@ -787,27 +817,18 @@ py_test(
787817 deps = ["@trlc//tools/trlc_rst:trlc_rst_lib" ],
788818)
789819
790- py_test (
791- name = "test_graphviz_rendering" ,
792- size = "small" ,
793- srcs = ["graphviz_render_test.py" ],
794- data = [":graphviz_test_lib" ],
795- main = "graphviz_render_test.py" ,
796- )
797-
798820# Combined test suite for all tests
799821test_suite (
800822 name = "all_tests" ,
801823 tests = [
802- ":requirements_image_tests" ,
803824 ":requirements_rst_tests" ,
804825 ":seooc_tests" ,
805826 ":sphinx_module_tests" ,
806827 ":test_aou_forwarding_to_lobster" ,
807- ":test_graphviz_rendering" ,
808828 ":test_rst_to_trlc" ,
809829 ":test_safety_analysis_tools" ,
810830 ":test_trlc_rst_image_rendering" ,
811831 ":unit_component_tests" ,
832+ "//fixtures/image_srcs:requirements_image_tests" ,
812833 ],
813834)
0 commit comments