Skip to content

Msp allow docs name#648

Draft
MaximilianSoerenPollak wants to merge 4 commits into
eclipse-score:mainfrom
MaximilianSoerenPollak:MSP_allow_docs_name
Draft

Msp allow docs name#648
MaximilianSoerenPollak wants to merge 4 commits into
eclipse-score:mainfrom
MaximilianSoerenPollak:MSP_allow_docs_name

Conversation

@MaximilianSoerenPollak

Copy link
Copy Markdown
Contributor

📌 Description

Allow the docs macro to be used with a name attribute as is custom for almost all bazel macros.
This will allow us in the future to use the docs marco in the same build file multiple times, with different inputs and have no collision.
This should be a good first step towards coming closer to how bazel macros should be written and make it more useable in other settings too.

=> Still a challenge though is how we can enforce non idiotic usage of this in S-CORE.

ℹ️ Still a Draft PR until the Docs are changed and we have agreed internally how this should be done.

🚨 Impact Analysis

  • This change does not violate any tool requirements and is covered by existing tool requirements
  • This change does not violate any design decisions
  • Otherwise I have created a ticket for new tool qualification

✅ Checklist

  • Added/updated documentation for new or changed features
  • Added/updated tests to cover the changes
  • Followed project coding standards and guidelines

@github-actions

Copy link
Copy Markdown

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //src:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: cf6d4aec-c39c-4109-8e2d-777fe7d4f56e
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: src
WARNING: Target pattern parsing failed.
ERROR: Skipping '//src:license-check': no such target '//src:license-check': target 'license-check' not declared in package 'src' defined by /home/runner/work/docs-as-code/docs-as-code/src/BUILD
ERROR: no such target '//src:license-check': target 'license-check' not declared in package 'src' defined by /home/runner/work/docs-as-code/docs-as-code/src/BUILD
INFO: Elapsed time: 6.669s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

repo = repo.lstrip("@")

if path_to_target == "" and target in ("needs_json", "docs_sources"):
# The producer's docs() macro may have used a custom `name`, in which case its targets

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably can make this nicer with saying "docs_sources" in target

@github-actions

Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

Comment on lines +38 to +51
def add_config_value_if_absent(
app: Sphinx, name: str, default: Any, rebuild: _ConfigRebuild
) -> None:
"""Register a Sphinx config value, unless another extension already has.

Several of our extensions may be used either standalone or bundled together via
score_sphinx_bundle, in either load order, and may each want the same config value
registered. Sphinx raises if `add_config_value` is called twice for the same name,
so this guards the registration to make it safe to call from multiple extensions.
"""
# Sphinx has no public API for this check either; `_options` is the internal dict
# `Config.add` itself consults to reject duplicate registrations.
if name not in app.config._options: # pyright: ignore [reportPrivateUsage]
app.add_config_value(name, default, rebuild=rebuild)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this truly needed?

Not using score_bundle should be not allowed in S-CORE, so I thin kwe can remove this,

@MaximilianSoerenPollak MaximilianSoerenPollak left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably 1 - 2 things still to iron out here, but overall looks like a good approach I think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant