Skip to content

Commit 7a03504

Browse files
authored
Merge branch 'eclipse-score:main' into main
2 parents 2d11870 + 9ffac09 commit 7a03504

32 files changed

+314
-65
lines changed

.bazelrc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,15 @@ build:per_shared --host_platform=@score_bazel_platforms//:x86_64-linux
5050
build:per-x86_64-linux --config=per_shared
5151
build:per-x86_64-linux --platforms=@score_bazel_platforms//:x86_64-linux
5252
build:per-x86_64-linux --extra_toolchains=@gcc_toolchain//:host_gcc_12
53-
53+
build:per-x86_64-linux --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu
5454
# -------------------------------------------------------------------------------
5555
# Config dedicated to target platform CPU:x86_64 and OS:QNX
5656
# -------------------------------------------------------------------------------
5757
build:per-x86_64-qnx --config=per_shared
5858
build:per-x86_64-qnx --platforms=@score_toolchains_qnx//platforms:x86_64-qnx
5959
build:per-x86_64-qnx --extra_toolchains=@toolchains_qnx_qcc//:qcc_x86_64
6060
build:per-x86_64-qnx --extra_toolchains=@toolchains_qnx_ifs//:ifs_x86_64
61+
build:per-x86_64-qnx --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_pc_nto_qnx800
6162

6263
# -------------------------------------------------------------------------------
6364
# Config dedicated to target platform CPU:arm64 and OS:QNX
@@ -66,6 +67,22 @@ build:per-arm64-qnx --config=per_shared
6667
build:per-arm64-qnx --platforms=@score_toolchains_qnx//platforms:aarch64-qnx8_0
6768
build:per-arm64-qnx --extra_toolchains=@toolchains_qnx_qcc//:qcc_aarch64
6869
build:per-arm64-qnx --extra_toolchains=@toolchains_qnx_ifs//:ifs_aarch64
70+
build:per-arm64-qnx --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_aarch64_unknown_nto_qnx800
71+
72+
73+
# -------------------------------------------------------------------------------
74+
# Ferrocene Rust coverage config
75+
# -------------------------------------------------------------------------------
76+
build:ferrocene-coverage --@rules_rust//rust/settings:extra_rustc_flag=-Cinstrument-coverage
77+
build:ferrocene-coverage --@rules_rust//rust/settings:extra_rustc_flag=-Clink-dead-code
78+
build:ferrocene-coverage --@rules_rust//rust/settings:extra_rustc_flag=-Ccodegen-units=1
79+
build:ferrocene-coverage --@rules_rust//rust/settings:extra_rustc_flag=-Cdebuginfo=2
80+
build:ferrocene-coverage --@rules_rust//rust/settings:extra_exec_rustc_flag=-Cinstrument-coverage
81+
build:ferrocene-coverage --@rules_rust//rust/settings:extra_exec_rustc_flag=-Clink-dead-code
82+
build:ferrocene-coverage --@rules_rust//rust/settings:extra_exec_rustc_flag=-Ccodegen-units=1
83+
build:ferrocene-coverage --@rules_rust//rust/settings:extra_exec_rustc_flag=-Cdebuginfo=2
84+
test:ferrocene-coverage --run_under=@score_tooling//coverage:llvm_profile_wrapper
85+
6986

7087
# -------------------------------------------------------------------------------
7188
# Import local user workspace file, if exists
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
name: Rust Coverage (Demo)
14+
on:
15+
pull_request:
16+
types: [opened, reopened, synchronize]
17+
workflow_dispatch:
18+
19+
jobs:
20+
rust_coverage:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4.2.2
25+
26+
- name: Setup Bazel
27+
uses: bazel-contrib/setup-bazel@0.14.0
28+
29+
- name: Run Rust tests with coverage instrumentation
30+
run: |
31+
set -euo pipefail
32+
bazel test --config=per-x86_64-linux --config=ferrocene-coverage \
33+
--nocache_test_results \
34+
//src/rust/...
35+
36+
- name: Generate Ferrocene coverage reports
37+
run: |
38+
set -euo pipefail
39+
bazel run //:rust_coverage -- --min-line-coverage 90
40+
41+
- name: Locate coverage artifacts
42+
run: |
43+
echo "COVERAGE_DIR=$(bazel info bazel-bin)/coverage/rust-tests" >> "${GITHUB_ENV}"
44+
45+
- name: Upload coverage HTML
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: rust-coverage-html
49+
path: ${{ env.COVERAGE_DIR }}

