Skip to content

Commit 604b312

Browse files
Update GCC & Rust toolchains (eclipse-score#42)
Use latest GCC and Rust S-CORE toolchains within FEO
1 parent 54386ef commit 604b312

File tree

7 files changed

+58
-72
lines changed

7 files changed

+58
-72
lines changed

.bazelrc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ test --test_output=errors
2121
common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/
2222
common --registry=https://bcr.bazel.build
2323

24+
common --extra_toolchains=@score_gcc_x86_64_toolchain//:x86_64-linux-gcc_12.2.0-posix
25+
common --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu
26+
27+
# -------------------------------------------------------------------------------
28+
# Config dedicated to host platform CPU:x86_64 and OS:Linux
29+
# -------------------------------------------------------------------------------
30+
build:x86_64-linux --platforms=@score_bazel_platforms//:x86_64-linux-gcc_12.2.0-posix
31+
build:x86_64-linux --extra_toolchains=@score_gcc_x86_64_toolchain//:x86_64-linux-gcc_12.2.0-posix
32+
build:x86_64-linux --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu
33+
2434
# Clippy linting (enabled by default)
2535
build --aspects=@score_rust_policies//clippy:linters.bzl%clippy_strict
2636
build --output_groups=+rules_lint_human
@@ -29,12 +39,3 @@ build:lint --@aspect_rules_lint//lint:fail_on_violation=true
2939
build:lint-rust --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
3040
build:lint-rust --output_groups=+clippy_checks
3141
build:lint-rust --@rules_rust//:clippy.toml=//:clippy.toml
32-
33-
common --extra_toolchains=@gcc_toolchain//:host_gcc_12
34-
build --incompatible_strict_action_env
35-
test --test_tag_filters=-manual
36-
build --experimental_retain_test_configuration_across_testonly #https://github.com/bazelbuild/bazel/issues/6842
37-
38-
# unshare /dev/shm and /tmp
39-
test --sandbox_tmpfs_path=/dev/shm
40-
test --sandbox_tmpfs_path=/tmp

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ jobs:
4040
run: bazel mod tidy
4141

4242
- name: Build all workspace targets
43-
run: bazel build //...
43+
run: bazel build --config=x86_64-linux //...
4444

4545
- name: Run all workspace tests
46-
run: bazel test //...
46+
run: bazel test --config=x86_64-linux //...
4747

4848
- name: Lint rust code (with clippy)
4949
run: bazel build --config=lint-rust //...

MODULE.bazel

Lines changed: 25 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ module(
1616
compatibility_level = 1,
1717
)
1818

19+
bazel_dep(name = "platforms", version = "1.0.0")
20+
bazel_dep(name = "score_bazel_platforms", version = "0.0.4")
21+
1922
# SCORE bazel module dependencies
2023
bazel_dep(name = "score_tooling", version = "1.1.0")
2124
bazel_dep(name = "score_crates", version = "0.0.6")
@@ -24,9 +27,6 @@ bazel_dep(name = "score_crates", version = "0.0.6")
2427
bazel_dep(name = "rules_rust", version = "0.67.0")
2528
bazel_dep(name = "rules_rust_prost", version = "0.67.0")
2629

27-
# C/C++ rules for Bazel
28-
bazel_dep(name = "rules_cc", version = "0.2.8")
29-
3030
# Protobuf
3131
# Repo_name override is needed here for compatibility with WORKSPACE (e.g.for rules_rust_prost)
3232
# Newer protobuf versions generate warnings during compilation which will cause the build failure due
@@ -42,50 +42,35 @@ bazel_dep(name = "googletest", version = "1.17.0")
4242
bazel_dep(name = "score_docs_as_code", version = "3.0.0")
4343

4444
# Toolchains
45-
# GCC toolchain
46-
bazel_dep(name = "score_toolchains_gcc", version = "0.5", dev_dependency = True)
45+
bazel_dep(name = "rules_cc", version = "0.2.16")
46+
47+
bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.2.2", dev_dependency = True)
4748

48-
gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency = True)
49+
# Extensions
50+
gcc = use_extension("@score_bazel_cpp_toolchains//extensions:gcc.bzl", "gcc", dev_dependency = True)
4951
gcc.toolchain(
50-
sha256 = "457f5f20f57528033cb840d708b507050d711ae93e009388847e113b11bf3600",
51-
strip_prefix = "x86_64-unknown-linux-gnu",
52-
url = "https://github.com/eclipse-score/toolchains_gcc_packages/releases/download/0.0.1/x86_64-unknown-linux-gnu_gcc12.tar.gz",
52+
name = "score_gcc_x86_64_toolchain",
53+
target_cpu = "x86_64",
54+
target_os = "linux",
55+
use_default_package = True,
56+
version = "12.2.0",
5357
)
54-
55-
# TODO to be moved to toolchain. https://github.com/eclipse-score/toolchains_gcc/issues/11
56-
gcc.extra_features(
57-
features = [
58-
"minimal_warnings",
59-
"treat_warnings_as_errors",
60-
],
58+
gcc.toolchain(
59+
name = "score_gcc_aarch64_toolchain",
60+
target_cpu = "aarch64",
61+
target_os = "linux",
62+
use_default_package = True,
63+
version = "12.2.0",
6164
)
62-
gcc.warning_flags(
63-
minimal_warnings = [
64-
"-Wall",
65-
"-Wno-error=deprecated-declarations",
66-
],
67-
strict_warnings = [
68-
"-Wextra",
69-
"-Wpedantic",
70-
],
71-
treat_warnings_as_errors = ["-Werror"],
65+
use_repo(
66+
gcc,
67+
"score_gcc_aarch64_toolchain",
68+
"score_gcc_x86_64_toolchain",
7269
)
73-
use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc")
7470

7571
# Rust toolchain
76-
RUST_EDITION = "2024"
77-
78-
RUST_VERSION = "1.93.0"
79-
80-
# Shared Rust policies (Clippy config, etc.), overridden locally during development.
81-
bazel_dep(name = "score_rust_policies", version = "0.0.4", dev_dependency = True)
82-
83-
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
84-
rust.toolchain(
85-
edition = RUST_EDITION,
86-
versions = [RUST_VERSION],
87-
)
88-
use_repo(rust, "rust_toolchains")
72+
bazel_dep(name = "score_toolchains_rust", version = "0.4.0", dev_dependency = True)
73+
bazel_dep(name = "score_rust_policies", version = "0.0.5", dev_dependency = True)
8974

9075
# Prost toolchain
9176
register_toolchains("//toolchain/prost:prost_toolchain")

examples/rust/mini-adas/src/activities/components.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,13 @@ impl Activity for BrakeController {
380380
debug!("Stepping BrakeController");
381381
sleep_random();
382382

383-
if let Ok(brake_instruction) = self.input_brake_instruction.read()
384-
&& brake_instruction.active
385-
{
386-
debug!(
387-
"BrakeController activating brakes with level {:.3}",
388-
brake_instruction.level
389-
)
383+
if let Ok(brake_instruction) = self.input_brake_instruction.read() {
384+
if brake_instruction.active {
385+
debug!(
386+
"BrakeController activating brakes with level {:.3}",
387+
brake_instruction.level
388+
)
389+
}
390390
}
391391
Ok(())
392392
}

feo/src/scheduler.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,10 @@ impl Scheduler {
360360
);
361361
break;
362362
}
363-
if let Ok(Some(Signal::TerminateAck(agent_id))) = self.connector.receive(self.receive_timeout)
364-
&& pending_agent_acks.remove(&agent_id)
365-
{
366-
info!("Received TerminateAck from agent {}", agent_id);
363+
if let Ok(Some(Signal::TerminateAck(agent_id))) = self.connector.receive(self.receive_timeout) {
364+
if pending_agent_acks.remove(&agent_id) {
365+
info!("Received TerminateAck from agent {}", agent_id);
366+
}
367367
}
368368
}
369369

feo/src/signalling/common/socket/connection.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,20 @@ where
8383
{
8484
/// Try to read from this connection
8585
pub(crate) fn read(&mut self) -> io::Result<Option<M>> {
86-
if self.buffer_readable
87-
&& let Some(msg) = self.parse_from_buffer()
88-
{
89-
return Ok(Some(msg));
86+
if self.buffer_readable {
87+
if let Some(msg) = self.parse_from_buffer() {
88+
return Ok(Some(msg));
89+
}
9090
}
9191

9292
if self.stream_readable {
9393
self.read_from_stream()?;
9494
}
9595

96-
if self.buffer_readable
97-
&& let Some(msg) = self.parse_from_buffer()
98-
{
99-
return Ok(Some(msg));
96+
if self.buffer_readable {
97+
if let Some(msg) = self.parse_from_buffer() {
98+
return Ok(Some(msg));
99+
}
100100
}
101101

102102
Ok(None)

pre_commit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ bazelisk run //:format.fix
2323
bazelisk run //:format.check_Rust_with_rustfmt
2424
bazelisk run //:copyright.check
2525
bazelisk build --config=lint-rust //...
26-
bazelisk build //...
27-
bazelisk test //...
26+
bazelisk build --config=x86_64-linux //...
27+
bazelisk test --config=x86_64-linux //...

0 commit comments

Comments
 (0)