Skip to content

Commit 15c2ed7

Browse files
committed
Move sphinx build to execution phase
This PR shows how a sphinx build can be moved to the execution phase of bazel builds. Addditionally, module documentation is now imported from `sphinx_docs_library` targets of dependent modules. This pr depends on changes in [PR](eclipse-score/docs-as-code#327)
1 parent af717c2 commit 15c2ed7

File tree

4 files changed

+82
-14
lines changed

4 files changed

+82
-14
lines changed

BUILD

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,66 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313

14+
load("@rules_python//sphinxdocs:sphinx.bzl", "sphinx_build_binary", "sphinx_docs")
1415
load("@score_docs_as_code//:docs.bzl", "docs")
1516

1617
docs(
1718
data = [
18-
"@score_platform//:needs_json",
19-
"@score_process//:needs_json",
19+
# "@score_platform//:",
20+
"@score_process//:sphinx_docs_library",
21+
"@score_baselibs//:sphinx_docs_library",
2022
# Persistency cannot be included, as it does not contain any needs.
2123
# -> sphinx-needs bug?
2224
# "@score_persistency//:needs_json",
2325
],
2426
source_dir = "docs",
27+
deps = [
28+
],
29+
)
30+
31+
source_dir = "docs"
32+
33+
sphinx_docs(
34+
name = "html",
35+
srcs = glob(
36+
[
37+
source_dir + "/**/*.png",
38+
source_dir + "/**/*.svg",
39+
source_dir + "/**/*.md",
40+
source_dir + "/**/*.rst",
41+
source_dir + "/**/*.html",
42+
source_dir + "/**/*.css",
43+
source_dir + "/**/*.puml",
44+
source_dir + "/**/*.need",
45+
source_dir + "/**/*.yaml",
46+
source_dir + "/**/*.json",
47+
source_dir + "/**/*.csv",
48+
source_dir + "/**/*.inc",
49+
"more_docs/**/*.rst",
50+
],
51+
allow_empty = True,
52+
),
53+
config = ":" + source_dir + "/conf.py",
54+
extra_opts = [
55+
"-W",
56+
"--keep-going",
57+
"-T", # show more details in case of errors
58+
"--jobs",
59+
"auto",
60+
],
61+
formats = ["html"],
62+
sphinx = ":sphinx_build",
63+
tools = [],
64+
visibility = ["//visibility:public"],
65+
# Modules export their docs as sphinx_docs_library
66+
# which are imported by bazel to docs/modules/<module_name>
67+
deps = [
68+
"@score_platform//:sphinx_docs_library",
69+
"@score_process//:sphinx_docs_library",
70+
"@score_baselibs//:sphinx_docs_library",
71+
# "@score_persistency//:sphinx_docs_library",
72+
# "@score_communication//:sphinx_docs_library"
73+
],
2574
)
2675

2776
# Simple filegroup target to demonstrate the build system works

MODULE.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ git_override(
6060
module_name = "trlc",
6161
remote = "https://github.com/bmw-software-engineering/trlc.git",
6262
commit = "650b51a47264a4f232b3341f473527710fc32669", # trlc-2.0.2 release
63+
# commit = "650b51a47264a4f232b3341f473527710fc32669", # trlc-2.0.2 release
6364
)
6465

6566
# imports for the feature showcase module
66-
bazel_dep(name = "rules_rust", version = "0.61.0")
67+
bazel_dep(name = "rules_rust", version = "0.67.0")
6768
bazel_dep(name = "score_itf", version = "0.1.0")
6869
bazel_dep(name = "score_crates", version = "0.0.4")

docs/index.rst

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,25 @@ Reference Integration Documentation
1717

1818
Release Notes: :need:`doc__score_v05_alpha_release_note`
1919

20+
Documentation:
21+
--------------
2022

21-
.. if-collection:: score_platform
23+
.. toctree::
24+
:maxdepth: 1
25+
:titlesonly:
2226

23-
Documentation:
27+
modules/score_process+/process/index
28+
modules/score_platform+/docs/index
2429

25-
.. toctree::
26-
:maxdepth: 1
27-
:titlesonly:
2830

29-
S-CORE Platform <_collections/score_platform/docs/index>
30-
_collections/score_process/process/index
31+
Modules
32+
-------
33+
34+
35+
.. toctree::
36+
:maxdepth: 1
37+
:titlesonly:
38+
39+
modules/score_baselibs+/docs/index
40+
..
41+
modules/score_persistency+/docs/index

score_modules.MODULE.bazel

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
# *******************************************************************************
1313

1414
bazel_dep(name = "score_baselibs")
15-
single_version_override(
15+
git_override(
1616
module_name = "score_baselibs",
17-
version = "0.1.3",
17+
commit = "826955b4d7dc2f326e3deabc06895318922cca1f",
18+
remote = "https://github.com/eclipse-score/baselibs.git",
1819
)
1920

2021
bazel_dep(name = "score_communication")
@@ -60,9 +61,15 @@ single_version_override(
6061
)
6162

6263
bazel_dep(name = "score_docs_as_code", version = "2.0.1")
63-
single_version_override(
64+
# single_version_override(
65+
# module_name = "score_docs_as_code",
66+
# version = "2.0.1",
67+
# )
68+
69+
git_override(
6470
module_name = "score_docs_as_code",
65-
version = "2.0.1",
71+
commit = "c27915a2c5222a2e7111ba8db0cd468110b70178",
72+
remote = "https://github.com/eclipse-score/docs-as-code.git",
6673
)
6774

6875

0 commit comments

Comments
 (0)