diff --git a/.gitignore b/.gitignore index 3eef22b..26f20d9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,7 @@ bazel-* MODULE.bazel.lock +external +.vscode/ __pycache__ diff --git a/MODULE.bazel b/MODULE.bazel index c25d9f4..12a2dfd 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -20,6 +20,7 @@ module( ############################################################################### # Core Dependencies ############################################################################### +bazel_dep(name = "rules_cc", version = "0.2.14") bazel_dep(name = "rules_python", version = "1.4.1") bazel_dep(name = "aspect_rules_py", version = "1.4.0") bazel_dep(name = "platforms", version = "1.0.0") @@ -98,3 +99,8 @@ use_repo(multitool, "yamlfmt_hub") register_toolchains( "//bazel/rules/rules_score:sphinx_default_toolchain", ) + +############################################################################### +# Dev Dependencies (for testing) +############################################################################### +bazel_dep(name = "score_docs_as_code", version = "3.0.1", dev_dependency = True) diff --git a/bazel/rules/rules_score/docs/index.rst b/bazel/rules/rules_score/docs/index.rst index ef60c98..2999383 100644 --- a/bazel/rules/rules_score/docs/index.rst +++ b/bazel/rules/rules_score/docs/index.rst @@ -328,6 +328,12 @@ The macro automatically: - Delegates to ``sphinx_module`` for actual Sphinx build and HTML generation - Integrates dependencies for cross-module referencing and HTML merging +**Overview and interrelations:** + +.. uml:: rules_score_overview.puml + :align: center + :alt: Overview of rules_score architecture + :width: 100% Complete Example ---------------- diff --git a/bazel/rules/rules_score/docs/rules_score_overview.puml b/bazel/rules/rules_score/docs/rules_score_overview.puml new file mode 100644 index 0000000..bddea3e --- /dev/null +++ b/bazel/rules/rules_score/docs/rules_score_overview.puml @@ -0,0 +1,77 @@ +' ******************************************************************************* +' Copyright (c) 2026 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 +' ******************************************************************************* + +@startuml + +skinparam linetype ortho +skinparam ArrowFontSize 10 +skinparam ArrowFontStyle italic +skinparam messageAlign center + +skinparam component { + BackgroundColor<> #D7E8F7 + BorderColor<> #0066B1 + BackgroundColor<> #F1887D + BorderColor<> #E22718 + BackgroundColor<> #B5A99B + BorderColor<> #533F24 + BackgroundColor<> #B2B2B2 + BorderColor<> #494949 + BackgroundColor<> #F2F2F2 + BorderColor<> #929292 +} + +' ── Design / Diagram rules ──────────────────────────────────────────────────── +component "unit_design" <> as unit_design +component "architectural_design" <> as arch + +' ── Requirements rules ──────────────────────────────────────────────────────── +component "feature_requirements" <> as feat_req +component "component_requirements" <> as comp_req +component "assumptions_of_use" <> as aou + +' ── Implementation rules ────────────────────────────────────────────────────── +component "unit" <> as unit +component "component" <> as comp + +' ── Safety Analysis rules ───────────────────────────────────────────────────── +component "fmea" <> as fmea +component "dependability_analysis" <> as da + +' ── Documentation rules ─────────────────────────────────────────────────────── +component "sphinx_module" <> as sphinx + +' ── Top-level assembly rule ─────────────────────────────────────────────────── +component "dependable_element" as de + +unit_design --> unit : <> + +arch --> fmea : <> +arch --> de : <> + +feat_req --> aou : <> +feat_req --> de : <> + +comp_req --> comp : <> +comp_req --> aou : <> + +fmea --> da : <> +da --> de : <> + +aou --> de : <> +unit --> comp : <> +comp --> de : <> + +sphinx --> de : <>\n<> + +@enduml diff --git a/bazel/rules/rules_score/private/architectural_design.bzl b/bazel/rules/rules_score/private/architectural_design.bzl index ddd8fdd..7ce0b54 100644 --- a/bazel/rules/rules_score/private/architectural_design.bzl +++ b/bazel/rules/rules_score/private/architectural_design.bzl @@ -19,20 +19,9 @@ documentation following S-CORE process guidelines. Architectural design documents describe the software architecture including static and dynamic views. """ -load("//bazel/rules/rules_score:providers.bzl", "SphinxSourcesInfo") +load("//bazel/rules/rules_score:providers.bzl", "ArchitecturalDesignInfo", "SphinxSourcesInfo") -# ============================================================================ -# Provider Definition -# ============================================================================ - -ArchitecturalDesignInfo = provider( - doc = "Provider for architectural design artifacts", - fields = { - "static": "Depset of static architecture diagram files (e.g., class diagrams, component diagrams)", - "dynamic": "Depset of dynamic architecture diagram files (e.g., sequence diagrams, activity diagrams)", - "name": "Name of the architectural design target", - }, -) +# ArchitecturalDesignInfo is re-exported from providers.bzl for backward compatibility. # ============================================================================ # Private Rule Implementation diff --git a/bazel/rules/rules_score/private/assumptions_of_use.bzl b/bazel/rules/rules_score/private/assumptions_of_use.bzl index 36c584f..58ba730 100644 --- a/bazel/rules/rules_score/private/assumptions_of_use.bzl +++ b/bazel/rules/rules_score/private/assumptions_of_use.bzl @@ -19,22 +19,9 @@ following S-CORE process guidelines. Assumptions of Use define the safety-releva operating conditions and constraints for a Safety Element out of Context (SEooC). """ -load("//bazel/rules/rules_score:providers.bzl", "SphinxSourcesInfo") -load("//bazel/rules/rules_score/private:component_requirements.bzl", "ComponentRequirementsInfo") -load("//bazel/rules/rules_score/private:feature_requirements.bzl", "FeatureRequirementsInfo") +load("//bazel/rules/rules_score:providers.bzl", "AssumptionsOfUseInfo", "ComponentRequirementsInfo", "FeatureRequirementsInfo", "SphinxSourcesInfo") -# ============================================================================ -# Provider Definition -# ============================================================================ - -AssumptionsOfUseInfo = provider( - doc = "Provider for assumptions of use artifacts", - fields = { - "srcs": "Depset of source files containing assumptions of use", - "feature_requirements": "List of FeatureRequirementsInfo providers this AoU traces to", - "name": "Name of the assumptions of use target", - }, -) +# AssumptionsOfUseInfo is re-exported from providers.bzl for backward compatibility. # ============================================================================ # Private Rule Implementation diff --git a/bazel/rules/rules_score/private/component_requirements.bzl b/bazel/rules/rules_score/private/component_requirements.bzl index 8735354..ad6fc4a 100644 --- a/bazel/rules/rules_score/private/component_requirements.bzl +++ b/bazel/rules/rules_score/private/component_requirements.bzl @@ -19,21 +19,9 @@ following S-CORE process guidelines. Component requirements are derived from feature requirements and define the specific requirements for a software component. """ -load("//bazel/rules/rules_score:providers.bzl", "SphinxSourcesInfo") -load("//bazel/rules/rules_score/private:feature_requirements.bzl", "FeatureRequirementsInfo") +load("//bazel/rules/rules_score:providers.bzl", "ComponentRequirementsInfo", "SphinxSourcesInfo") -# ============================================================================ -# Provider Definition -# ============================================================================ - -ComponentRequirementsInfo = provider( - doc = "Provider for component requirements artifacts", - fields = { - "srcs": "Depset of source files containing component requirements", - "requirements": "List of FeatureRequirementsInfo providers this component traces to", - "name": "Name of the component requirements target", - }, -) +# ComponentRequirementsInfo and FeatureRequirementsInfo are re-exported from providers.bzl for backward compatibility. # ============================================================================ # Private Rule Implementation diff --git a/bazel/rules/rules_score/private/dependability_analysis.bzl b/bazel/rules/rules_score/private/dependability_analysis.bzl index 0d31738..ae93723 100644 --- a/bazel/rules/rules_score/private/dependability_analysis.bzl +++ b/bazel/rules/rules_score/private/dependability_analysis.bzl @@ -20,23 +20,9 @@ combines safety analysis with dependent failure analysis (DFA) to provide a comprehensive view of component reliability and safety. """ -load("//bazel/rules/rules_score:providers.bzl", "SphinxSourcesInfo") -load("//bazel/rules/rules_score/private:architectural_design.bzl", "ArchitecturalDesignInfo") -load("//bazel/rules/rules_score/private:safety_analysis.bzl", "AnalysisInfo") +load("//bazel/rules/rules_score:providers.bzl", "AnalysisInfo", "ArchitecturalDesignInfo", "DependabilityAnalysisInfo", "SphinxSourcesInfo") -# ============================================================================ -# Provider Definition -# ============================================================================ - -DependabilityAnalysisInfo = provider( - doc = "Provider for dependability analysis artifacts", - fields = { - "safety_analysis": "List of AnalysisInfo providers", - "security_analysis": "List of AnalysisInfo providers", - "arch_design": "ArchitecturalDesignInfo provider for linked architectural design", - "name": "Name of the dependability analysis target", - }, -) +# DependabilityAnalysisInfo is re-exported from providers.bzl for backward compatibility. # ============================================================================ # Private Rule Implementation diff --git a/bazel/rules/rules_score/private/feature_requirements.bzl b/bazel/rules/rules_score/private/feature_requirements.bzl index fd8dec1..2f04d66 100644 --- a/bazel/rules/rules_score/private/feature_requirements.bzl +++ b/bazel/rules/rules_score/private/feature_requirements.bzl @@ -19,19 +19,9 @@ following S-CORE process guidelines. Feature requirements describe the high-level features that a software component must implement. """ -load("//bazel/rules/rules_score:providers.bzl", "SphinxSourcesInfo") +load("//bazel/rules/rules_score:providers.bzl", "FeatureRequirementsInfo", "SphinxSourcesInfo") -# ============================================================================ -# Provider Definition -# ============================================================================ - -FeatureRequirementsInfo = provider( - doc = "Provider for feature requirements artifacts", - fields = { - "srcs": "Depset of source files containing feature requirements", - "name": "Name of the feature requirements target", - }, -) +# FeatureRequirementsInfo is re-exported from providers.bzl for backward compatibility. # ============================================================================ # Private Rule Implementation diff --git a/bazel/rules/rules_score/private/safety_analysis.bzl b/bazel/rules/rules_score/private/fmea.bzl similarity index 57% rename from bazel/rules/rules_score/private/safety_analysis.bzl rename to bazel/rules/rules_score/private/fmea.bzl index 9614e25..4dfe7bc 100644 --- a/bazel/rules/rules_score/private/safety_analysis.bzl +++ b/bazel/rules/rules_score/private/fmea.bzl @@ -12,50 +12,42 @@ # ******************************************************************************* """ -Safety Analysis build rules for S-CORE projects. +FMEA (Failure Mode and Effects Analysis) build rules for S-CORE projects. -This module provides macros and rules for defining safety analysis documentation -following S-CORE process guidelines. Safety analysis includes failure mode analysis, -control measures, fault tree analysis, and other safety-related artifacts. +This module provides macros and rules for defining FMEA documentation +following S-CORE process guidelines. FMEA documents failure modes, control +measures, and root-cause fault tree analysis diagrams for a component. """ -load("//bazel/rules/rules_score:providers.bzl", "SphinxSourcesInfo") -load("//bazel/rules/rules_score/private:architectural_design.bzl", "ArchitecturalDesignInfo") +load("//bazel/rules/rules_score:providers.bzl", "AnalysisInfo", "ArchitecturalDesignInfo", "SphinxSourcesInfo") -# ============================================================================ -# Provider Definition -# ============================================================================ - -AnalysisInfo = provider( - doc = "Provider for safety analysis artifacts", - fields = { - "controlmeasures": "Depset of control measures documentation or requirements", - "failuremodes": "Depset of failure modes documentation or requirements", - "fta": "Depset of Fault Tree Analysis diagrams", - "arch_design": "ArchitecturalDesignInfo provider for linked architectural design", - "name": "Name of the safety analysis target", - }, -) +# AnalysisInfo and ArchitecturalDesignInfo are re-exported from providers.bzl for backward compatibility. # ============================================================================ # Private Rule Implementation # ============================================================================ -def _analysis_impl(ctx): - """Implementation for safety_analysis rule. +def _fmea_impl(ctx): + """Implementation for fmea rule. - Collects safety analysis artifacts including control measures, failure modes, - and fault tree analysis diagrams, linking them to architectural design. + Collects FMEA artifacts including failure modes, control measures, and + fault tree diagrams, linking them to architectural design. Args: ctx: Rule context Returns: - List of providers including DefaultInfo and AnalysisInfo + List of providers including DefaultInfo, AnalysisInfo, SphinxSourcesInfo """ controlmeasures = depset(ctx.files.controlmeasures) failuremodes = depset(ctx.files.failuremodes) - fta = depset(ctx.files.fta) + fta = depset(ctx.files.root_causes) + + # TODO: render requirement sources (failuremodes, controlmeasures) into + # documentation and extract traceability artifacts. + + # TODO: preprocess fault tree diagrams (root_causes) and extract + # traceability artifacts. # Get architectural design provider if available arch_design_info = None @@ -91,24 +83,24 @@ def _analysis_impl(ctx): # Rule Definition # ============================================================================ -_analysis = rule( - implementation = _analysis_impl, - doc = "Collects safety analysis documents for S-CORE process compliance", +_fmea = rule( + implementation = _fmea_impl, + doc = "Collects FMEA documents and diagrams for S-CORE process compliance", attrs = { - "controlmeasures": attr.label_list( + "failuremodes": attr.label_list( allow_files = [".rst", ".md", ".trlc"], mandatory = False, - doc = "Control measures documentation or requirements targets (can be AoUs or requirements)", + doc = "Failure modes documentation or requirements targets", ), - "failuremodes": attr.label_list( + "controlmeasures": attr.label_list( allow_files = [".rst", ".md", ".trlc"], mandatory = False, - doc = "Failure modes documentation or requirements targets", + doc = "Control measures documentation or requirements targets (can be AoUs or requirements)", ), - "fta": attr.label_list( + "root_causes": attr.label_list( allow_files = [".puml", ".plantuml", ".png", ".svg"], mandatory = False, - doc = "Fault Tree Analysis (FTA) diagrams", + doc = "Root-cause Fault Tree Analysis (FTA) diagrams", ), "arch_design": attr.label( providers = [ArchitecturalDesignInfo], @@ -122,54 +114,38 @@ _analysis = rule( # Public Macro # ============================================================================ -def safety_analysis( +def fmea( name, - controlmeasures = [], failuremodes = [], - fta = [], + controlmeasures = [], + root_causes = [], arch_design = None, visibility = None): - """Define safety analysis following S-CORE process guidelines. + """Define FMEA documentation following S-CORE process guidelines. - Safety analysis documents the safety-related analysis of a component, - including failure mode and effects analysis (FMEA/FMEDA), fault tree - analysis (FTA), and control measures that mitigate identified risks. + FMEA (Failure Mode and Effects Analysis) documents the failure modes of a + component, the control measures that mitigate them, and optional fault tree + analysis diagrams that trace root causes. Args: - name: The name of the safety analysis target. Used as the base - name for all generated targets. + name: The name of the FMEA target. + failuremodes: Optional list of labels to documentation files or + requirements targets containing identified failure modes. controlmeasures: Optional list of labels to documentation files or requirements targets containing control measures that mitigate identified failure modes. Can reference Assumptions of Use or requirements as defined in the S-CORE process. - failuremodes: Optional list of labels to documentation files or - requirements targets containing identified failure modes as - defined in the S-CORE process. - fta: Optional list of labels to Fault Tree Analysis diagram files - (.puml, .plantuml, .png, .svg) as defined in the S-CORE process. + root_causes: Optional list of labels to Fault Tree Analysis diagram + files (.puml, .plantuml, .png, .svg) tracing root causes. arch_design: Optional label to an architectural_design target for - establishing traceability between safety analysis and architecture. - visibility: Bazel visibility specification for the generated targets. - - Generated Targets: - : Main safety analysis target providing AnalysisInfo - - Example: - ```starlark - safety_analysis( - name = "my_safety_analysis", - controlmeasures = [":my_control_measures"], - failuremodes = [":my_failure_modes"], - fta = ["fault_tree.puml"], - arch_design = ":my_architectural_design", - ) - ``` + establishing traceability between the FMEA and the architecture. + visibility: Bazel visibility specification. Default is None. """ - _analysis( + _fmea( name = name, - controlmeasures = controlmeasures, failuremodes = failuremodes, - fta = fta, + controlmeasures = controlmeasures, + root_causes = root_causes, arch_design = arch_design, visibility = visibility, ) diff --git a/bazel/rules/rules_score/private/sphinx_module.bzl b/bazel/rules/rules_score/private/sphinx_module.bzl index b342ea4..2ac80f2 100644 --- a/bazel/rules/rules_score/private/sphinx_module.bzl +++ b/bazel/rules/rules_score/private/sphinx_module.bzl @@ -14,20 +14,9 @@ # Providers # ====================================================================================== -SphinxModuleInfo = provider( - doc = "Provider for Sphinx HTML module documentation", - fields = { - "html_dir": "Directory containing HTML files", - }, -) +load("//bazel/rules/rules_score:providers.bzl", "SphinxModuleInfo", "SphinxNeedsInfo") -SphinxNeedsInfo = provider( - doc = "Provider for sphinx-needs info", - fields = { - "needs_json_file": "Direct needs.json file for this module", - "needs_json_files": "Depset of needs.json files including transitive dependencies", - }, -) +# SphinxModuleInfo and SphinxNeedsInfo are re-exported from providers.bzl for backward compatibility. # ====================================================================================== # Helpers diff --git a/bazel/rules/rules_score/private/unit_design.bzl b/bazel/rules/rules_score/private/unit_design.bzl new file mode 100644 index 0000000..6724baa --- /dev/null +++ b/bazel/rules/rules_score/private/unit_design.bzl @@ -0,0 +1,110 @@ +# ******************************************************************************* +# 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 +# ******************************************************************************* + +""" +Unit Design build rules for S-CORE projects. + +This module provides macros and rules for defining unit design documentation +following S-CORE process guidelines. Unit design documents describe the internal +design of a software unit, including static and dynamic views. +""" + +load("//bazel/rules/rules_score:providers.bzl", "SphinxSourcesInfo", "UnitDesignInfo") + +# ============================================================================ +# Private Rule Implementation +# ============================================================================ + +def _unit_design_impl(ctx): + """Implementation for unit_design rule. + + Collects unit design artifacts (RST documents and diagram files) and + provides them through the UnitDesignInfo and SphinxSourcesInfo providers. + + Args: + ctx: Rule context + + Returns: + List of providers including DefaultInfo, UnitDesignInfo, SphinxSourcesInfo + """ + all_source_files = depset( + transitive = [depset(ctx.files.static), depset(ctx.files.dynamic)], + ) + + # TODO: invoke diagram parser here to produce structured design artifacts + # for documentation and traceability (e.g. generate parsed binary + # representations of the diagrams for downstream analysis tools). + static_fbs = depset() + dynamic_fbs = depset() + + return [ + DefaultInfo(files = all_source_files), + UnitDesignInfo( + static = static_fbs, + dynamic = dynamic_fbs, + name = ctx.label.name, + ), + SphinxSourcesInfo( + srcs = all_source_files, + transitive_srcs = all_source_files, + ), + ] + +# ============================================================================ +# Rule Definition +# ============================================================================ + +_unit_design = rule( + implementation = _unit_design_impl, + doc = "Collects unit design documents and diagrams for S-CORE process compliance.", + attrs = { + "static": attr.label_list( + allow_files = [".puml", ".plantuml", ".svg", ".rst", ".md"], + doc = "Static design views (e.g., class diagrams, state machine diagrams).", + ), + "dynamic": attr.label_list( + allow_files = [".puml", ".plantuml", ".svg", ".rst", ".md"], + doc = "Dynamic design views (e.g., sequence diagrams, activity diagrams).", + ), + }, +) + +# ============================================================================ +# Public Macro +# ============================================================================ + +def unit_design( + name, + static = [], + dynamic = [], + visibility = None): + """Define unit design documentation following S-CORE process guidelines. + + A unit design describes the internal design of a software unit. It consists + of static views (e.g., class diagrams) and dynamic views (e.g., sequence + diagrams). + + Args: + name: The name of the unit design target. + static: List of labels to static design view files (.puml, .plantuml, + .svg, .rst, .md). Default is empty list. + dynamic: List of labels to dynamic design view files (.puml, .plantuml, + .svg, .rst, .md). Default is empty list. + visibility: Bazel visibility specification. Default is None. + """ + _unit_design( + name = name, + static = static, + dynamic = dynamic, + visibility = visibility, + ) diff --git a/bazel/rules/rules_score/providers.bzl b/bazel/rules/rules_score/providers.bzl index e038df2..9f35271 100644 --- a/bazel/rules/rules_score/providers.bzl +++ b/bazel/rules/rules_score/providers.bzl @@ -55,3 +55,88 @@ ComponentInfo = provider( "tests": "Depset of component-level integration test targets", }, ) + +UnitDesignInfo = provider( + doc = """Provider for unit design artifacts. + + Carries parsed representations of static and dynamic design views for a + software unit. The depset fields are populated once a diagram parser is + integrated; until then they are empty stubs. + """, + fields = { + "static": "Depset of parsed static design view artifacts (e.g., class diagrams)", + "dynamic": "Depset of parsed dynamic design view artifacts (e.g., sequence diagrams)", + "name": "Name of the unit design target", + }, +) + +ArchitecturalDesignInfo = provider( + doc = "Provider for architectural design artifacts", + fields = { + "static": "Depset of static architecture diagram files (e.g., class diagrams, component diagrams)", + "dynamic": "Depset of dynamic architecture diagram files (e.g., sequence diagrams, activity diagrams)", + "name": "Name of the architectural design target", + }, +) + +AnalysisInfo = provider( + doc = "Provider for FMEA and safety analysis artifacts", + fields = { + "controlmeasures": "Depset of control measures documentation or requirements", + "failuremodes": "Depset of failure modes documentation or requirements", + "fta": "Depset of Fault Tree Analysis diagrams", + "arch_design": "ArchitecturalDesignInfo provider for linked architectural design", + "name": "Name of the analysis target", + }, +) + +DependabilityAnalysisInfo = provider( + doc = "Provider for dependability analysis artifacts", + fields = { + "safety_analysis": "List of AnalysisInfo providers", + "security_analysis": "List of AnalysisInfo providers", + "arch_design": "ArchitecturalDesignInfo provider for linked architectural design", + "name": "Name of the dependability analysis target", + }, +) + +FeatureRequirementsInfo = provider( + doc = "Provider for feature requirements artifacts", + fields = { + "srcs": "Depset of source files containing feature requirements", + "name": "Name of the feature requirements target", + }, +) + +ComponentRequirementsInfo = provider( + doc = "Provider for component requirements artifacts", + fields = { + "srcs": "Depset of source files containing component requirements", + "requirements": "List of FeatureRequirementsInfo providers this component traces to", + "name": "Name of the component requirements target", + }, +) + +AssumptionsOfUseInfo = provider( + doc = "Provider for assumptions of use artifacts", + fields = { + "srcs": "Depset of source files containing assumptions of use", + "feature_requirements": "List of FeatureRequirementsInfo providers this AoU traces to", + "name": "Name of the assumptions of use target", + }, +) + +SphinxModuleInfo = provider( + doc = "Provider for Sphinx HTML module documentation", + fields = { + "html_dir": "Directory containing HTML files", + }, +) + +SphinxNeedsInfo = provider( + doc = "Provider for sphinx-needs info", + fields = { + "needs_json_file": "Direct needs.json file for this module", + "needs_json_files": "Depset of needs.json files including transitive dependencies", + }, +) diff --git a/bazel/rules/rules_score/rules_score.bzl b/bazel/rules/rules_score/rules_score.bzl index 513315f..27b983a 100644 --- a/bazel/rules/rules_score/rules_score.bzl +++ b/bazel/rules/rules_score/rules_score.bzl @@ -11,8 +11,6 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -load("@rules_python//sphinxdocs:sphinx.bzl", "sphinx_docs") -load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") load( "//bazel/rules/rules_score:providers.bzl", _ComponentInfo = "ComponentInfo", @@ -48,8 +46,8 @@ load( _feature_requirements = "feature_requirements", ) load( - "//bazel/rules/rules_score/private:safety_analysis.bzl", - _safety_analysis = "safety_analysis", + "//bazel/rules/rules_score/private:fmea.bzl", + _fmea = "fmea", ) load( "//bazel/rules/rules_score/private:sphinx_module.bzl", @@ -59,15 +57,20 @@ load( "//bazel/rules/rules_score/private:unit.bzl", _unit = "unit", ) +load( + "//bazel/rules/rules_score/private:unit_design.bzl", + _unit_design = "unit_design", +) architectural_design = _architectural_design assumptions_of_use = _assumptions_of_use component_requirements = _component_requirements dependability_analysis = _dependability_analysis feature_requirements = _feature_requirements -safety_analysis = _safety_analysis +fmea = _fmea sphinx_module = _sphinx_module unit = _unit +unit_design = _unit_design component = _component dependable_element = _dependable_element SphinxSourcesInfo = _SphinxSourcesInfo diff --git a/bazel/rules/rules_score/test/BUILD b/bazel/rules/rules_score/test/BUILD index dc62182..3a20e42 100644 --- a/bazel/rules/rules_score/test/BUILD +++ b/bazel/rules/rules_score/test/BUILD @@ -21,7 +21,7 @@ load( "dependability_analysis", "dependable_element", "feature_requirements", - "safety_analysis", + "fmea", "sphinx_module", "unit", ) @@ -126,12 +126,12 @@ dependability_analysis( safety_analysis = [":samplelibrary_safety_analysis"], ) -safety_analysis( +fmea( name = "samplelibrary_safety_analysis", - # TODO - # controlmeasures = [], # can be AoUs or requirements + # TODO: add failure modes, control measures, and root causes here # failuremodes = [], - # fta = [], + # controlmeasures = [], # can be AoUs or requirements + # root_causes = [], arch_design = ":arch_design", ) diff --git a/bazel/rules/rules_score/test/html_generation_test.bzl b/bazel/rules/rules_score/test/html_generation_test.bzl index 02545c5..031bca0 100644 --- a/bazel/rules/rules_score/test/html_generation_test.bzl +++ b/bazel/rules/rules_score/test/html_generation_test.bzl @@ -13,7 +13,7 @@ """Test rules for sphinx_module HTML generation and dependencies.""" load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") -load("@score_tooling//bazel/rules/rules_score/private:sphinx_module.bzl", "SphinxModuleInfo", "SphinxNeedsInfo") +load("@score_tooling//bazel/rules/rules_score:providers.bzl", "SphinxModuleInfo", "SphinxNeedsInfo") # ============================================================================ # Provider Tests diff --git a/bazel/rules/rules_score/test/score_module_providers_test.bzl b/bazel/rules/rules_score/test/score_module_providers_test.bzl index 24fba52..4dc9ead 100644 --- a/bazel/rules/rules_score/test/score_module_providers_test.bzl +++ b/bazel/rules/rules_score/test/score_module_providers_test.bzl @@ -13,7 +13,7 @@ """Tests for sphinx_module providers and two-phase build system.""" load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") -load("//bazel/rules/rules_score/private:sphinx_module.bzl", "SphinxModuleInfo", "SphinxNeedsInfo") +load("//bazel/rules/rules_score:providers.bzl", "SphinxModuleInfo", "SphinxNeedsInfo") # ============================================================================ # SphinxModuleInfo Provider Tests diff --git a/bazel/rules/rules_score/test/seooc_test.bzl b/bazel/rules/rules_score/test/seooc_test.bzl index 015fe56..b823bc8 100644 --- a/bazel/rules/rules_score/test/seooc_test.bzl +++ b/bazel/rules/rules_score/test/seooc_test.bzl @@ -21,7 +21,7 @@ Tests the SEooC (Safety Element out of Context) functionality including: """ load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") -load("@score_tooling//bazel/rules/rules_score/private:sphinx_module.bzl", "SphinxModuleInfo", "SphinxNeedsInfo") +load("@score_tooling//bazel/rules/rules_score:providers.bzl", "SphinxModuleInfo", "SphinxNeedsInfo") def _seooc_index_generation_test_impl(ctx): """Test that dependable_element generates proper index.rst file."""