-
Notifications
You must be signed in to change notification settings - Fork 13
Full documentation build #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| load("@score_docs_as_code//:docs.bzl", "docs") | ||
| load("@score_tooling//:defs.bzl", "copyright_checker", "setup_starpls", "use_format_targets") | ||
|
|
||
| setup_starpls( | ||
| name = "starpls_server", | ||
| visibility = ["//visibility:public"], | ||
| ) | ||
|
|
||
| copyright_checker( | ||
| name = "copyright", | ||
| srcs = [ | ||
| "src", | ||
| "tests", | ||
| "//:BUILD", | ||
| "//:MODULE.bazel", | ||
| ], | ||
| config = "@score_tooling//cr_checker/resources:config", | ||
| template = "@score_tooling//cr_checker/resources:templates", | ||
| visibility = ["//visibility:public"], | ||
| ) | ||
|
|
||
|
|
||
| # Add target for formatting checks | ||
| use_format_targets() | ||
|
|
||
| docs( | ||
| source_dir = "docs", | ||
| ) | ||
|
|
||
| load("//:full_docs.bzl", "all_docs") | ||
|
|
||
| all_docs( | ||
| conf = "full_docs/conf.py", | ||
| subdocs = { | ||
| "@score_platform//:docs_sources": "platform", | ||
| ":docs_sources": "integration", | ||
| "@score_docs_as_code//:docs_sources": "docs_as_code", | ||
| "@score_process//:docs_sources": "process", | ||
| }, | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
| module( | ||
| name = "reference_integration", | ||
| version = "0.1", | ||
| ) | ||
| bazel_dep(name = "rules_pkg", version = "1.1.0") | ||
|
|
||
| bazel_dep(name = "rules_python", version = "1.4.1") | ||
| python = use_extension("@rules_python//python/extensions:python.bzl", "python") | ||
| python.toolchain( | ||
| is_default = True, | ||
| python_version = "3.12", | ||
| ) | ||
| use_repo(python) | ||
|
|
||
| bazel_dep(name = "score_tooling", version = "1.0.1") | ||
| bazel_dep(name = "score_platform", version = "0.3.0") | ||
| bazel_dep(name = "score_process", version = "1.2.0") | ||
| bazel_dep(name = "score_docs_as_code", version = "1.4.0") | ||
| git_override(module_name = "score_docs_as_code", commit = "f74f2e7", remote = "https://github.com/eclipse-score/docs-as-code") # workaround until 1.4.1+ is released |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| # Configuration file for the Sphinx documentation builder. | ||
| # | ||
| # For the full list of built-in configuration values, see the documentation: | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
|
||
|
|
||
| # -- Project information ----------------------------------------------------- | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
|
||
| project = "S-CORE Reference Integration" | ||
| project_url = "https://eclipse-score.github.io/module_template/" | ||
| project_prefix = "INT_" | ||
| author = "S-CORE" | ||
| version = "0.1" | ||
|
|
||
| # -- General configuration --------------------------------------------------- | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
|
||
| extensions = [ | ||
| "sphinx_design", | ||
| "sphinx_needs", | ||
| "sphinxcontrib.plantuml", | ||
| "score_plantuml", | ||
| "score_metamodel", | ||
| "score_draw_uml_funcs", | ||
| "score_source_code_linker", | ||
| "score_layout", | ||
| ] | ||
|
|
||
| exclude_patterns = [ | ||
| # The following entries are not required when building the documentation via 'bazel | ||
| # build //docs:docs', as that command runs in a sandboxed environment. However, when | ||
| # building the documentation via 'bazel run //docs:incremental' or esbonio, these | ||
| # entries are required to prevent the build from failing. | ||
| "bazel-*", | ||
| ".venv_docs", | ||
| ] | ||
|
|
||
| templates_path = ["templates"] | ||
|
|
||
| # Enable numref | ||
| numfig = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| .. | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| ##################### | ||
| Reference Integration | ||
| ##################### | ||
|
|
||
| This is the reference integration of S-CORE. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| """Bazel rules for combining multiple Sphinx documentation sets into a unified documentation site.""" | ||
|
|
||
| load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") | ||
| load("@rules_python//sphinxdocs:sphinx.bzl", "sphinx_build_binary", "sphinx_docs") | ||
|
|
||
| def _adapt_path(path): | ||
| """Adapt the file path by removing leading segments such that index.rst has no leading segments.""" | ||
| parts = path.split("/") | ||
| if parts[0] == "external": | ||
| # Necessary for files from other Bazel modules | ||
| parts = parts[3:] | ||
| else: | ||
| # Necessary for files in this module | ||
| parts = parts[1:] | ||
| return "/".join(parts) | ||
|
|
||
| def _full_docs_impl(ctx): | ||
a-zw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """Implementation function for the docs_combo rule. | ||
|
|
||
| This function aggregates multiple documentation targets by creating symlinks | ||
| to their files and generating a top-level index.rst with a table of contents | ||
| that references all subdocumentation. | ||
| """ | ||
| # Generate symlinks to dependency documentation | ||
| output = [] | ||
| for tgt in ctx.attr.subdocs: | ||
| name = ctx.attr.subdocs[tgt] | ||
| for f in tgt.files.to_list(): | ||
| s = ctx.actions.declare_file(name + "/" + _adapt_path(f.path)) | ||
| ctx.actions.symlink(output = s, target_file = f) | ||
| print("s.path: " + s.path + " f.path: " + f.path) | ||
| output.append(s) | ||
|
|
||
| # Generate index with toctree | ||
| index = ctx.actions.declare_file("index.rst") | ||
| contents = "" | ||
| contents += "All of S-CORE\n" | ||
| contents += "=============\n\n" | ||
| contents += ".. toctree::\n" | ||
| contents += " :maxdepth: 2\n\n" | ||
| for tgt in ctx.attr.subdocs: | ||
| name = ctx.attr.subdocs[tgt] | ||
| contents += " " + name + "/index\n" | ||
| contents += "\nThis overview document is automatically generated.\n" | ||
| ctx.actions.write(output = index, content = contents) | ||
| output.append(index) | ||
|
|
||
| return [DefaultInfo(files = depset(output))] | ||
|
|
||
|
|
||
| docs_combo = rule( | ||
| implementation = _full_docs_impl, | ||
| attrs = { | ||
| "subdocs": attr.label_keyed_string_dict( | ||
| doc = "Dictionary mapping documentation targets to their display names", | ||
| default = {}, | ||
| ), | ||
| }, | ||
| ) | ||
|
|
||
|
|
||
| def all_docs(subdocs = {}, conf = "full_docs/conf.py"): | ||
| """Macro to create a complete documentation build combining multiple doc sources.""" | ||
| docs_combo( | ||
| name = "all_docs", | ||
| subdocs = subdocs, | ||
| ) | ||
| sphinx_docs( | ||
| name = "full_html", | ||
| srcs = [":all_docs"], | ||
| config = conf, | ||
| extra_opts = [ | ||
| #"-W", | ||
| "--keep-going", | ||
| "-T", # show more details in case of errors | ||
| "--jobs", | ||
| "auto", | ||
| ], | ||
| formats = ["html"], | ||
| sphinx = ":sphinx_build", | ||
| strip_prefix = "full_docs/", | ||
| visibility = ["//visibility:public"], | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| # Configuration file for the Sphinx documentation builder. | ||
| # | ||
| # For the full list of built-in configuration values, see the documentation: | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
|
||
|
|
||
| # -- Project information ----------------------------------------------------- | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
|
||
| project = "S-CORE Full Documentation" | ||
| project_url = "https://eclipse-score.github.io/module_template/" | ||
| project_prefix = "ALL_" | ||
| author = "S-CORE" | ||
| version = "0.1" | ||
|
|
||
| # -- General configuration --------------------------------------------------- | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
|
||
| extensions = [ | ||
| "sphinx_design", | ||
| "sphinx_needs", | ||
| "sphinxcontrib.plantuml", | ||
| "score_plantuml", | ||
| "score_metamodel", | ||
| "score_draw_uml_funcs", | ||
| "score_source_code_linker", | ||
| "score_layout", | ||
| ] | ||
|
|
||
| exclude_patterns = [ | ||
| # The following entries are not required when building the documentation via 'bazel | ||
| # build //docs:docs', as that command runs in a sandboxed environment. However, when | ||
| # building the documentation via 'bazel run //docs:incremental' or esbonio, these | ||
| # entries are required to prevent the build from failing. | ||
| "bazel-*", | ||
| ".venv_docs", | ||
| ] | ||
|
|
||
| templates_path = ["templates"] | ||
|
|
||
| # Enable numref | ||
| numfig = True |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with having a separate command here. Let's see how we can merge POC1 and POC2 next week.