Skip to content

Commit 053393a

Browse files
committed
Switch to score-crates dependencies
Change-Id: Ife44f9a9b1455297a6c7702f8f849b61dd52d05e
1 parent 05702d0 commit 053393a

File tree

15 files changed

+206
-106
lines changed

15 files changed

+206
-106
lines changed

.bazelrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,16 @@ common --registry=https://bcr.bazel.build
2424
build:lint-rust --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
2525
build:lint-rust --output_groups=+clippy_checks
2626
build:lint-rust --@rules_rust//:clippy.toml=//:clippy.toml
27+
28+
common --@score-baselibs//score/mw/log/detail/flags:KUse_Stub_Implementation_Only=False
29+
common --@score-baselibs//score/mw/log/flags:KRemote_Logging=False
30+
common --@score-baselibs//score/json:base_library=nlohmann
31+
common --@communication//score/mw/com/flags:tracing_library=stub
32+
common --extra_toolchains=@gcc_toolchain//:host_gcc_12
33+
build --incompatible_strict_action_env
34+
test --test_tag_filters=-manual
35+
build --experimental_retain_test_configuration_across_testonly #https://github.com/bazelbuild/bazel/issues/6842
36+
37+
# unshare /dev/shm and /tmp
38+
test --sandbox_tmpfs_path=/dev/shm
39+
test --sandbox_tmpfs_path=/tmp

MODULE.bazel

Lines changed: 65 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,71 @@ module(
1515
version = "0.1",
1616
)
1717

18+
bazel_dep(name = "communication", version = "1.0.0")
19+
git_override(
20+
module_name = "communication",
21+
commit = "044b251136c87d4281dcdeaa5626d76546c1947f",
22+
remote = "https://github.com/eclipse-score/communication.git",
23+
)
24+
25+
bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost")
26+
archive_override(
27+
module_name = "rules_boost",
28+
strip_prefix = "rules_boost-master",
29+
urls = ["https://github.com/nelhage/rules_boost/archive/refs/heads/master.tar.gz"],
30+
)
31+
32+
bazel_dep(name = "boost.program_options", version = "1.87.0")
33+
bazel_dep(name = "trlc", version = "0.0.0")
34+
git_override(
35+
module_name = "trlc",
36+
commit = "650b51a47264a4f232b3341f473527710fc32669", # trlc-2.0.2 release
37+
remote = "https://github.com/bmw-software-engineering/trlc.git",
38+
)
39+
40+
bazel_dep(name = "score_toolchains_gcc", version = "0.4", dev_dependency = True)
41+
42+
gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency = True)
43+
gcc.toolchain(
44+
sha256 = "457f5f20f57528033cb840d708b507050d711ae93e009388847e113b11bf3600",
45+
strip_prefix = "x86_64-unknown-linux-gnu",
46+
url = "https://github.com/eclipse-score/toolchains_gcc_packages/releases/download/0.0.1/x86_64-unknown-linux-gnu_gcc12.tar.gz",
47+
)
48+
49+
# TODO to be moved to toolchain. https://github.com/eclipse-score/toolchains_gcc/issues/11
50+
gcc.extra_features(
51+
features = [
52+
"minimal_warnings",
53+
"treat_warnings_as_errors",
54+
],
55+
)
56+
gcc.warning_flags(
57+
minimal_warnings = [
58+
"-Wall",
59+
"-Wno-error=deprecated-declarations",
60+
],
61+
strict_warnings = [
62+
"-Wextra",
63+
"-Wpedantic",
64+
],
65+
treat_warnings_as_errors = ["-Werror"],
66+
)
67+
use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc")
68+
69+
bazel_dep(name = "score-baselibs", version = "0.0.0")
70+
git_override(
71+
module_name = "score-baselibs",
72+
commit = "f02d7f427df1968df8d5f9f9aa85bf68baeb839e",
73+
remote = "https://github.com/eclipse-score/baselibs.git",
74+
)
75+
76+
bazel_dep(name = "score_crates", version = "1.0.0")
77+
git_override(
78+
module_name = "score_crates",
79+
commit = "6031e8c018da76b108f0f9c3772b0c535125ac28",
80+
remote = "https://github.com/eclipse-score/score-crates.git",
81+
)
82+
1883
bazel_dep(name = "rules_python", version = "1.4.1")
1984

2085
PYTHON_VERSION = "3.12"
@@ -24,7 +89,6 @@ python.toolchain(
2489
is_default = True,
2590
python_version = PYTHON_VERSION,
2691
)
27-
use_repo(python)
2892

