Skip to content
Draft
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
13 changes: 13 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Bzlmod
common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/refs/heads/main/
common --registry=https://bcr.bazel.build
common --check_direct_dependencies=error

# Use native sphinx_build_binary instead of the wrapper
build --//third_party/sphinx:use_native_sphinx_build

# Java runtime for plantuml
build --java_runtime_version=remotejdk_21

# Python version for score_tooling pip hub
build --@rules_python//python/config_settings:python_version=3.12
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.3.0
19 changes: 17 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ module(
compatibility_level = 0,
)

bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "rules_rust", version = "0.61.0")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "rules_rust", version = "0.68.1-score")

crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
crate.spec(
Expand Down Expand Up @@ -389,3 +390,17 @@ git_override(
commit = "d528fbdec2cd72ff7967b51546fb0bd935810258",
remote = "https://github.com/bmw-software-engineering/lobster.git",
)

bazel_dep(name = "rules_python", version = "1.8.5", dev_dependency = True)

bazel_dep(name = "score_tooling")
git_override(
module_name = "score_tooling",
commit = "549c7ee315cfbc27a42247b11cb70c953eac75dc",
remote = "https://github.com/eclipse-score/tooling.git",
)

register_toolchains(
"@score_tooling//bazel/rules/rules_score:sphinx_default_toolchain",
dev_dependency = True,
)
9,038 changes: 7,063 additions & 1,975 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

37 changes: 36 additions & 1 deletion docs/pastey/docs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,46 @@
# *******************************************************************************

load("@trlc//:trlc.bzl", "trlc_requirements")
load(
"@score_tooling//bazel/rules/rules_score:rules_score.bzl",
"assumptions_of_use",
"dependable_element",
"dependability_analysis",
)

trlc_requirements(
name = "aou",
name = "aou_trlc",
srcs = [
"aou.trlc",
],
spec = [
"@score_tooling//bazel/rules/rules_score/trlc/config:score_requirements_model",
],
visibility = ["//visibility:public"],
)

assumptions_of_use(
name = "aou",
srcs = [":aou_trlc"],
visibility = ["//visibility:public"],
)

dependability_analysis(
name = "pastey_dependability_analysis",
arch_design = "//docs/pastey/docs/design:pastey_design",
fmea = ["//docs/pastey/docs/safety_analysis:pastey_fmea"],
)

dependable_element(
name = "pastey",
integrity_level = "B",
assumptions_of_use = [":aou"],
requirements = [
"//docs/pastey/docs/requirement:system_requirements",
"//docs/pastey/docs/requirement:feature_requirements",
],
architectural_design = ["//docs/pastey/docs/design:pastey_design"],
components = ["//docs/pastey/docs/component:pastey_component"],
dependability_analysis = [":pastey_dependability_analysis"],
tests = ["//docs/pastey/tests:pastey_test"],
)
24 changes: 24 additions & 0 deletions docs/pastey/docs/component/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# *******************************************************************************
# 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
# *******************************************************************************

load(
"@score_tooling//bazel/rules/rules_score:rules_score.bzl",
"component",
)

component(
name = "pastey_component",
requirements = ["//docs/pastey/docs/requirement:component_requirements"],
tests = [],
visibility = ["//visibility:public"],
)
27 changes: 27 additions & 0 deletions docs/pastey/docs/design/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# *******************************************************************************
# 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
# *******************************************************************************

load(
"@score_tooling//bazel/rules/rules_score:rules_score.bzl",
"architectural_design",
)

architectural_design(
name = "pastey_design",
static = [
"public_api.puml",
"static_design.puml",
"architectural_design.rst",
],
visibility = ["//visibility:public"],
)
23 changes: 23 additions & 0 deletions docs/pastey/docs/design/architectural_design.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Pastey Architectural Design
============================

Overview
--------

``pastey`` is a Rust procedural macro crate that provides compile-time token
manipulation and identifier synthesis. It operates entirely at compile time
within the Rust compiler's macro expansion phase.

.. uml:: static_design.puml

Public API
----------

.. uml:: public_api.puml

Component Structure
-------------------

The pastey crate consists of a single proc-macro entry point that processes
token streams passed to the ``paste!`` macro invocation. All processing occurs
at compile time with no runtime footprint.
7 changes: 7 additions & 0 deletions docs/pastey/docs/design/public_api.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@startuml public_api

package "pastey public interface" as pastey_pub {
interface "paste!(tokens)" as paste_macro
}

@enduml
7 changes: 7 additions & 0 deletions docs/pastey/docs/design/static_design.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@startuml static_design

package "pastey" as pastey <<SEooC>> {
component "pastey_component" as pastey_component <<component>>
}

@enduml
13 changes: 9 additions & 4 deletions docs/pastey/docs/requirement/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,22 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

load("@trlc//:trlc.bzl", "trlc_requirements")
load(
"@score_tooling//bazel/rules/rules_score:rules_score.bzl",
"assumed_system_requirements",
"component_requirements",
"feature_requirements",
)

trlc_requirements(
assumed_system_requirements(
name = "system_requirements",
srcs = [
"assumed_system_requirements.trlc",
],
visibility = ["//visibility:public"],
)

trlc_requirements(
feature_requirements(
name = "feature_requirements",
srcs = [
"feature_requirements.trlc",
Expand All @@ -32,7 +37,7 @@ trlc_requirements(
],
)

trlc_requirements(
component_requirements(
name = "component_requirements",
srcs = [
"component_requirements.trlc",
Expand Down
4 changes: 2 additions & 2 deletions docs/pastey/docs/requirement/assumed_system_requirements.trlc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
********************************************************************************
/********************************************************************************
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
Expand All @@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
package RustCrateSysReq
package PasteySysReq

import ScoreReq

Expand Down
1 change: 1 addition & 0 deletions docs/pastey/docs/requirement/component_requirements.trlc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package PasteyComReq

import ScoreReq
import PasteyFeatReq

ScoreReq.CompReq REQ_COMP_PASTEY_001 {
description = "The pastey component shall collect all tokens inside a paste! interpolation block (the [< ... >] syntax) and shall discard whitespace tokens between them before performing identifier concatenation"
Expand Down
3 changes: 2 additions & 1 deletion docs/pastey/docs/requirement/feature_requirements.trlc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
package PasteyFeatReq

import ScoreReq
import PasteySysReq

ScoreReq.FeatReq FEAT_PASTEY_001 {
description = "The pastey crate shall provide compile-time token manipulation capabilities for procedural macro expansion in Rust applications."
safety = ScoreReq.Asil.B
derived_from = [RustCrateSysReq.ASR_RUST_CRATE@1]
derived_from = [PasteySysReq.ASR_RUST_CRATE@1]
version = 1
}
22 changes: 22 additions & 0 deletions docs/pastey/docs/safety_analysis/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# *******************************************************************************
# 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
# *******************************************************************************

load("@score_tooling//bazel/rules/rules_score:rules_score.bzl", "fmea")

fmea(
name = "pastey_fmea",
failuremodes = ["failure_modes.trlc"],
controlmeasures = ["control_measures.trlc"],
root_causes = ["fta.puml"],
visibility = ["//visibility:public"],
)
34 changes: 34 additions & 0 deletions docs/pastey/docs/safety_analysis/control_measures.trlc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/********************************************************************************
* 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
********************************************************************************/
package PasteyControlMeasures

import ScoreReq

ScoreReq.ControlMeasure CM_PASTEY_001 {
description = "The pastey crate shall emit a compile error when the interpolation block is empty or contains no valid tokens, preventing silent empty-identifier generation."
safety = ScoreReq.Asil.B
version = 1
}

ScoreReq.ControlMeasure CM_PASTEY_002 {
description = "The pastey crate shall emit a compile error when an unknown or unsupported modifier is encountered inside an interpolation block."
safety = ScoreReq.Asil.B
version = 1
}

ScoreReq.AoU CM_PASTEY_AOU_001 {
description = "It shall be ensured that the paste! macro is only used in Rust source positions where an identifier is syntactically valid, as pastey emits raw tokens without positional validation."
safety = ScoreReq.Asil.B
version = 1
mitigates = "FM_PASTEY_003"
}
45 changes: 45 additions & 0 deletions docs/pastey/docs/safety_analysis/failure_modes.trlc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/********************************************************************************
* 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
********************************************************************************/
package PasteyFailureModes

import ScoreReq

ScoreReq.FailureMode FM_PASTEY_001 {
guideword = ScoreReq.GuideWord.LossOfFunction
description = "The paste! macro shall fail to synthesize an identifier when the token stream inside the interpolation block is empty or contains only whitespace."
failureeffect = "Compilation fails with a macro expansion error, preventing the build from succeeding."
safety = ScoreReq.Asil.B
version = 1
interface = "pastey::paste!"
potentialcause = "Caller passes an empty or whitespace-only interpolation block to the paste! macro."
}

ScoreReq.FailureMode FM_PASTEY_002 {
guideword = ScoreReq.GuideWord.Wrong
description = "The paste! macro shall produce an incorrect identifier when an unsupported modifier is silently ignored instead of emitting a compile error."
failureeffect = "A wrong identifier is emitted into the surrounding code, potentially causing incorrect behaviour or silent logic errors."
safety = ScoreReq.Asil.B
version = 1
interface = "pastey::paste!"
potentialcause = "An unknown or misspelled modifier token is passed inside the interpolation block."
}

ScoreReq.FailureMode FM_PASTEY_003 {
guideword = ScoreReq.GuideWord.UnintendedFunction
description = "The paste! macro shall expand tokens in a syntactically invalid position causing the surrounding Rust code to fail to compile."
failureeffect = "Build failure due to invalid token placement in generated code."
safety = ScoreReq.Asil.B
version = 1
interface = "pastey::paste!"
potentialcause = "Invoker uses paste! in a Rust source position where an identifier is not syntactically valid."
}
27 changes: 27 additions & 0 deletions docs/pastey/docs/safety_analysis/fmea.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Pastey FMEA – Failure Mode and Effects Analysis
================================================

.. list-table:: Failure Modes
:header-rows: 1
:widths: 10 30 20 20 20

* - ID
- Failure Mode
- Guide Word
- Failure Effect
- Control Measure
* - FM_PASTEY_001
- The paste! macro fails to synthesize an identifier when the token stream is empty or whitespace-only.
- LossOfFunction
- Compilation fails with a macro expansion error.
- CM_PASTEY_001: Emit compile error on empty interpolation block.
* - FM_PASTEY_002
- The paste! macro produces an incorrect identifier when an unsupported modifier is silently ignored.
- Wrong
- A wrong identifier is emitted causing silent logic errors.
- CM_PASTEY_002: Emit compile error on unknown modifier.
* - FM_PASTEY_003
- The paste! macro expands tokens in a syntactically invalid position.
- UnintendedFunction
- Build failure due to invalid token placement in generated code.
- AoU: Invoker shall only use paste! in syntactically valid positions.
Loading
Loading