1+ load ("@aspect_rules_py//py:defs.bzl" , "py_binary" , "py_library" )
2+ load (
3+ "@score_tooling//bazel/rules/rules_score:sphinx_toolchain.bzl" ,
4+ "sphinx_toolchain" ,
5+ )
16load (
27 "//bazel/rules/rules_score:rules_score.bzl" ,
38 "sphinx_module" ,
@@ -8,8 +13,26 @@ exports_files([
813 "templates/seooc_index.template.rst" ,
914 "templates/unit.template.rst" ,
1015 "templates/component.template.rst" ,
16+ "src/sphinx_wrapper.py" ,
17+ "src/bazel_sphinx_needs.py" ,
1118])
1219
20+ sphinx_module (
21+ name = "rules_score_doc" ,
22+ srcs = glob (
23+ [
24+ "docs/**/*.rst" ,
25+ "docs/**/*.puml" ,
26+ ],
27+ allow_empty = True ,
28+ ),
29+ index = "docs/index.rst" ,
30+ visibility = ["//visibility:public" ],
31+ deps = [
32+ # "@score_process//:score_process_module",
33+ ],
34+ )
35+
1336# HTML merge tool
1437py_binary (
1538 name = "sphinx_html_merge" ,
@@ -18,36 +41,52 @@ py_binary(
1841 visibility = ["//visibility:public" ],
1942)
2043
44+ py_library (
45+ name = "sphinx_module_ext" ,
46+ srcs = ["src/bazel_sphinx_needs.py" ],
47+ imports = ["src" ],
48+ visibility = ["//visibility:public" ],
49+ )
50+
2151# Sphinx build binary with all required dependencies
2252py_binary (
23- name = "score_build " ,
53+ name = "sphinx_build " ,
2454 srcs = ["src/sphinx_wrapper.py" ],
25- data = [],
26- env = {
27- "SOURCE_DIRECTORY" : "" ,
28- "DATA" : "" ,
29- "ACTION" : "check" ,
30- },
3155 main = "src/sphinx_wrapper.py" ,
3256 visibility = ["//visibility:public" ],
3357 deps = [
34- "@score_docs_as_code//src:plantuml_for_python" ,
35- "@score_docs_as_code//src/extensions/score_sphinx_bundle" ,
58+ ":sphinx_module_ext" ,
59+ "@pip_tooling//myst_parser" ,
60+ "@pip_tooling//sphinx" ,
61+ "@pip_tooling//sphinx_design" ,
62+ "@pip_tooling//sphinx_needs" ,
63+ "@pip_tooling//sphinx_rtd_theme" ,
64+ "@pip_tooling//sphinxcontrib_plantuml" ,
3665 ],
3766)
3867
39- sphinx_module (
40- name = "rules_score_doc" ,
41- srcs = glob (
42- [
43- "docs/**/*.rst" ,
44- "docs/**/*.puml" ,
45- ],
46- allow_empty = True ,
47- ),
48- index = "docs/index.rst" ,
68+ sphinx_toolchain (
69+ name = "default_toolchain" ,
70+ conf_template = "@score_tooling//bazel/rules/rules_score:templates/conf.template.py" ,
71+ html_merge_tool = ":sphinx_html_merge" ,
72+ sphinx = ":sphinx_build" ,
73+ )
74+
75+ toolchain_type (
76+ name = "toolchain_type" ,
4977 visibility = ["//visibility:public" ],
50- deps = [
51- "@score_process//:score_process_module" ,
78+ )
79+
80+ toolchain (
81+ name = "sphinx_default_toolchain" ,
82+ exec_compatible_with = [
83+ "@platforms//os:linux" ,
84+ "@platforms//cpu:x86_64" ,
85+ ],
86+ target_compatible_with = [
87+ "@platforms//os:linux" ,
88+ "@platforms//cpu:x86_64" ,
5289 ],
90+ toolchain = ":default_toolchain" ,
91+ toolchain_type = ":toolchain_type" ,
5392)
0 commit comments