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
4 changes: 3 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ build --tool_java_language_version=17
build --java_runtime_version=remotejdk_17
build --tool_java_runtime_version=remotejdk_17

build --@score_baselibs_rust//src/log:safety_level=qm
build --@score_baselibs//score/json:base_library=nlohmann
build --@score_baselibs//score/mw/log/flags:KRemote_Logging=False
build --@score_logging//score/mw/log/flags:KRemote_Logging=False

# Clippy linting (enabled by default)
build --aspects=@score_rust_policies//clippy:linters.bzl%clippy_strict
build --output_groups=+rules_lint_human
build:lint --@aspect_rules_lint//lint:fail_on_violation=true
build:lint --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu

test --test_output=errors

Expand Down
42 changes: 40 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ edition = "2021"
[workspace.dependencies]
rust_kvs = { path = "src/rust/rust_kvs" }
rust_kvs_tool = { path = "src/rust/rust_kvs_tool" }
score_log = { git = "https://github.com/eclipse-score/baselibs_rust.git", tag = "v0.1.0", features = [
"qm",
] }
stdout_logger = { git = "https://github.com/eclipse-score/baselibs_rust.git", tag = "v0.1.0" }

adler32 = "1.2.0"
tinyjson = "2.5.1"
Expand Down
10 changes: 10 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ bazel_dep(name = "platforms", version = "1.0.0")

## S-CORE bazel registry
bazel_dep(name = "score_baselibs", version = "0.2.4")
bazel_dep(name = "score_baselibs_rust", version = "0.1.0")
bazel_dep(name = "score_bazel_platforms", version = "0.0.4")
bazel_dep(name = "score_docs_as_code", version = "3.0.0")

Expand All @@ -73,6 +74,15 @@ bazel_dep(name = "score_process", version = "1.4.3", dev_dependency = True)

bazel_dep(name = "score_python_basics", version = "0.3.4")
bazel_dep(name = "score_tooling", version = "1.1.0")
bazel_dep(name = "score_logging", version = "0.1.0")

# TODO: remove once inherited properly from `score_logging`.
bazel_dep(name = "trlc", version = "0.0.0", dev_dependency = True)
git_override(
module_name = "trlc",
commit = "650b51a47264a4f232b3341f473527710fc32669", # trlc-2.0.2 release
remote = "https://github.com/bmw-software-engineering/trlc.git",
)

# ToDo: implicit dependencies for score_tooling, but needed directly here??
bazel_dep(name = "aspect_rules_lint", version = "2.0.0")
Expand Down
1 change: 1 addition & 0 deletions src/rust/rust_kvs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ rust_library(
srcs = glob(["src/**/*.rs"]),
visibility = ["//visibility:public"],
deps = [
"@score_baselibs_rust//src/log/score_log",
"@score_crates//:adler32",
"@score_crates//:tinyjson",
],
Expand Down
1 change: 1 addition & 0 deletions src/rust/rust_kvs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition.workspace = true
[dependencies]
adler32.workspace = true
tinyjson.workspace = true
score_log.workspace = true


[dev-dependencies]
Expand Down
5 changes: 3 additions & 2 deletions src/rust/rust_kvs/examples/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
//! Example for migrations between backends.

use rust_kvs::prelude::*;
use score_log::ScoreDebug;

/// Example custom backend.
/// Returns some data on `load_kvs`.
#[derive(PartialEq)]
#[derive(PartialEq, ScoreDebug)]
struct FromBackend;

impl KvsBackend for FromBackend {
Expand Down Expand Up @@ -51,7 +52,7 @@ impl KvsBackend for FromBackend {

/// Example custom backend.
/// Prints provided data to stdout.
#[derive(PartialEq)]
#[derive(PartialEq, ScoreDebug)]
struct ToBackend;

impl KvsBackend for ToBackend {
Expand Down
11 changes: 6 additions & 5 deletions src/rust/rust_kvs/src/error_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
// *******************************************************************************
extern crate alloc;

use crate::log::{error, ScoreDebug};
use alloc::string::FromUtf8Error;
use core::array::TryFromSliceError;

/// Runtime Error Codes
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, ScoreDebug)]
pub enum ErrorCode {
/// Error that was not yet mapped
UnmappedError,
Expand Down Expand Up @@ -94,7 +95,7 @@ impl From<std::io::Error> for ErrorCode {
match kind {
std::io::ErrorKind::NotFound => ErrorCode::FileNotFound,
_ => {
eprintln!("error: unmapped error: {kind}");
error!("Unmapped IO error: {:?}", kind.to_string());
ErrorCode::UnmappedError
},
}
Expand All @@ -103,21 +104,21 @@ impl From<std::io::Error> for ErrorCode {

impl From<FromUtf8Error> for ErrorCode {
fn from(cause: FromUtf8Error) -> Self {
eprintln!("error: UTF-8 conversion failed: {cause:#?}");
error!("Conversion from UTF-8 failed: {:#?}", cause);
ErrorCode::ConversionFailed
}
}

impl From<TryFromSliceError> for ErrorCode {
fn from(cause: TryFromSliceError) -> Self {
eprintln!("error: try_into from slice failed: {cause:#?}");
error!("Conversion from slice failed: {:#?}", cause);
ErrorCode::ConversionFailed
}
}

impl From<Vec<u8>> for ErrorCode {
fn from(cause: Vec<u8>) -> Self {
eprintln!("error: try_into from u8 vector failed: {cause:#?}");
error!("Conversion from vector of u8 failed: {:#?}", cause);
ErrorCode::ConversionFailed
}
}
Expand Down
Loading