diff --git a/qnx_qemu/.bazelrc b/.bazelrc similarity index 100% rename from qnx_qemu/.bazelrc rename to .bazelrc diff --git a/qnx_qemu/.bazelversion b/.bazelversion similarity index 100% rename from qnx_qemu/.bazelversion rename to .bazelversion diff --git a/BUILD b/BUILD new file mode 100644 index 000000000..0c0a50b21 --- /dev/null +++ b/BUILD @@ -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", + }, +) diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 000000000..4fac7708c --- /dev/null +++ b/MODULE.bazel @@ -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 diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 000000000..e998a7c11 --- /dev/null +++ b/docs/conf.py @@ -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 diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 000000000..a2e25232c --- /dev/null +++ b/docs/index.rst @@ -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. + diff --git a/full_docs.bzl b/full_docs.bzl new file mode 100644 index 000000000..d15cdad3f --- /dev/null +++ b/full_docs.bzl @@ -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): + """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"], + ) diff --git a/full_docs/conf.py b/full_docs/conf.py new file mode 100644 index 000000000..8bcdbb8fe --- /dev/null +++ b/full_docs/conf.py @@ -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