Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,12 @@ build --tool_java_runtime_version=remotejdk_17
build:clippy --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
build:clippy --output_groups=+clippy_checks

# Log level configuration for rules_score build output
# normal build: only errors and warnings (default – no flag needed)
# info build: additionally show info messages from all tools
build:info --//bazel/rules/rules_score:verbosity=info
# debug build: complete output including debug/trace from all tools
build:debug --//bazel/rules/rules_score:verbosity=debug

# Import AI checker custom configuration
try-import %workspace%/.bazelrc.ai_checker
16 changes: 16 additions & 0 deletions bazel/rules/rules_score/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@pip_rules_score//:requirements.bzl", "requirement")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
load(
Expand Down Expand Up @@ -181,3 +182,18 @@ lobster_linker(
],
visibility = ["//docs/processes:__pkg__"],
)

# ---------------------------------------------------------------------------
# Build setting: verbosity level for all rules_score tools
# ---------------------------------------------------------------------------

string_flag(
name = "verbosity",
build_setting_default = "warn",
values = [
"warn",
"info",
"debug",
],
visibility = ["//visibility:public"],
)
72 changes: 39 additions & 33 deletions bazel/rules/rules_score/private/architectural_design.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ to produce FlatBuffers binary representations of the parsed diagrams.
"""

load("//bazel/rules/rules_score:providers.bzl", "ArchitecturalDesignInfo", "SphinxSourcesInfo")
load("//bazel/rules/rules_score/private:verbosity.bzl", "VERBOSITY_ATTR", "get_log_level")

# ============================================================================
# Private Rule Implementation
Expand Down Expand Up @@ -62,6 +63,8 @@ def _run_puml_parser(ctx, puml_file):
fbs_output.dirname,
"--lobster-output-dir",
lobster_output.dirname,
"--log-level",
get_log_level(ctx),
],
progress_message = "Parsing PlantUML diagram: %s" % puml_file.short_path,
)
Expand Down Expand Up @@ -132,7 +135,7 @@ def _architectural_design_impl(ctx):
inputs = all_fbs_files,
outputs = [plantuml_links_json],
executable = ctx.executable._linker,
arguments = ["--fbs-files"] + [f.path for f in all_fbs_files] + ["--output", plantuml_links_json.path],
arguments = ["--fbs-files"] + [f.path for f in all_fbs_files] + ["--output", plantuml_links_json.path, "--log-level", get_log_level(ctx)],
progress_message = "Generating PlantUML links JSON for %s" % ctx.label.name,
)
else:
Expand Down Expand Up @@ -170,38 +173,41 @@ _architectural_design = rule(
implementation = _architectural_design_impl,
doc = "Collects architectural design documents and diagrams for S-CORE process compliance. " +
"Automatically parses PlantUML files to produce FlatBuffers binary representations.",
attrs = {
"static": attr.label_list(
allow_files = [".puml", ".plantuml", ".svg", ".rst", ".md"],
mandatory = False,
doc = "Static architecture diagrams (class diagrams, component diagrams, etc.)",
),
"dynamic": attr.label_list(
allow_files = [".puml", ".plantuml", ".svg", ".rst", ".md"],
mandatory = False,
doc = "Dynamic architecture diagrams (sequence diagrams, activity diagrams, etc.)",
),
"public_api": attr.label_list(
allow_files = [".puml", ".plantuml"],
mandatory = False,
doc = "Public API diagrams (parsed identically to static/dynamic). " +
"Classified separately so their lobster items are exposed via " +
"public_api_lobster_files, enabling failure-mode-to-interface " +
"traceability at the dependable element level.",
),
"_puml_parser": attr.label(
default = Label("@score_tooling//plantuml/parser:parser"),
executable = True,
cfg = "exec",
doc = "PlantUML parser tool that generates FlatBuffers from .puml files",
),
"_linker": attr.label(
default = Label("@score_tooling//plantuml/parser:linker"),
executable = True,
cfg = "exec",
doc = "Tool that generates plantuml_links.json from FlatBuffers diagram outputs",
),
},
attrs = dict(
{
"static": attr.label_list(
allow_files = [".puml", ".plantuml", ".svg", ".rst", ".md"],
mandatory = False,
doc = "Static architecture diagrams (class diagrams, component diagrams, etc.)",
),
"dynamic": attr.label_list(
allow_files = [".puml", ".plantuml", ".svg", ".rst", ".md"],
mandatory = False,
doc = "Dynamic architecture diagrams (sequence diagrams, activity diagrams, etc.)",
),
"public_api": attr.label_list(
allow_files = [".puml", ".plantuml"],
mandatory = False,
doc = "Public API diagrams (parsed identically to static/dynamic). " +
"Classified separately so their lobster items are exposed via " +
"public_api_lobster_files, enabling failure-mode-to-interface " +
"traceability at the dependable element level.",
),
"_puml_parser": attr.label(
default = Label("@score_tooling//plantuml/parser:parser"),
executable = True,
cfg = "exec",
doc = "PlantUML parser tool that generates FlatBuffers from .puml files",
),
"_linker": attr.label(
default = Label("@score_tooling//plantuml/parser:linker"),
executable = True,
cfg = "exec",
doc = "Tool that generates plantuml_links.json from FlatBuffers diagram outputs",
),
},
**VERBOSITY_ATTR
),
)

# ============================================================================
Expand Down
145 changes: 75 additions & 70 deletions bazel/rules/rules_score/private/dependable_element.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ load(
"format_lobster_sources",
)
load("//bazel/rules/rules_score/private:sphinx_module.bzl", "sphinx_module")
load("//bazel/rules/rules_score/private:verbosity.bzl", "VERBOSITY_ATTR", "get_log_level")

# ============================================================================
# Template Constants
Expand Down Expand Up @@ -642,6 +643,7 @@ def _run_validation(ctx, arch_json, static_fbs_files):
validation_args.add("--architecture-json", arch_json)
validation_args.add_all("--component-fbs", static_fbs_files)
validation_args.add("--output", validation_log)
validation_args.add("--log-level", get_log_level(ctx))
if ctx.attr.maturity == "development":
validation_args.add("--warn-on-errors")

Expand Down Expand Up @@ -986,76 +988,79 @@ def _dependable_element_index_impl(ctx):
_dependable_element_index = rule(
implementation = _dependable_element_index_impl,
doc = "Generates index.rst file with references to dependable element artifacts",
attrs = {
"module_name": attr.string(
mandatory = True,
doc = "Name of the dependable element module (used as document title)",
),
"assumptions_of_use": attr.label_list(
mandatory = True,
doc = "Assumptions of Use targets or files.",
),
"requirements": attr.label_list(
mandatory = True,
providers = [FeatureRequirementsInfo],
doc = "Feature requirements targets (feature_requirements only).",
),
"architectural_design": attr.label_list(
mandatory = True,
doc = "Architectural design targets or files.",
),
"dependability_analysis": attr.label_list(
mandatory = True,
doc = "Dependability analysis targets or files.",
),
"components": attr.label_list(
mandatory = True,
aspects = [collect_current_architecture_aspect],
doc = "Component targets (aspect is applied here and passed to subrule).",
),
"tests": attr.label_list(
default = [],
doc = "Integration tests for the dependable element.",
),
"checklists": attr.label_list(
default = [],
doc = "Safety checklists targets or files.",
),
"template": attr.label(
allow_single_file = [".rst"],
mandatory = True,
doc = "Template file for generating index.rst",
),
"deps": attr.label_list(
default = [],
doc = "Dependencies on other dependable element modules (submodules).",
),
"processed_deps": attr.label_list(
default = [],
doc = "Dependencies on other dependable element modules (submodules).",
),
"integrity_level": attr.string(
mandatory = True,
values = _INTEGRITY_LEVELS,
doc = "Integrity level of the dependable element. Allowed values: 'A', 'B', 'C', 'D' (D > C > B > A).",
),
"maturity": attr.string(
default = "release",
values = ["release", "development"],
doc = "Maturity level of the dependable element. 'release' (default) treats certified scope violations as errors; 'development' emits warnings and continues.",
),
"_validation_cli": attr.label(
default = Label("//validation/core:validation_cli"),
executable = True,
cfg = "exec",
doc = "Validation CLI tool",
),
"_lobster_de_template": attr.label(
default = Label("//bazel/rules/rules_score/lobster/config:lobster_de_template"),
allow_single_file = True,
doc = "Lobster config template for dependable element traceability.",
),
},
attrs = dict(
{
"module_name": attr.string(
mandatory = True,
doc = "Name of the dependable element module (used as document title)",
),
"assumptions_of_use": attr.label_list(
mandatory = True,
doc = "Assumptions of Use targets or files.",
),
"requirements": attr.label_list(
mandatory = True,
providers = [FeatureRequirementsInfo],
doc = "Feature requirements targets (feature_requirements only).",
),
"architectural_design": attr.label_list(
mandatory = True,
doc = "Architectural design targets or files.",
),
"dependability_analysis": attr.label_list(
mandatory = True,
doc = "Dependability analysis targets or files.",
),
"components": attr.label_list(
mandatory = True,
aspects = [collect_current_architecture_aspect],
doc = "Component targets (aspect is applied here and passed to subrule).",
),
"tests": attr.label_list(
default = [],
doc = "Integration tests for the dependable element.",
),
"checklists": attr.label_list(
default = [],
doc = "Safety checklists targets or files.",
),
"template": attr.label(
allow_single_file = [".rst"],
mandatory = True,
doc = "Template file for generating index.rst",
),
"deps": attr.label_list(
default = [],
doc = "Dependencies on other dependable element modules (submodules).",
),
"processed_deps": attr.label_list(
default = [],
doc = "Dependencies on other dependable element modules (submodules).",
),
"integrity_level": attr.string(
mandatory = True,
values = _INTEGRITY_LEVELS,
doc = "Integrity level of the dependable element. Allowed values: 'A', 'B', 'C', 'D' (D > C > B > A).",
),
"maturity": attr.string(
default = "release",
values = ["release", "development"],
doc = "Maturity level of the dependable element. 'release' (default) treats certified scope violations as errors; 'development' emits warnings and continues.",
),
"_validation_cli": attr.label(
default = Label("//validation/core:validation_cli"),
executable = True,
cfg = "exec",
doc = "Validation CLI tool",
),
"_lobster_de_template": attr.label(
default = Label("//bazel/rules/rules_score/lobster/config:lobster_de_template"),
allow_single_file = True,
doc = "Lobster config template for dependable element traceability.",
),
},
**VERBOSITY_ATTR
),
subrules = [subrule_lobster_report, subrule_lobster_html_report],
)

Expand Down
Loading
Loading