2993
# Add GoogleTest dependency
3094
bazel_dep(name = "googletest", version = "1.17.0")
@@ -54,26 +118,3 @@ rust.toolchain(
54118
versions = [RUST_VERSION],
55119
)
56120
use_repo(rust, "rust_toolchains")
57-
58-
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
59-
crate.from_cargo(
60-
name = "cargo",
61-
cargo_lockfile = "//:Cargo.lock",
62-
manifests = [
63-
"//:Cargo.toml",
64-
"//examples/rust/cycle-benchmark:Cargo.toml",
65-
"//examples/rust/mini-adas:Cargo.toml",
66-
"//feo:Cargo.toml",
67-
"//feo-com:Cargo.toml",
68-
"//feo-cpp-build:Cargo.toml",
69-
"//feo-cpp-macros:Cargo.toml",
70-
"//feo-log:Cargo.toml",
71-
"//feo-logger:Cargo.toml",
72-
"//feo-time:Cargo.toml",
73-
"//feo-tracer:Cargo.toml",
74-
"//feo-tracing:Cargo.toml",
75-
"//logd:Cargo.toml",
76-
"//perfetto-model:Cargo.toml",
77-
],
78-
)
79-
use_repo(crate, "cargo")

examples/rust/cycle-benchmark/BUILD.bazel

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313

14-
load("@cargo//:defs.bzl", "all_crate_deps")
1514
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library")
1615

1716
rust_library(
@@ -24,17 +23,23 @@ rust_library(
2423
],
2524
crate_name = "cycle_benchmark",
2625
visibility = ["//visibility:public"],
26+
rustc_flags = [
27+
"-Clink-arg=-lstdc++",
28+
"-Clink-arg=-lm",
29+
"-Clink-arg=-lc",
30+
],
2731
deps = [
2832
"//feo:libfeo_recording_rust",
2933
"//feo-com:libfeo_com_rust",
3034
"//feo-log:libfeo_log_rust",
3135
"//feo-logger:libfeo_logger_rust",
3236
"//feo-time:libfeo_time_rust",
3337
"//feo-tracing:libfeo_tracing_rust",
34-
"@cargo//:postcard",
35-
"@cargo//:serde",
36-
"@cargo//:serde_json",
37-
"@cargo//:tracing",
38+
"@score_crates//:postcard",
39+
"@score_crates//:serde",
40+
"@score_crates//:serde_json",
41+
"@score_crates//:tracing",
42+
"@score-baselibs//score/language/futurecpp",
3843
],
3944
)
4045

@@ -44,12 +49,18 @@ rust_binary(
4449
"src/bin/cycle_bench.rs",
4550
],
4651
visibility = ["//visibility:public"],
52+
rustc_flags = [
53+
"-Clink-arg=-lstdc++",
54+
"-Clink-arg=-lm",
55+
"-Clink-arg=-lc",
56+
],
4757
deps = [
4858
":libcycle_benchmark_rust",
4959
"//feo:libfeo_recording_rust",
5060
"//feo-log:libfeo_log_rust",
5161
"//feo-logger:libfeo_logger_rust",
5262
"//feo-time:libfeo_time_rust",
5363
"//feo-tracing:libfeo_tracing_rust",
64+
"@score-baselibs//score/language/futurecpp",
5465
],
5566
)

examples/rust/mini-adas/BUILD.bazel

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313

14-
load("@cargo//:defs.bzl", "all_crate_deps")
1514
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library")
1615

1716
rust_library(
@@ -25,7 +24,7 @@ rust_library(
2524
"src/lib.rs",
2625
],
2726
crate_features = [
28-
"com_iox2",
27+
"com_linux_shm",
2928
"signalling_relayed_tcp",
3029
],
3130
crate_name = "mini_adas",
@@ -42,7 +41,7 @@ rust_library(
4241
"//feo-logger:libfeo_logger_rust",
4342
"//feo-time:libfeo_time_rust",
4443
"//feo-tracing:libfeo_tracing_rust",
45-
"@cargo//:tracing",
44+
"@score_crates//:tracing",
4645
],
4746
)
4847

