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: 4 additions & 0 deletions bazel_migration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ OpenBSW Bazel migration
│ │ ├── asyncImpl ✅
│ │ ├── cpp2can ✅
│ │ ├── cpp2ethernet ✅
│ │ ├── docan ✅
│ │ ├── doip ✅
│ │ ├── io ✅
│ │ ├── lifecycle ✅
│ │ ├── logger ✅
Expand All @@ -76,7 +78,9 @@ OpenBSW Bazel migration
│ │ ├── platform ✅
│ │ ├── runtime ✅
│ │ ├── stdioConsoleInput ✅
│ │ ├── storage ✅
│ │ ├── timer ✅
│ │ ├── transport ✅
│ │ ├── util ✅
│ └── (remaining) 🔲
├── platforms/
Expand Down
32 changes: 32 additions & 0 deletions libs/bsw/docan/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# *******************************************************************************
# Copyright (c) 2026 Accenture
#
# 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("@rules_cc//cc:cc_library.bzl", "cc_library")

cc_library(
name = "docan",
srcs = [
"src/docan/common/DoCanLogger.cpp",
"src/docan/datalink/DoCanFrameCodecConfigPresets.cpp",
],
hdrs = glob(["include/**/*.h"]),
strip_include_prefix = "include",
visibility = ["//visibility:public"],
deps = [
"//libs/3rdparty/etl",
"//libs/bsp/bspInterrupts:bsp_interrupts",
"//libs/bsw/async",
"//libs/bsw/common",
"//libs/bsw/cpp2can",
"//libs/bsw/platform",
"//libs/bsw/transport",
"//libs/bsw/util",
],
)
28 changes: 28 additions & 0 deletions libs/bsw/doip/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# *******************************************************************************
# Copyright (c) 2026 Accenture
#
# 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("@rules_cc//cc:cc_library.bzl", "cc_library")

cc_library(
name = "doip",
srcs = glob(["src/**/*.cpp"]),
hdrs = glob(["include/**/*.h"]),
strip_include_prefix = "include",
visibility = ["//visibility:public"],
deps = [
"//libs/3rdparty/etl",
"//libs/bsw/async",
"//libs/bsw/common",
"//libs/bsw/cpp2ethernet",
"//libs/bsw/platform",
"//libs/bsw/transport",
"//libs/bsw/util",
],
)
52 changes: 52 additions & 0 deletions libs/bsw/loggerIntegration/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# *******************************************************************************
# Copyright (c) 2026 Accenture
#
# 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("@rules_cc//cc:cc_library.bzl", "cc_library")

alias(
name = "etl_impl_default",
actual = select(
{
"//bazel/platform/constraints/soc:s32k148": "//platforms/s32k1xx/etlImpl:etl_impl",
"@platforms//os:linux": "//platforms/posix/etlImpl:etl_impl",
},
no_match_error = "No default etl_impl for this platform. Override --//libs/bsw/loggerIntegration:etl_impl with your own ETL implementation target.",
),
)

# Default: select based on the target platform via etl_impl_default (S32K148, POSIX)
# Override: --//libs/bsw/loggerIntegration:etl_impl=//path/to:your_impl
label_flag(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder how this scales? Many libraries will use etl, I think it does not make sense that each library specifies it's own label flag? Shouldn't we have a more generic one at a higher level every library can then depend on?

The etl_profile comes in already via the dependency of //libs/3rdparty/etl to the label flag //libs/3rdparty/etl:etl_profile.

In total we have three things to consider, the etl implemenation itself, the etl_profile.h and the integration specific implementations like print.cpp.

In our project it is currently handled in a way the both etl_profile.h and the implementations are handled via a single cc_library (without dependencies, so no cycle) configured as a label flag called etl_profile. Then there is a central etl library which takes the etl sources and has the etl_profile label flag as a dependency. All users of etl can then simply refer to this library, the fact that it requires a label flag is hiddne.

@DominikAFischer DominikAFischer Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's definitely a valid concern and would make things easier as far as I can see.

It also would be a departure from the current CMake implementation and might even need changes to source code if I'm correct. So, I would suggest that we add this to the list of design discussions and handle it separately?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine for me, we can do it like this, but we should keep track of this to refactor :)

name = "etl_impl",
build_setting_default = ":etl_impl_default",
visibility = ["//visibility:public"],
)

cc_library(
name = "logger_integration",
srcs = [
"src/logger/LoggerComposition.cpp",
"src/logger/LoggerTime.cpp",
],
hdrs = [
"include/logger/Config.h",
"include/logger/ConsoleEntryFormatter.h",
"include/logger/LoggerComposition.h",
"include/logger/LoggerTime.h",
],
implementation_deps = [
":etl_impl",
"//libs/3rdparty/etl",
"//libs/bsp/bspInterrupts:bsp_interrupts",
"//libs/bsw/logger",
],
strip_include_prefix = "include",
visibility = ["//visibility:public"],
)
50 changes: 50 additions & 0 deletions libs/bsw/storage/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# *******************************************************************************
# Copyright (c) 2026 Accenture
#
# 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("@rules_cc//cc:cc_library.bzl", "cc_library")

# TODO: Add asyncThreadXImpl branch once ThreadX has been migrated.
alias(
name = "storage_rtos_impl",
actual = select(
{
"//bazel/config/rtos:support_freertos": "//libs/bsw/asyncFreeRtos:async_freertos_impl",
},
no_match_error = "storage: asyncFreeRtosImpl only migrated for FreeRTOS; build with --//bazel/config/rtos=freertos (ThreadX deferred).",
),
)

cc_library(
name = "storage",
srcs = [
"src/storage/EepStorage.cpp",
"src/storage/MappingStorage.cpp",
"src/storage/QueuingStorage.cpp",
"src/storage/StorageTester.cpp",
],
hdrs = [
"include/storage/EepStorage.h",
"include/storage/FeeStorage.h",
"include/storage/IStorage.h",
"include/storage/MappingStorage.h",
"include/storage/QueuingStorage.h",
"include/storage/StorageJob.h",
"include/storage/StorageTester.h",
],
strip_include_prefix = "include",
visibility = ["//visibility:public"],
deps = [
":storage_rtos_impl",
"//libs/3rdparty/etl",
"//libs/bsw/async",
"//libs/bsw/bsp",
"//libs/bsw/util",
],
)
26 changes: 26 additions & 0 deletions platforms/posix/etlImpl/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# *******************************************************************************
# Copyright (c) 2026 Accenture
#
# 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("@rules_cc//cc:cc_library.bzl", "cc_library")

cc_library(
name = "etl_impl",
srcs = [
"src/clocks.cpp",
"src/print.cpp",
],
implementation_deps = [
"//libs/3rdparty/etl",
"//libs/bsw/bsp",
"//libs/bsw/util",
],
target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
)
26 changes: 26 additions & 0 deletions platforms/s32k1xx/etlImpl/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# *******************************************************************************
# Copyright (c) 2026 Accenture
#
# 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("@rules_cc//cc:cc_library.bzl", "cc_library")

cc_library(
name = "etl_impl",
srcs = [
"src/clocks.cpp",
"src/print.cpp",
],
implementation_deps = [
"//libs/3rdparty/etl",
"//libs/bsw/bsp",
"//libs/bsw/util",
],
target_compatible_with = ["//bazel/platform/constraints/soc:s32k148"],
visibility = ["//visibility:public"],
)
Loading