diff --git a/.bazelrc b/.bazelrc index e7df623..7796054 100644 --- a/.bazelrc +++ b/.bazelrc @@ -17,9 +17,9 @@ build --java_runtime_version=remotejdk_17 build --tool_java_runtime_version=remotejdk_17 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,14 +27,23 @@ common --//score/datarouter/build_configuration_flags:enable_dynamic_configurati common --//score/datarouter/build_configuration_flags:dlt_file_transfer_feature=False common --//score/datarouter/build_configuration_flags:use_local_vlan=True -common --extra_toolchains=@gcc_toolchain//:host_gcc_12 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/refs/heads/main/ +common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ common --registry=https://bcr.bazel.build +common --credential_helper=*.qnx.com=%workspace%/scripts/internal/qnx_creds.py + +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=@score_toolchains_rust//toolchains/aarch64-unknown-qnx8_0:toolchain_aarch64_qnx8_0 +build:build_qnx8 --extra_toolchains=@toolchains_qnx_ifs//:ifs_x86_64 +build:build_qnx8 --extra_toolchains=@toolchains_qnx_ifs//:ifs_aarch64 + +common --extra_toolchains=@gcc_toolchain//:host_gcc_12 +common --extra_toolchains=@score_toolchains_rust//toolchains/x86_64-unknown-linux-gnu:toolchain_x86_64_linux # With this instrumentation filter for our two main components, we ensure that `bazel coverage //...` is yielding the correct results coverage --instrumentation_filter="^//score/datarouter[/:],^//score/mw/log[/:],-//score/mw/.*/test[/:]" diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..bc9c72f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,24 @@ +--- +name: Bug report +about: Create a report for a bug +title: 'Bug: Your bug title' +labels: 'bug' +assignees: '' + +--- + +### Describe the bug: + + +### Steps to reproduce the behavior: +1. +2. + +### Observed behavior: + +### Expected behavior + +### Occurrence: + + +### Attachments / Logs: diff --git a/.github/actions/gitlint/action.yml b/.github/actions/gitlint/action.yml index cb16e6f..da48456 100644 --- a/.github/actions/gitlint/action.yml +++ b/.github/actions/gitlint/action.yml @@ -1,5 +1,5 @@ # ******************************************************************************* -# Copyright (c) 2024 Contributors to the Eclipse Foundation +# Copyright (c) 2025 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..893cba0 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,33 @@ + + + +## Notes for Reviewer + + +## Pre-Review Checklist for the PR Author + +* [ ] PR title is short, expressive and meaningful +* [ ] Commits are properly organized +* [ ] Relevant issues are linked in the [References](#references) section +* [ ] Tests are conducted +* [ ] Unit tests are added + +## Checklist for the PR Reviewer + +* [ ] Commits are properly organized and messages are according to the guideline +* [ ] Unit tests have been written for new behavior +* [ ] Public API is documented +* [ ] PR title describes the changes + +## Post-review Checklist for the PR Author + +* [ ] All open points are addressed and tracked via issues + +## References + + + +Closes # + + + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7070a22 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,65 @@ +# ******************************************************************************* +# Copyright (c) 2025 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 +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +name: Bazel Build + +on: + pull_request: + types: [opened, reopened, synchronize] + merge_group: + types: [checks_requested] + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SCORE_QNX_USER: ${{ secrets.SCORE_QNX_USER }} + SCORE_QNX_PASSWORD: ${{ secrets.SCORE_QNX_PASSWORD }} + SCORE_QNX_LICENSE: ${{ secrets.SCORE_QNX_LICENSE }} +jobs: + build: + name: Build Bazel Code + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4.2.2 + + - name: Setup Bazel + uses: bazel-contrib/setup-bazel@0.15.0 + with: + bazelisk-version: 1.26.0 # newest LTS before 1 Jun 2025 + disk-cache: true + repository-cache: true + bazelisk-cache: true + + - name: Bazel info (discover paths) + id: bazel-info + run: | + echo "BAZEL_OUTPUT_BASE=$(bazel info output_base)" >> $GITHUB_ENV + echo "BAZEL_USER_ROOT=$(bazel info output_user_root)" >> $GITHUB_ENV + echo "BAZEL_REPO_CACHE=$(bazel info repository_cache)" >> $GITHUB_ENV + bazel info + + - name: Cache Bazel output base + uses: actions/cache@v4 + with: + path: | + ${{ env.BAZEL_OUTPUT_BASE }}/action_cache + ${{ env.BAZEL_OUTPUT_BASE }}/bazel-out + ${{ env.BAZEL_OUTPUT_BASE }}/external + ${{ env.BAZEL_OUTPUT_BASE }}/execroot + key: bazel-ob-v2-${{ runner.os }}-${{ hashFiles('.bazelversion', 'MODULE.bazel', 'MODULE.bazel.lock', '**/*.bzl') }} + restore-keys: | + bazel-ob-v2-${{ runner.os }}- + + - name: Build with Bazel + run: | + bazel build //... diff --git a/.github/workflows/build_qnx8.yml b/.github/workflows/build_qnx8.yml new file mode 100644 index 0000000..2fed313 --- /dev/null +++ b/.github/workflows/build_qnx8.yml @@ -0,0 +1,35 @@ +# ******************************************************************************* +# Copyright (c) 2025 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 +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +name: QNX8 Build +on: + pull_request_target: + types: [opened, reopened, synchronize] + merge_group: + types: [checks_requested] +jobs: + qnx-build: + if: false # temporarily disable QNX builds + uses: eclipse-score/cicd-workflows/.github/workflows/qnx-build.yml@main + permissions: + contents: read + pull-requests: read + with: + bazel-target: "//score/... //src/..." + bazel-config: "build_qnx8" + 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 }} diff --git a/.github/workflows/copyright.yml b/.github/workflows/copyright.yml new file mode 100644 index 0000000..8483278 --- /dev/null +++ b/.github/workflows/copyright.yml @@ -0,0 +1,27 @@ +# ******************************************************************************* +# Copyright (c) 2025 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 +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +name: Copyright checks +on: + pull_request: + types: [opened, reopened, synchronize] + merge_group: + types: [checks_requested] +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + copyright-check: + uses: eclipse-score/cicd-workflows/.github/workflows/copyright.yml@main + with: + bazel-target: "run //:copyright.check" diff --git a/.github/workflows/docs-cleanup.yml b/.github/workflows/docs-cleanup.yml new file mode 100644 index 0000000..56626f0 --- /dev/null +++ b/.github/workflows/docs-cleanup.yml @@ -0,0 +1,29 @@ +# ******************************************************************************* +# Copyright (c) 2025 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 +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +name: Documentation Cleanup + +permissions: + contents: write + pages: write + id-token: write + +on: + schedule: + - cron: "0 0 * * *" # Runs every day at midnight UTC + +jobs: + docs-cleanup: + uses: eclipse-score/cicd-workflows/.github/workflows/docs-cleanup.yml@main + secrets: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test_and_docs.yml b/.github/workflows/docs.yml similarity index 76% rename from .github/workflows/test_and_docs.yml rename to .github/workflows/docs.yml index 8771cb0..24bd399 100644 --- a/.github/workflows/test_and_docs.yml +++ b/.github/workflows/docs.yml @@ -11,7 +11,7 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -name: Tests, Verify and Build Docs +name: Documentation permissions: contents: write @@ -29,24 +29,15 @@ on: types: [checks_requested] jobs: - docs-verify: - uses: eclipse-score/cicd-workflows/.github/workflows/docs-verify.yml@main - permissions: - pull-requests: write - contents: read - with: - bazel-docs-verify-target: "//:docs_check" - - # TODO skipping tests as we don't integrate test results in docs anyways - - docs-build: - needs: [docs-verify] + build-docs: uses: eclipse-score/cicd-workflows/.github/workflows/docs.yml@main permissions: contents: write pages: write pull-requests: write id-token: write + with: + # the bazel-target depends on your repo specific docs_targets configuration (e.g. "suffix") bazel-target: "//:docs -- --github_user=${{ github.repository_owner }} --github_repo=${{ github.event.repository.name }}" retention-days: 3 diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..adb8876 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,27 @@ +# ******************************************************************************* +# Copyright (c) 2025 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 +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +name: Formatting checks + +on: + pull_request: + types: [opened, reopened, synchronize] + merge_group: + types: [checks_requested] +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +jobs: + formatting-check: + uses: eclipse-score/cicd-workflows/.github/workflows/format.yml@main + with: + bazel-target: "test //:format.check" # optional, this is the default diff --git a/.github/workflows/gitlint.yml b/.github/workflows/gitlint.yml new file mode 100644 index 0000000..e4e667b --- /dev/null +++ b/.github/workflows/gitlint.yml @@ -0,0 +1,34 @@ +# ******************************************************************************* +# Copyright (c) 2025 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 +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +name: Gitlint check +on: + pull_request: + types: [opened, synchronize, reopened] +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +jobs: + lint-commits: + name: check-commit-messages + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Run Gitlint Action + if: ${{ github.event_name == 'pull_request' }} + uses: ./.github/actions/gitlint + with: + pr-number: ${{ github.event.number }} + base-branch: ${{ github.event.pull_request.base.ref }} diff --git a/.github/workflows/license_check.yml b/.github/workflows/license_check.yml new file mode 100644 index 0000000..8e7cfe1 --- /dev/null +++ b/.github/workflows/license_check.yml @@ -0,0 +1,33 @@ +# ******************************************************************************* +# Copyright (c) 2025 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 +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +name: License check preparation +on: + pull_request_target: + types: [opened, reopened, synchronize] + merge_group: + types: [checks_requested] +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +permissions: + pull-requests: write + issues: write + +jobs: + license-check: + if: ${{ github.repository == 'eclipse-score/logging' }} + uses: eclipse-score/cicd-workflows/.github/workflows/license-check.yml@main + with: + repo-url: "${{ github.server_url }}/${{ github.repository }}" + secrets: + dash-api-token: ${{ secrets.ECLIPSE_GITLAB_API_TOKEN }} diff --git a/.github/workflows/build_and_test_host_gcc12.yml b/.github/workflows/tests.yml similarity index 60% rename from .github/workflows/build_and_test_host_gcc12.yml rename to .github/workflows/tests.yml index ff9f2e1..bd09372 100644 --- a/.github/workflows/build_and_test_host_gcc12.yml +++ b/.github/workflows/tests.yml @@ -11,29 +11,32 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -# Workflow configuration for S-CORE CI - Bazel Build & Test logging -# This workflow runs Bazel build and test when triggered by specific pull request events. +name: Bazel Tests -name: Bazel Build & Test logging (with host toolchain GCC12.2) on: pull_request: types: [opened, reopened, synchronize] - push: - branches: - - main merge_group: types: [checks_requested] +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + jobs: - build_and_test_gcc_host_gcc12: + setup-and-run-tests: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4.2.2 - - name: Setup Bazel - uses: bazel-contrib/setup-bazel@0.9.1 - - name: Bazel build logging targets - run: | - bazel build //score/... - - name: Bazel test logging targets + + - name: Setup Bazel with shared caching + uses: bazel-contrib/setup-bazel@0.15.0 + with: + bazelisk-version: 1.26.0 + disk-cache: true + repository-cache: true + bazelisk-cache: true + + - name: Run Tests via Bazel run: | - bazel test //score/... + echo "Running: bazel test //score/... //src/..." + bazel test //score/... //src/... diff --git a/.gitignore b/.gitignore index eaa02c4..3caabce 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ user.bazelrc .cache/* compile_commands.json rust-project.json + # Ruff .ruff_cache diff --git a/MODULE.bazel b/MODULE.bazel index 512b67e..62821f8 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -16,22 +16,56 @@ module( compatibility_level = 0, ) +# Bazel global rules +bazel_dep(name = "rules_python", version = "1.4.1") +bazel_dep(name = "bazel_skylib", version = "1.7.1") +bazel_dep(name = "rules_rust", version = "0.61.0") +bazel_dep(name = "rules_cc", version = "0.1.1") +bazel_dep(name = "aspect_rules_lint", version = "1.0.3") +bazel_dep(name = "buildifier_prebuilt", version = "7.3.1") bazel_dep(name = "platforms", version = "1.0.0") -bazel_dep(name = "score_toolchains_gcc", version = "0.4", dev_dependency = True) +# S-CORE process rules +bazel_dep(name = "score_bazel_platforms", version = "0.0.3") +bazel_dep(name = "score_docs_as_code", version = "2.2.0") +bazel_dep(name = "score_tooling", version = "1.0.4") +bazel_dep(name = "score_rust_policies", version = "0.0.3") -bazel_dep(name = "googletest", version = "1.17.0.bcr.1") -bazel_dep(name = "google_benchmark", version = "1.9.4") -bazel_dep(name = "rules_rust", version = "0.63.0") -bazel_dep(name = "rapidjson", version = "1.1.0") -bazel_dep(name = "score_crates", version = "0.0.3", repo_name = "crate_index") -bazel_dep(name = "jemalloc", version = "5.3.0-bcr.alpha.4") -bazel_dep(name = "libatomic", version = "1.0") -local_path_override( - module_name = "libatomic", - path = "third_party/libatomic", +bazel_dep(name = "score_process", version = "1.4.0", dev_dependency = True) +bazel_dep(name = "score_platform", version = "0.5.1", dev_dependency = True) # This is main score repo + +# 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 = "rust_qnx8_toolchain", version = "1.2.0", dev_dependency = True) +bazel_dep(name = "score_toolchains_rust", version = "0.1.1", 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", +) + +git_override( + module_name = "score_toolchains_rust", + commit = "bcf8e5364f72cf136ec81960350a82e2b5c45449", + remote = "https://github.com/eclipse-score/toolchains_rust.git", ) +archive_override( + module_name = "rust_qnx8_toolchain", + strip_prefix = "qnx8", + urls = [ + "https://github.com/qorix-group/rust-lang-qnx8/releases/download/1.2.0/qnx8_rust_toolchain.tar.gz", + ], +) + +# Extensions + gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency = True) gcc.toolchain( sha256 = "457f5f20f57528033cb840d708b507050d711ae93e009388847e113b11bf3600", @@ -47,34 +81,8 @@ git_override( remote = "https://github.com/bmw-software-engineering/trlc.git", ) -# TODO to be moved to toolchain. https://github.com/eclipse-score/toolchains_gcc/issues/11 -gcc.extra_features( - features = [ - "minimal_warnings", - "treat_warnings_as_errors", - ], -) -gcc.warning_flags( - minimal_warnings = [ - "-Wall", - "-Wno-error=deprecated-declarations", - ], - strict_warnings = [ - "-Wextra", - "-Wpedantic", - ], - treat_warnings_as_errors = ["-Werror"], -) use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc") -bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost") -archive_override( - module_name = "rules_boost", - strip_prefix = "rules_boost-master", - urls = ["https://github.com/nelhage/rules_boost/archive/refs/heads/master.tar.gz"], -) - -bazel_dep(name = "boost.program_options", version = "1.87.0") bazel_dep(name = "download_utils", version = "1.0.1") download_archive = use_repo_rule("@download_utils//download/archive:defs.bzl", "download_archive") @@ -93,42 +101,46 @@ download_archive( urls = ["https://github.com/python-jsonschema/jsonschema/archive/refs/tags/v4.23.0.tar.gz"], ) -# C/C++ rules for Bazel -bazel_dep(name = "rules_cc", version = "0.2.1") -bazel_dep(name = "nlohmann_json", version = "3.11.3") -bazel_dep(name = "bazel_skylib", version = "1.7.1") -bazel_dep(name = "rules_doxygen", version = "2.5.0") -bazel_dep(name = "score_baselibs", version = "0.2.1") +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", +) -# Python 3.12 toolchain for Bazel (required for LOBSTER/TRLC dependencies) -bazel_dep(name = "rules_python", version = "1.4.1") +PYTHON_VERSION = "3.12" -python = use_extension("@rules_python//python/extensions:python.bzl", "python") +python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True) python.toolchain( - python_version = "3.12", + is_default = True, + python_version = PYTHON_VERSION, ) +use_repo(python) -bazel_dep(name = "score_toolchains_qnx", version = "0.0.2", dev_dependency = True) -git_override( - module_name = "score_toolchains_qnx", - commit = "f9fe820390eede3d4e9b2a35651ff78bdd3cb676", - remote = "https://github.com/eclipse-score/toolchains_qnx.git", -) +use_repo(toolchains_qnx, "toolchains_qnx_sdp") +use_repo(toolchains_qnx, "toolchains_qnx_qcc") +use_repo(toolchains_qnx, "toolchains_qnx_ifs") + +# C++ dependencies -toolchains_qnx = use_extension( - "@score_toolchains_qnx//:extensions.bzl", - "toolchains_qnx", - dev_dependency = True, +bazel_dep(name = "googletest", version = "1.17.0.bcr.1") +bazel_dep(name = "google_benchmark", version = "1.9.4") +bazel_dep(name = "rapidjson", version = "1.1.0") +bazel_dep(name = "jemalloc", version = "5.3.0-bcr.alpha.4") +bazel_dep(name = "libatomic", version = "1.0") +local_path_override( + module_name = "libatomic", + path = "third_party/libatomic", ) -toolchains_qnx.sdp( - sha256 = "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63", - strip_prefix = "installation", - url = "https://www.qnx.com/download/download/79858/installation.tgz", + +bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost") +archive_override( + module_name = "rules_boost", + strip_prefix = "rules_boost-master", + urls = ["https://github.com/nelhage/rules_boost/archive/refs/heads/master.tar.gz"], ) -use_repo(toolchains_qnx, "toolchains_qnx_sdp") -use_repo(toolchains_qnx, "toolchains_qnx_ifs") -use_repo(toolchains_qnx, "toolchains_qnx_qcc") +bazel_dep(name = "boost.program_options", version = "1.87.0") bazel_dep(name = "score_communication", version = "0.1.2") git_override( module_name = "score_communication", @@ -136,23 +148,11 @@ git_override( remote = "https://github.com/eclipse-score/communication.git", ) -# LLVM Toolchains Rules - host configuration -bazel_dep(name = "toolchains_llvm", version = "1.4.0") - -llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm") -llvm.toolchain( - cxx_standard = {"": "c++17"}, - llvm_version = "19.1.0", +bazel_dep(name = "nlohmann_json", version = "3.11.3") +bazel_dep(name = "rules_doxygen", version = "2.5.0") +bazel_dep(name = "score_baselibs", version = "0.2.0") +git_override( + module_name = "score_baselibs", + commit = "3c65b223e9f516f95935bb4cd2e83d6088ca016f", + remote = "https://github.com/eclipse-score/baselibs.git", ) -use_repo(llvm, "llvm_toolchain") -use_repo(llvm, "llvm_toolchain_llvm") - -register_toolchains("@llvm_toolchain//:all") - -# tooling -bazel_dep(name = "score_tooling", version = "1.0.1") -bazel_dep(name = "aspect_rules_lint", version = "1.5.3") -bazel_dep(name = "buildifier_prebuilt", version = "8.2.0.2") - -#docs-as-code -bazel_dep(name = "score_docs_as_code", version = "2.2.0") diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..85b6056 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,4 @@ +# `rustfmt` should not be used with local configuration. +# Use Bazel target for formatting. +# E.g., `bazel run //:format.fix_Rust_with_rustfmt` +DO_NOT_USE_LOCAL_RUSTFMT_TOML = false diff --git a/scripts/internal/qnx_creds.py b/scripts/internal/qnx_creds.py new file mode 100644 index 0000000..06ae795 --- /dev/null +++ b/scripts/internal/qnx_creds.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 + +# ******************************************************************************* +# Copyright (c) 2025 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 +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +import http.cookiejar +import json +import netrc +import os +import sys +import urllib.parse +import urllib.request + + +def eprint(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) + + +if __name__ == "__main__": + data = json.load(sys.stdin) + + if "qnx.com" not in data["uri"]: + eprint("Unsupported domain") + sys.exit(1) + + if "SCORE_QNX_USER" in os.environ and "SCORE_QNX_PASSWORD" in os.environ: + login = os.environ["SCORE_QNX_USER"] + password = os.environ["SCORE_QNX_PASSWORD"] + else: + try: + nrc = netrc.netrc() + auth = nrc.authenticators("qnx.com") + if auth: + login, _, password = auth + else: + raise Exception("No credential found for QNX") + except Exception as excp: + eprint(excp) + eprint("Failed getting credentials from .netrc") + sys.exit(1) + + data = urllib.parse.urlencode( + {"userlogin": login, "password": password, "UseCookie": "1"} + ) + data = data.encode("ascii") + + cookie_jar = http.cookiejar.CookieJar() + cookie_processor = urllib.request.HTTPCookieProcessor(cookie_jar) + opener = urllib.request.build_opener(cookie_processor) + urllib.request.install_opener(opener) + + r = urllib.request.urlopen("https://www.qnx.com/account/login.html", data) + if r.status != 200: + eprint("Failed to login to QNX") + sys.exit(1) + + cookies = {c.name: c.value for c in list(cookie_jar)} + if not "myQNX" in cookies: + eprint("Failed to get myQNX cookie from login page") + sys.exit(1) + + myQNX = cookies["myQNX"] + print( + json.dumps( + { + "headers": { + "Cookie": [f"myQNX={myQNX}"], + } + } + ) + ) diff --git a/src/rust/mw_log_subscriber/examples/main.rs b/src/rust/mw_log_subscriber/examples/main.rs index 169686d..d31299e 100644 --- a/src/rust/mw_log_subscriber/examples/main.rs +++ b/src/rust/mw_log_subscriber/examples/main.rs @@ -49,13 +49,13 @@ fn main() { error!( "This is an log that will be trimmed {} {} {} {} {} {} {}. END MARKER NOT VISIBLE", - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", - "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", - "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", - "ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd", - "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", - "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - "ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", + "ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd", + "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg" ); // Using logger instance with context diff --git a/src/rust/mw_log_subscriber/src/lib.rs b/src/rust/mw_log_subscriber/src/lib.rs index 410994f..41aecfe 100644 --- a/src/rust/mw_log_subscriber/src/lib.rs +++ b/src/rust/mw_log_subscriber/src/lib.rs @@ -34,9 +34,7 @@ impl MwLoggerBuilder { } /// Builds the MwLogger with the specified context and configuration and returns it. - pub fn build( - self, - ) -> MwLogger { + pub fn build(self) -> MwLogger { let context_cstr = self.context.unwrap_or(CString::new("DFLT").unwrap()); let c_logger_ptr = unsafe { mw_log_create_logger(context_cstr.as_ptr().cast::()) }; MwLogger { @@ -46,13 +44,7 @@ impl MwLoggerBuilder { } /// Builds and sets the MwLogger as the default logger with the specified configuration. - pub fn set_as_default_logger< - const SHOW_MODULE: bool, - const SHOW_FILE: bool, - const SHOW_LINE: bool, - >( - self, - ) { + pub fn set_as_default_logger(self) { let logger = self.build::(); log::set_max_level(mw_log_logger_level(logger.ptr)); log::set_boxed_logger(Box::new(logger))