diff --git a/.bazelrc b/.bazelrc index ef11493..2fd5ced 100644 --- a/.bazelrc +++ b/.bazelrc @@ -15,11 +15,21 @@ build --java_language_version=17 build --tool_java_language_version=17 build --java_runtime_version=remotejdk_17 build --tool_java_runtime_version=remotejdk_17 +common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ +common --registry=https://bcr.bazel.build +test --test_tag_filters=-manual +test --test_output=errors +build --incompatible_strict_action_env +build --experimental_retain_test_configuration_across_testonly #https://github.com/bazelbuild/bazel/issues/6842 + +# Ferrocene must be common compiler for HOST. To ensure metadata compatibility for proc macro crates! +build:_common --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu + +# Common flags for all builds common --@score_baselibs//score/memory/shared/flags:use_typedshmd=False common --@score_baselibs//score/mw/log/flags:KRemote_Logging=False common --@score_baselibs//score/json:base_library=nlohmann - common --//score/datarouter/build_configuration_flags:persistent_logging=False common --//score/datarouter/build_configuration_flags:persistent_config_feature_enabled=False common --//score/datarouter/build_configuration_flags:enable_nonverbose_dlt=False @@ -27,43 +37,43 @@ common --//score/datarouter/build_configuration_flags:enable_dynamic_configurati common --//score/datarouter/build_configuration_flags:file_transfer=False common --//score/datarouter/build_configuration_flags:use_local_vlan=True -build --incompatible_strict_action_env -test --test_tag_filters=-manual -test --test_output=errors -build --experimental_retain_test_configuration_across_testonly #https://github.com/bazelbuild/bazel/issues/6842 - -common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ -common --registry=https://bcr.bazel.build - # Base QNX config (shared flags) -common:qnx --host_platform=@score_bazel_platforms//:x86_64-linux common:qnx --credential_helper=*.qnx.com=%workspace%/scripts/internal/qnx_creds.py +common:qnx --credential_helper_timeout="60s" common:qnx --sandbox_writable_path=/var/tmp -build:build_qnx8 --platforms=@score_bazel_platforms//:arm64-qnx8_0 -build:build_qnx8 --extra_toolchains=@toolchains_qnx_qcc//:qcc_aarch64 -build:build_qnx8 --extra_toolchains=@toolchains_qnx_ifs//:ifs_aarch64 -build:build_qnx8 --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_aarch64_unknown_nto_qnx800 +# ------------------------------------------------------------------------------- +# Config dedicated to target platform CPU:arm64 and OS:QNX +# ------------------------------------------------------------------------------- +build:arm64-qnx --config=qnx +build:arm64-qnx --config=_common +build:arm64-qnx --platforms=@score_bazel_platforms//:aarch64-qnx-sdp_8.0.0-posix +build:arm64-qnx --extra_toolchains=@score_qcc_aarch64_toolchain//:aarch64-qnx-sdp_8.0.0-posix +build:arm64-qnx --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_aarch64_unknown_nto_qnx800 + +# ------------------------------------------------------------------------------- +# Config dedicated to target platform CPU:x86_64 and OS:QNX +# ------------------------------------------------------------------------------- +build:x86_64-qnx --config=qnx +build:x86_64-qnx --config=_common +build:x86_64-qnx --platforms=@score_bazel_platforms//:x86_64-qnx-sdp_8.0.0-posix +build:x86_64-qnx --extra_toolchains=@score_qcc_x86_64_toolchain//:x86_64-qnx-sdp_8.0.0-posix +build:x86_64-qnx --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_pc_nto_qnx800 -common:qnx_x86_64 --config=qnx -common:qnx_x86_64 --platforms=@score_bazel_platforms//:x86_64-qnx8_0 -common:qnx_x86_64 --extra_toolchains=@toolchains_qnx_ifs//:ifs_x86_64 -common:qnx_x86_64 --extra_toolchains=@toolchains_qnx_qcc//:qcc_x86_64 -common:qnx_x86_64 --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_pc_nto_qnx800 +# TODO arm64 when rust support is there -common:qnx_arm64 --config=qnx -common:qnx_arm64 --platforms=@score_bazel_platforms//:arm64-qnx8_0 -common:qnx_arm64 --extra_toolchains=@toolchains_qnx_ifs//:ifs_aarch64 -common:qnx_arm64 --extra_toolchains=@toolchains_qnx_qcc//:qcc_aarch64 -common:qnx_arm64 --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_aarch64_unknown_nto_qnx800 +# ------------------------------------------------------------------------------- +# Config dedicated to host platform CPU:x86_64 and OS:Linux +# ------------------------------------------------------------------------------- +build:x86_64-linux --config=_common +build:x86_64-linux --platforms=@score_bazel_platforms//:x86_64-linux-gcc_12.2.0-posix +build:x86_64-linux --extra_toolchains=@score_gcc_x86_64_toolchain//:x86_64-linux-gcc_12.2.0-posix +build:x86_64-linux --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu -common:x86_64-qnx --config=qnx_x86_64 -common:arm64-qnx --config=qnx_arm64 -common --extra_toolchains=@gcc_toolchain//:host_gcc_12 -common --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu # With this instrumentation filter for our two main components, we ensure that `bazel coverage //...` is yielding the correct results +coverage --config=x86_64-linux coverage --instrumentation_filter="^//score/datarouter[/:],^//score/mw/log[/:],-//score/mw/.*/test[/:]" coverage --experimental_generate_llvm_lcov coverage --experimental_use_llvm_covmap diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7070a22..84f3ad6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,4 +62,4 @@ jobs: - name: Build with Bazel run: | - bazel build //... + bazel build --config x86_64-linux //... diff --git a/.github/workflows/build_qnx8.yml b/.github/workflows/build_qnx8.yml index 23a024b..4511bbc 100644 --- a/.github/workflows/build_qnx8.yml +++ b/.github/workflows/build_qnx8.yml @@ -11,38 +11,26 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -name: QNX8 Build and Test - +name: QNX8 Build on: pull_request_target: types: [opened, reopened, synchronize] - + merge_group: + types: [checks_requested] jobs: - qnx-build-x86_64: - uses: eclipse-score/cicd-workflows/.github/workflows/qnx-build.yml@main - permissions: - contents: read - pull-requests: read - with: - bazel-target: "//score/... //tests/..." - bazel-config: "x86_64-qnx" - credential-helper: "scripts/internal/qnx_creds.py" - environment-name: "workflow-approval" - secrets: - score-qnx-license: ${{ secrets.SCORE_QNX_LICENSE }} - score-qnx-user: ${{ secrets.SCORE_QNX_USER }} - score-qnx-password: ${{ secrets.SCORE_QNX_PASSWORD }} - - qnx-build-arm64: + qnx-build: uses: eclipse-score/cicd-workflows/.github/workflows/qnx-build.yml@main permissions: contents: read pull-requests: read + strategy: + matrix: + config: ['arm64-qnx', 'x86_64-qnx'] with: - bazel-target: "//score/... //tests/..." - bazel-config: "arm64-qnx" - credential-helper: "scripts/internal/qnx_creds.py" - environment-name: "workflow-approval" + bazel-target: '//score/... //tests/...' + bazel-config: ${{ matrix.config }} + credential-helper: 'scripts/internal/qnx_creds.py' + environment-name: 'workflow-approval' secrets: score-qnx-license: ${{ secrets.SCORE_QNX_LICENSE }} score-qnx-user: ${{ secrets.SCORE_QNX_USER }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4128c57..c17fb8c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,4 +39,4 @@ jobs: - name: Run Tests via Bazel run: | echo "Running: bazel test //score/..." - bazel test //score/... + bazel test --config x86_64-linux //score/... diff --git a/BUILD b/BUILD index c214ee9..b0b68a6 100644 --- a/BUILD +++ b/BUILD @@ -24,7 +24,7 @@ copyright_checker( ".github", "docs", "examples", - "score", + # "score", # Disabled until antonkri is back from vacations as we cannot get approval on some repo parts "tests", "//:.bazelrc", "//:BUILD", diff --git a/MODULE.bazel b/MODULE.bazel index d951860..eb6e7a4 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -12,7 +12,7 @@ # ******************************************************************************* module( name = "score_logging", - version = "0.0.3", + version = "0.0.0", compatibility_level = 0, ) @@ -26,38 +26,21 @@ bazel_dep(name = "buildifier_prebuilt", version = "7.3.1") bazel_dep(name = "platforms", version = "1.0.0") # S-CORE process rules -bazel_dep(name = "score_bazel_platforms", version = "0.0.3") +bazel_dep(name = "score_bazel_platforms", version = "0.0.4") bazel_dep(name = "score_docs_as_code", version = "2.2.0") -bazel_dep(name = "score_tooling", version = "1.0.4") +bazel_dep(name = "score_tooling", version = "1.1.0") bazel_dep(name = "score_rust_policies", version = "0.0.3") bazel_dep(name = "score_process", version = "1.4.0", dev_dependency = True) bazel_dep(name = "score_platform", version = "0.5.1", dev_dependency = True) # Toolchains and extensions -bazel_dep(name = "score_toolchains_gcc", version = "0.5", dev_dependency = True) -bazel_dep(name = "score_toolchains_qnx", version = "0.0.6", dev_dependency = True) +bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.2.2", dev_dependency = True) bazel_dep(name = "score_toolchains_rust", version = "0.4.0", dev_dependency = True) # S-CORE crates bazel_dep(name = "score_crates", version = "0.0.6") -# Overrides -git_override( - module_name = "score_tooling", - commit = "612d6f180a9bb6338de5f0e6667fcf83068d9c37", #until 1.0.5 is released - remote = "https://github.com/eclipse-score/tooling.git", -) - -# Extensions - -gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency = True) -gcc.toolchain( - sha256 = "457f5f20f57528033cb840d708b507050d711ae93e009388847e113b11bf3600", - strip_prefix = "x86_64-unknown-linux-gnu", - url = "https://github.com/eclipse-score/toolchains_gcc_packages/releases/download/0.0.1/x86_64-unknown-linux-gnu_gcc12.tar.gz", -) - # TRLC dependency for requirements traceability bazel_dep(name = "trlc", version = "0.0.0", dev_dependency = True) git_override( @@ -66,13 +49,35 @@ git_override( remote = "https://github.com/bmw-software-engineering/trlc.git", ) -use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc") - -toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx", dev_dependency = True) -toolchains_qnx.sdp( - sha256 = "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63", - strip_prefix = "installation", - url = "https://www.qnx.com/download/download/79858/installation.tgz", +gcc = use_extension("@score_bazel_cpp_toolchains//extensions:gcc.bzl", "gcc", dev_dependency = True) +gcc.toolchain( + name = "score_qcc_aarch64_toolchain", + sdp_version = "8.0.0", + target_cpu = "aarch64", + target_os = "qnx", + use_default_package = True, + version = "12.2.0", +) +gcc.toolchain( + name = "score_gcc_x86_64_toolchain", + target_cpu = "x86_64", + target_os = "linux", + use_default_package = True, + version = "12.2.0", +) +gcc.toolchain( + name = "score_qcc_x86_64_toolchain", + sdp_version = "8.0.0", + target_cpu = "x86_64", + target_os = "qnx", + use_default_package = True, + version = "12.2.0", +) +use_repo( + gcc, + "score_gcc_x86_64_toolchain", + "score_qcc_aarch64_toolchain", + "score_qcc_x86_64_toolchain", ) PYTHON_VERSION = "3.12" @@ -84,10 +89,6 @@ python.toolchain( ) use_repo(python) -use_repo(toolchains_qnx, "toolchains_qnx_sdp") -use_repo(toolchains_qnx, "toolchains_qnx_qcc") -use_repo(toolchains_qnx, "toolchains_qnx_ifs") - # C++ dependencies bazel_dep(name = "googletest", version = "1.17.0.bcr.1") @@ -108,4 +109,4 @@ git_override( # Rust dependencies -bazel_dep(name = "score_baselibs_rust", version = "0.0.3") +bazel_dep(name = "score_baselibs_rust", version = "0.0.5") diff --git a/score/mw/log/rust/score_log_bridge/examples/main.rs b/score/mw/log/rust/score_log_bridge/examples/main.rs index bd96a25..765dc18 100644 --- a/score/mw/log/rust/score_log_bridge/examples/main.rs +++ b/score/mw/log/rust/score_log_bridge/examples/main.rs @@ -1,5 +1,5 @@ -// -// Copyright (c) 2025 Contributors to the Eclipse Foundation +// ******************************************************************************* +// Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional // information regarding copyright ownership. @@ -9,8 +9,7 @@ // // // SPDX-License-Identifier: Apache-2.0 -// - +// ******************************************************************************* use score_log::{debug, error, fatal, info, trace, warn, Log}; use score_log_bridge::ScoreLogBridgeBuilder; use std::path::PathBuf; diff --git a/score/mw/log/rust/score_log_bridge/src/ffi.rs b/score/mw/log/rust/score_log_bridge/src/ffi.rs index 6bef1da..3d712ec 100644 --- a/score/mw/log/rust/score_log_bridge/src/ffi.rs +++ b/score/mw/log/rust/score_log_bridge/src/ffi.rs @@ -1,5 +1,5 @@ -// -// Copyright (c) 2025 Contributors to the Eclipse Foundation +// ******************************************************************************* +// Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional // information regarding copyright ownership. @@ -9,8 +9,7 @@ // // // SPDX-License-Identifier: Apache-2.0 -// - +// ******************************************************************************* use core::alloc::Layout; use core::cmp::min; use core::ffi::c_char; diff --git a/score/mw/log/rust/score_log_bridge/src/lib.rs b/score/mw/log/rust/score_log_bridge/src/lib.rs index 553a421..4f818d2 100644 --- a/score/mw/log/rust/score_log_bridge/src/lib.rs +++ b/score/mw/log/rust/score_log_bridge/src/lib.rs @@ -1,5 +1,5 @@ -// -// Copyright (c) 2025 Contributors to the Eclipse Foundation +// ******************************************************************************* +// Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional // information regarding copyright ownership. @@ -9,7 +9,7 @@ // // // SPDX-License-Identifier: Apache-2.0 -// +// ******************************************************************************* //! C++-based backend for `score_log`. diff --git a/score/mw/log/rust/score_log_bridge/src/score_log_bridge.rs b/score/mw/log/rust/score_log_bridge/src/score_log_bridge.rs index 4ee0a41..ab62c99 100644 --- a/score/mw/log/rust/score_log_bridge/src/score_log_bridge.rs +++ b/score/mw/log/rust/score_log_bridge/src/score_log_bridge.rs @@ -1,5 +1,5 @@ -// -// Copyright (c) 2025 Contributors to the Eclipse Foundation +// ******************************************************************************* +// Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional // information regarding copyright ownership. @@ -9,7 +9,7 @@ // // // SPDX-License-Identifier: Apache-2.0 -// +// ******************************************************************************* //! C++-based logger implementation diff --git a/score/mw/log/rust/score_log_bridge_cpp_init/examples/example_lib.rs b/score/mw/log/rust/score_log_bridge_cpp_init/examples/example_lib.rs index eb7be30..afa9682 100644 --- a/score/mw/log/rust/score_log_bridge_cpp_init/examples/example_lib.rs +++ b/score/mw/log/rust/score_log_bridge_cpp_init/examples/example_lib.rs @@ -1,5 +1,5 @@ -// -// Copyright (c) 2025 Contributors to the Eclipse Foundation +// ******************************************************************************* +// Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional // information regarding copyright ownership. @@ -9,7 +9,7 @@ // // // SPDX-License-Identifier: Apache-2.0 -// +// ******************************************************************************* //! Module contains functions printing example logs. //! Based on `//score/mw/log/rust/score_log_bridge:example`. diff --git a/score/mw/log/rust/score_log_bridge_cpp_init/ffi.rs b/score/mw/log/rust/score_log_bridge_cpp_init/ffi.rs index eb13677..822698a 100644 --- a/score/mw/log/rust/score_log_bridge_cpp_init/ffi.rs +++ b/score/mw/log/rust/score_log_bridge_cpp_init/ffi.rs @@ -1,5 +1,5 @@ -// -// Copyright (c) 2025 Contributors to the Eclipse Foundation +// ******************************************************************************* +// Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional // information regarding copyright ownership. @@ -9,8 +9,7 @@ // // // SPDX-License-Identifier: Apache-2.0 -// - +// ******************************************************************************* use core::ffi::c_char; use core::slice::from_raw_parts; use score_log_bridge::ScoreLogBridgeBuilder; diff --git a/tests/rust/test_main.rs b/tests/rust/test_main.rs index 9390d5e..7194058 100644 --- a/tests/rust/test_main.rs +++ b/tests/rust/test_main.rs @@ -1,3 +1,15 @@ +// ******************************************************************************* +// Copyright (c) 2026 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available under the +// terms of the Apache License Version 2.0 which is available at +// +// +// SPDX-License-Identifier: Apache-2.0 +// ******************************************************************************* #[test] fn test_hello() { assert_eq!(2 + 2, 4);