From 7dbaeb0da121b9e17c230e9d5523ee006e4945a8 Mon Sep 17 00:00:00 2001 From: Dominik Fischer Date: Wed, 17 Jun 2026 10:39:01 +0200 Subject: [PATCH] Migration of bsw libs docan, doip, logger_integration Lib targets: - //libs/bsw/docan:docan - //libs/bsw/doip:doip - //libs/bsw/loggerIntegration:logger_integration - //libs/bsw/storage:storage - //libs/bsw/transport:transport - //platforms/posix/etlImpl:etl_impl - //platforms/s32k1xx/etlImpl:etl_impl Config targets: - //libs/bsw/loggerIntegration:etl_impl (label_flag injection) - //libs/bsw/loggerIntegration:etl_impl_default (closed select) - //libs/bsw/storage:storage_rtos_impl (closed select) Change-Id: I2f273cf5e077793fbe3ba0b405987aed704a831f --- bazel_migration/README.md | 4 ++ libs/bsw/docan/BUILD.bazel | 32 ++++++++++++++++ libs/bsw/doip/BUILD.bazel | 28 ++++++++++++++ libs/bsw/loggerIntegration/BUILD.bazel | 52 ++++++++++++++++++++++++++ libs/bsw/storage/BUILD.bazel | 50 +++++++++++++++++++++++++ platforms/posix/etlImpl/BUILD.bazel | 26 +++++++++++++ platforms/s32k1xx/etlImpl/BUILD.bazel | 26 +++++++++++++ 7 files changed, 218 insertions(+) create mode 100644 libs/bsw/docan/BUILD.bazel create mode 100644 libs/bsw/doip/BUILD.bazel create mode 100644 libs/bsw/loggerIntegration/BUILD.bazel create mode 100644 libs/bsw/storage/BUILD.bazel create mode 100644 platforms/posix/etlImpl/BUILD.bazel create mode 100644 platforms/s32k1xx/etlImpl/BUILD.bazel diff --git a/bazel_migration/README.md b/bazel_migration/README.md index 256c34fc54c..061c845209b 100644 --- a/bazel_migration/README.md +++ b/bazel_migration/README.md @@ -65,6 +65,8 @@ OpenBSW Bazel migration │ │ ├── asyncImpl ✅ │ │ ├── cpp2can ✅ │ │ ├── cpp2ethernet ✅ +│ │ ├── docan ✅ +│ │ ├── doip ✅ │ │ ├── io ✅ │ │ ├── lifecycle ✅ │ │ ├── logger ✅ @@ -76,7 +78,9 @@ OpenBSW Bazel migration │ │ ├── platform ✅ │ │ ├── runtime ✅ │ │ ├── stdioConsoleInput ✅ +│ │ ├── storage ✅ │ │ ├── timer ✅ +│ │ ├── transport ✅ │ │ ├── util ✅ │ └── (remaining) 🔲 ├── platforms/ diff --git a/libs/bsw/docan/BUILD.bazel b/libs/bsw/docan/BUILD.bazel new file mode 100644 index 00000000000..05ae14fb2c9 --- /dev/null +++ b/libs/bsw/docan/BUILD.bazel @@ -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", + ], +) diff --git a/libs/bsw/doip/BUILD.bazel b/libs/bsw/doip/BUILD.bazel new file mode 100644 index 00000000000..2d9153712d1 --- /dev/null +++ b/libs/bsw/doip/BUILD.bazel @@ -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", + ], +) diff --git a/libs/bsw/loggerIntegration/BUILD.bazel b/libs/bsw/loggerIntegration/BUILD.bazel new file mode 100644 index 00000000000..84a2fe2dca6 --- /dev/null +++ b/libs/bsw/loggerIntegration/BUILD.bazel @@ -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( + 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"], +) diff --git a/libs/bsw/storage/BUILD.bazel b/libs/bsw/storage/BUILD.bazel new file mode 100644 index 00000000000..df2a6282351 --- /dev/null +++ b/libs/bsw/storage/BUILD.bazel @@ -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", + ], +) diff --git a/platforms/posix/etlImpl/BUILD.bazel b/platforms/posix/etlImpl/BUILD.bazel new file mode 100644 index 00000000000..e849d14b915 --- /dev/null +++ b/platforms/posix/etlImpl/BUILD.bazel @@ -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"], +) diff --git a/platforms/s32k1xx/etlImpl/BUILD.bazel b/platforms/s32k1xx/etlImpl/BUILD.bazel new file mode 100644 index 00000000000..000002a0864 --- /dev/null +++ b/platforms/s32k1xx/etlImpl/BUILD.bazel @@ -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"], +)