BUILD

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
load("@rules_rust//rust:defs.bzl", "rust_clippy")
1515
load("@score_docs_as_code//:docs.bzl", "docs")
16-
load("@score_tooling//:defs.bzl", "cli_helper", "copyright_checker", "dash_license_checker", "setup_starpls", "use_format_targets")
16+
load("@score_tooling//:defs.bzl", "cli_helper", "copyright_checker", "dash_license_checker", "rust_coverage_report", "setup_starpls", "use_format_targets")
1717
load("//:project_config.bzl", "PROJECT_CONFIG")
1818

1919
# Creates all documentation targets:
@@ -84,6 +84,22 @@ cli_helper(
8484
visibility = ["//visibility:public"],
8585
)
8686

87+
rust_coverage_report(
88+
name = "rust_coverage",
89+
bazel_configs = [
90+
"per-x86_64-linux",
91+
"ferrocene-coverage",
92+
],
93+
query = 'kind("rust_test", //src/rust/...)',
94+
visibility = ["//visibility:public"],
95+
)
96+
97+
alias(
98+
name = "rust_coverage_report",
99+
actual = ":rust_coverage",
100+
visibility = ["//visibility:public"],
101+
)
102+
87103
# Add target for formatting checks
88104
use_format_targets()
89105

MODULE.bazel

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ bazel_dep(name = "rules_rust", version = "0.61.0")
4343
# Shared Rust policies (Clippy config, etc.), overridden locally during development.
4444
bazel_dep(name = "score_rust_policies", version = "0.0.2", dev_dependency = True)
4545

46-
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust", dev_dependency = True)
47-
rust.toolchain(
48-
edition = "2021",
49-
versions = ["1.85.0"],
50-
)
51-
5246
# bazel cc rules
5347
bazel_dep(name = "rules_cc", version = "0.1.2")
5448

@@ -93,30 +87,12 @@ bazel_dep(name = "score_platform", version = "0.5.2", dev_dependency = True)
9387

9488
bazel_dep(name = "score_process", version = "1.3.2")
9589
bazel_dep(name = "score_python_basics", version = "0.3.4")
96-
bazel_dep(name = "score_tooling", version = "1.0.3")
97-
98-
# ToDo: remove this once 1.0.4 is released,
99-
# since it will contain updated cr_checker
100-
git_override(
101-
module_name = "score_tooling",
102-
commit = "654664dae7df2700fd5840c5ed6c07ac6c61705d", #until 1.0.4 is released
103-
remote = "https://github.com/eclipse-score/tooling.git",
104-
)
90+
bazel_dep(name = "score_tooling", version = "1.1.0")
10591

10692
# ToDo: implicit dependencies for score_tooling, but needed directly here??
10793
bazel_dep(name = "aspect_rules_lint", version = "1.10.2")
10894
bazel_dep(name = "buildifier_prebuilt", version = "8.2.0.2")
10995

110-
## additional settings / config
111-
bazel_dep(name = "rust_qnx8_toolchain", version = "1.0.0", dev_dependency = True)
112-
archive_override(
113-
module_name = "rust_qnx8_toolchain",
114-
strip_prefix = "qnx8",
115-
urls = [
116-
"https://github.com/qorix-group/rust-lang-qnx8/releases/download/1.0.0/qnx8_rust_toolchain.tar.gz",
117-
],
118-
)
119-
12096
## temporary overrides / tools
12197
# Testing utils dependency.
12298
# Direct usage of tag in git_override reports false problem in editor, using hash of a tag
@@ -135,13 +111,7 @@ git_override(
135111
remote = "https://github.com/eclipse-score/baselibs.git",
136112
)
137113

138-
bazel_dep(name = "score_toolchains_rust", version = "0.1", dev_dependency = True)
139-
git_override(
140-
module_name = "score_toolchains_rust",
141-
commit = "5614e4b273f2f5302d47a05d7e58dae86f97a3c3",
142-
remote = "https://github.com/eclipse-score/toolchains_rust.git",
143-
)
144-
114+
bazel_dep(name = "score_toolchains_rust", version = "0.4.0", dev_dependency = True)
145115
bazel_dep(name = "custom_qemu", version = "1.0.0", dev_dependency = True)
146116
archive_override(
147117
module_name = "custom_qemu",
@@ -152,11 +122,5 @@ archive_override(
152122
],
153123
)
154124