@@ -57,7 +56,7 @@ rust_library(
5756
"src/lib.rs",
5857
],
5958
crate_features = [
60-
"com_iox2",
59+
"com_linux_shm",
6160
"recording",
6261
"signalling_relayed_tcp",
6362
],
@@ -66,9 +65,7 @@ rust_library(
6665
"//feo-cpp-macros:feo_cpp_macros_rust",
6766
],
6867
visibility = ["//visibility:public"],
69-
deps = all_crate_deps(
70-
normal = True,
71-
) + [
68+
deps = [
7269
":cpp_activities",
7370
"//feo:libfeo_recording_rust",
7471
"//feo-com:libfeo_com_rust",
@@ -77,8 +74,9 @@ rust_library(
7774
"//feo-logger:libfeo_logger_rust",
7875
"//feo-time:libfeo_time_rust",
7976
"//feo-tracing:libfeo_tracing_rust",
80-
"@cargo//:postcard",
81-
"@cargo//:serde",
77+
"@score_crates//:postcard",
78+
"@score_crates//:serde",
79+
"@score_crates//:tracing",
8280
],
8381
)
8482

@@ -89,6 +87,11 @@ rust_binary(
8987
],
9088
crate_features = ["signalling_relayed_tcp"],
9189
visibility = ["//visibility:public"],
90+
rustc_flags = [
91+
"-Clink-arg=-lstdc++",
92+
"-Clink-arg=-lm",
93+
"-Clink-arg=-lc",
94+
],
9295
deps = [
9396
":libmini_adas_rust",
9497
"//feo:libfeo_rust",
@@ -106,6 +109,11 @@ rust_binary(
106109
],
107110
crate_features = ["signalling_relayed_tcp"],
108111
visibility = ["//visibility:public"],
112+
rustc_flags = [
113+
"-Clink-arg=-lstdc++",
114+
"-Clink-arg=-lm",
115+
"-Clink-arg=-lc",
116+
],
109117
deps = [
110118
":libmini_adas_rust",
111119
"//feo:libfeo_rust",
@@ -149,8 +157,8 @@ rust_binary(
149157
"//feo-log:libfeo_log_rust",
150158
"//feo-logger:libfeo_logger_rust",
151159
"//feo-tracing:libfeo_tracing_rust",
152-
"@cargo//:postcard",
153-
"@cargo//:serde",
160+
"@score_crates//:postcard",
161+
"@score_crates//:serde",
154162
],
155163
)
156164

feo-com/BUILD.bazel

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,34 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313

14-
load("@cargo//:defs.bzl", "all_crate_deps")
1514
load("@rules_rust//rust:defs.bzl", "rust_library")
1615

1716
rust_library(
1817
name = "libfeo_com_rust",
1918
srcs = [
2019
"src/interface.rs",
21-
"src/iox2/mod.rs",
20+
# Disabled due to compilation error of iceoryx2
21+
# "src/iox2/mod.rs",
2222
"src/lib.rs",
2323
"src/linux_shm/mod.rs",
2424
"src/linux_shm/shared_memory.rs",
2525
],
2626
crate_features = [
2727
# bazel has a different concept (select) for optional dependencies than cargo,
2828
# so we activate all features until we refactor to select
29-
"ipc_iceoryx2",
29+
# Disabled due to compilation error of iceoryx2
30+
# "ipc_iceoryx2",
3031
"ipc_linux_shm",
3132
],
3233
crate_name = "feo_com",
3334
visibility = ["//visibility:public"],
34-
deps = all_crate_deps(
35-
normal = True,
36-
) + [
35+
deps = [
3736
"//feo-log:libfeo_log_rust",
3837
# all_crate_deps only contains optional dependencies which are default-activated,
3938
# so we add all optional dependencies here to be independent of cargo default features
40-
"@cargo//:iceoryx2",
41-
"@cargo//:nix",
42-
"@cargo//:rand",
39+
# Disabled due to compilation error of iceoryx2
40+
# "@score_crates//:iceoryx2",
41+
"@score_crates//:nix",
42+
"@score_crates//:rand",
4343
],
4444
)

feo-cpp-build/BUILD.bazel

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313

14-
load("@cargo//:defs.bzl", "all_crate_deps")
1514
load("@rules_rust//rust:defs.bzl", "rust_library")
1615

1716
cc_library(
@@ -28,12 +27,9 @@ rust_library(
2827
],
2928
crate_features = [],
3029
crate_name = "feo_cpp_build",
31-
proc_macro_deps = all_crate_deps(
32-
proc_macro_dev = True,
33-
),
30+
proc_macro_deps = [],
3431
visibility = ["//visibility:public"],
35-
deps = all_crate_deps(
36-
normal = True,
37-
) + [
32+
deps = [
33+
"@score_crates//:cc",
3834
],
3935
)

feo-cpp-macros/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313

14-
load("@cargo//:defs.bzl", "all_crate_deps")
1514
load("@rules_rust//rust:defs.bzl", "rust_proc_macro")
1615

1716
rust_proc_macro(

feo-log/BUILD.bazel

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
1313

14-
load("@cargo//:defs.bzl", "aliases", "all_crate_deps")
14+
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
1515
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_static_library")
1616

1717
rust_library(
@@ -21,9 +21,9 @@ rust_library(
2121
],
2222
crate_name = "feo_log",
2323
visibility = ["//visibility:public"],
24-
deps = all_crate_deps(
25-
normal = True,
26-
),
24+
deps = [
25+
"@score_crates//:log",
26+
],
2727
)
2828

2929
# FFI wrapper
@@ -32,9 +32,9 @@ rust_static_library(
3232
srcs = [
3333
"src/ffi.rs",
3434
],
35-
deps = all_crate_deps(
36-
normal = True,
37-
),
35+
deps = [
36+
"@score_crates//:log",
37+
],
3838
)
3939

4040
cc_library(

0 commit comments

Comments
 (0)