155-
# Registers the custom Rust toolchain wired to @qnx_rust
156-
register_toolchains(
157-
"@score_toolchains_rust//toolchains/aarch64-unknown-qnx8_0:toolchain_aarch64_qnx8_0",
158-
dev_dependency = True,
159-
)
160-
161125
# S-CORE crates
162126
bazel_dep(name = "score_crates", version = "0.0.6")

src/rust/rust_kvs/examples/basic.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// *******************************************************************************
2+
// Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
//
4+
// See the NOTICE file(s) distributed with this work for additional
5+
// information regarding copyright ownership.
6+
//
7+
// This program and the accompanying materials are made available under the
8+
// terms of the Apache License Version 2.0 which is available at
9+
// <https://www.apache.org/licenses/LICENSE-2.0>
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
// *******************************************************************************
113
//! Example for basic operations.
214
//! - Creating KVS instance using `KvsBuilder` with `kvs_load` modes.
315
//! - Basic key-value operations: `get_value`, `get_value_as`, `set_value`, `get_all_keys`.

src/rust/rust_kvs/examples/custom_types.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// *******************************************************************************
2+
// Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
//
4+
// See the NOTICE file(s) distributed with this work for additional
5+
// information regarding copyright ownership.
6+
//
7+
// This program and the accompanying materials are made available under the
8+
// terms of the Apache License Version 2.0 which is available at
9+
// <https://www.apache.org/licenses/LICENSE-2.0>
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
// *******************************************************************************
113
//! Example for custom types usage for KVS, with serialization and deserialization.
214
//! - Implementing serialization/deserialization traits for custom types.
315
//! - Handling external and nested types.

src/rust/rust_kvs/examples/defaults.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// *******************************************************************************
2+
// Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
//
4+
// See the NOTICE file(s) distributed with this work for additional
5+
// information regarding copyright ownership.
6+
//
7+
// This program and the accompanying materials are made available under the
8+
// terms of the Apache License Version 2.0 which is available at
9+
// <https://www.apache.org/licenses/LICENSE-2.0>
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
// *******************************************************************************
113
//! Example for default values.
214
//! - Creating KVS instance using `KvsBuilder` with `defaults` modes.
315
//! - Default-specific APIs: `get_default_value`, `is_value_default`.

src/rust/rust_kvs/examples/snapshots.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
// *******************************************************************************
2+
// Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
//
4+
// See the NOTICE file(s) distributed with this work for additional
5+
// information regarding copyright ownership.
6+
//
7+
// This program and the accompanying materials are made available under the
8+
// terms of the Apache License Version 2.0 which is available at
9+
// <https://www.apache.org/licenses/LICENSE-2.0>
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
// *******************************************************************************
113
//! Example for snapshots handling.
214
//! - Snapshot count and max count.
315
//! - Snapshot restore.

src/rust/rust_kvs/src/error_code.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (c) 2025 Contributors to the Eclipse Foundation
1+
// *******************************************************************************
2+
// Copyright (c) 2026 Contributors to the Eclipse Foundation
23
//
34
// See the NOTICE file(s) distributed with this work for additional
45
// information regarding copyright ownership.
@@ -8,7 +9,7 @@
89
// <https://www.apache.org/licenses/LICENSE-2.0>
910
//
1011
// SPDX-License-Identifier: Apache-2.0
11-
12+
// *******************************************************************************
1213
extern crate alloc;
1314

1415
use alloc::string::FromUtf8Error;

src/rust/rust_kvs/src/json_backend.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (c) 2025 Contributors to the Eclipse Foundation
1+
// *******************************************************************************
2+
// Copyright (c) 2026 Contributors to the Eclipse Foundation
23
//
34
// See the NOTICE file(s) distributed with this work for additional
45
// information regarding copyright ownership.
@@ -8,7 +9,7 @@
89
// <https://www.apache.org/licenses/LICENSE-2.0>
910
//
1011
// SPDX-License-Identifier: Apache-2.0
11-
12+
// *******************************************************************************
1213
use crate::error_code::ErrorCode;
1314
use crate::kvs_api::{InstanceId, SnapshotId};
1415
use crate::kvs_backend::KvsBackend;

0 commit comments

Comments
 (0)