diff --git a/.github/workflows/qnx.yml b/.github/workflows/qnx.yml index ac2e35e..8d927d4 100644 --- a/.github/workflows/qnx.yml +++ b/.github/workflows/qnx.yml @@ -11,9 +11,6 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* name: Bazel Build (QNX) -permissions: - contents: read - actions: write on: pull_request: types: [opened, reopened, synchronize] @@ -23,86 +20,44 @@ on: merge_group: types: [checks_requested] workflow_call: + workflow_dispatch: jobs: qnx-build: - name: Build and Test ${{ matrix.bazel-config }} - runs-on: ${{ vars.runner_labels_ghub_standard_x64 && fromJSON(vars.runner_labels_ghub_standard_x64) || vars.REPO_RUNNER_LABELS && fromJSON(vars.REPO_RUNNER_LABELS) || 'ubuntu-24.04' }} - permissions: - contents: read - pull-requests: read - # Bazel test targets live in the separate `tests` module, so run all Bazel - # commands from that directory. `defaults.run.working-directory` applies to - # `run:` steps only; `uses:` action steps still execute from the repo root. - defaults: - run: - working-directory: ./tests + name: Build and Test ${{ matrix.name }} strategy: fail-fast: false matrix: include: - - bazel-config: x86_64-qnx - bazel-test-target: "//:all_tests" - - bazel-config: aarch64-qnx - bazel-test-target: "//:all_tests" + - name: toolchain-qnx-tests-x86_64 + bazel-config: x86_64-qnx + working-directory: "./tests/" + bazel-target: "//:all_tests" + bazel-disk-cache: toolchain-qnx-tests-x86_64 + bazel-test-target: >- + //:all_tests + - name: toolchain-qnx-tests-aarch64 + bazel-config: aarch64-qnx + working-directory: "./tests/" + bazel-target: "//:all_tests" + bazel-disk-cache: toolchain-qnx-tests-aarch64 + bazel-test-target: >- + //:all_tests extra-bazel-test-flags: "--test_timeout=120,600,1800,7200" # Increase test timeout due to QEMU emulation - steps: - - uses: eclipse-score/more-disk-space@6a3b48901846bf7f8cc985925157d71a8973e61f # v1 - with: - level: 2 - - name: Checkout repository (Handle all events) - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2 - with: - ref: ${{ github.head_ref || github.event.pull_request.head.ref || github.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} - - uses: eclipse-score/cicd-actions/unblock-user-namespace-for-linux-sandbox@30ed908edcf367bc38ebff5b386a244f9b6417a7 # 2025-06-04 - - name: Setup QNX SDP usage - uses: eclipse-score/cicd-actions/setup-qnx-sdp@a2b3c36fc7d1b9d03880d19935c7ac9cfffe58c6 # 2026-05-19 - with: - qnx-license: ${{ secrets.SCORE_QNX_LICENSE }} - qnx-user: ${{ secrets.SCORE_QNX_USER }} - qnx-password: ${{ secrets.SCORE_QNX_PASSWORD }} - qnx-credential-helper: .github/tools/qnx_credential_helper.py - qnx-license-dir: /opt/score_qnx/license - - name: Build with QNX toolchain - run: | - set -euo pipefail - - bazel build --config ${{ matrix.bazel-config }} \ - --credential_helper=*.qnx.com="${QNX_CREDENTIAL_HELPER}" -- \ - //:all_tests - - name: Install qemu - run: | - sudo apt-get update - sudo apt-get install -y qemu-system - - name: Enable KVM group permissions - run: | - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0660", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - sudo chown "$USER":kvm /dev/kvm && sudo chmod 0660 /dev/kvm - - name: Test with QNX toolchain - run: | - set -euo pipefail - - bazel test --config ${{ matrix.bazel-config }} \ - --test_output=errors \ - --credential_helper=*.qnx.com="${QNX_CREDENTIAL_HELPER}" ${{ matrix.extra-bazel-test-flags }} -- \ - ${{ matrix.bazel-test-target }} - - name: Coverage smoke test with QNX toolchain - run: | - set -euo pipefail - - bazel coverage --config ${{ matrix.bazel-config }} \ - --combined_report=lcov \ - --credential_helper=*.qnx.com="${QNX_CREDENTIAL_HELPER}" -- \ - //feature_verification:coverage_test - - name: Dump test logs on failure - if: failure() - run: | - echo "===== Bazel test logs =====" - # `bazel-testlogs` is a convenience symlink in the workspace root (./tests). - find -L bazel-testlogs -name 'test.log' -print | while read -r log; do - echo "" - echo "----- ${log} -----" - cat "${log}" - done + uses: eclipse-score/cicd-workflows/.github/workflows/qnx-build.yml@f606cc0c3fccd3e85dcc6d112f3f1f9aed7efdb8 # main on 2026-11-06 + permissions: + contents: read + pull-requests: read + with: + bazel-target: ${{ matrix.bazel-target }} + bazel-config: ${{ matrix.bazel-config }} + bazel-test-target: ${{ matrix.bazel-test-target }} + test-log-artifact-name: qnx-testlogs-${{ matrix.bazel-disk-cache }}-${{ github.run_attempt }} + credential-helper: ".github/tools/qnx_credential_helper.py" + bazel-disk-cache: ${{ matrix.bazel-disk-cache }} + working-directory: ${{ matrix.working-directory }} + extra-bazel-test-flags: ${{ matrix.extra-bazel-test-flags }} + secrets: + score-qnx-license: ${{ secrets.SCORE_QNX_LICENSE }} + score-qnx-user: ${{ secrets.SCORE_QNX_USER }} + score-qnx-password: ${{ secrets.SCORE_QNX_PASSWORD }} + qnx-sdp-github-token: ${{ secrets.SCORE_BOT_QNX_PKG_PAT }} diff --git a/docs/extension_api.md b/docs/extension_api.md index ab36e46..2483102 100644 --- a/docs/extension_api.md +++ b/docs/extension_api.md @@ -68,7 +68,12 @@ Common package selection attributes: - `sdk_version`: SDK version info variable, an alternative identifier used in matrix resolution. - `sdp_to_link`: name of the toolchain package to be linked with this - toolchain, default set to toolchain name + `_pkg`. + toolchain. For default QNX packages, the extension uses a name based on the + version-matrix entry so toolchains for different CPUs share one package + repository (for example, QNX SDP 8.0.5 uses + `qnx_sdp_8_0_5_pkg`). This default package is private and available only to + S-CORE committers; other users must provide their own compatible package via + `gcc.sdp(...)`. Other default packages use toolchain name + `_pkg`. - `use_system_toolchain`: TBD. Flag and runtime attributes: @@ -161,7 +166,7 @@ No `--credential_helper` is needed for these URLs. ```starlark gcc.sdp( name = "my_qnx_sdp_pkg", - build_file = "@score_bazel_cpp_toolchains//packages/qnx/x86_64/sdp/8.0.0:sdp.BUILD", + build_file = "//toolchains:qnx_sdp.BUILD", sha256 = "", type = "tar.gz", url = "https://api.github.com/repos///releases/assets/", diff --git a/docs/generation_flow.md b/docs/generation_flow.md index 255d526..9a8be53 100644 --- a/docs/generation_flow.md +++ b/docs/generation_flow.md @@ -81,7 +81,7 @@ Shared templates (used by both Linux and QNX): centralized in the `_normalize_cpu()` helper. Linux toolchain binaries use the CPU name unchanged (e.g., `aarch64-unknown-linux-gnu-gcov`). - SDP version mapping is handled through `SDP_VERSION_MAPPING` in - `rules/common.bzl`. Currently, SDP version `8.0.4` is mapped to `8.0.0` + `rules/common.bzl`. Currently, SDP version `8.0.5` is mapped to `8.0.0` because platform constraint support uses the older identifier. This mapping is configurable for future extensibility. - Linux toolchains generate an extra `gcov_wrapper` script to work around the diff --git a/docs/qnx_integration.md b/docs/qnx_integration.md index 45656a1..a991b9e 100644 --- a/docs/qnx_integration.md +++ b/docs/qnx_integration.md @@ -51,8 +51,8 @@ gcc.toolchain( name = "qnx_toolchain", target_cpu = "x86_64", # or "aarch64" target_os = "qnx", - sdp_version = "8.0.0", - use_default_package = True, # only if you're using reference integration QNX SDP package provided by QNX for S-CORE. + sdp_version = "8.0.5", + use_default_package = True, # available to S-CORE committers only license_path = "/path/to/your/qnx/license", # default location `/opt/score_qnx/license/licenses` ) @@ -64,70 +64,88 @@ supported values are: | `sdp_version` | Package selected | Platform and toolchain label used today | |---------------|------------------|------------------------------------------| -| `8.0.0` | QNX SDP 8.0.0 | `sdp_8.0.0` | -| `8.0.4` | QNX SDP 8.0.4 | `sdp_8.0.0` | +| `8.0.5` | QNX SDP 8.0.5 | `sdp_8.0.0` | -QNX SDP 8.0.4 currently uses the `sdp_8.0.0` platform constraint because -`bazel_platforms` does not yet define an `sdp_8.0.4` constraint. Therefore, an -8.0.4 toolchain still has `sdp_8.0.0` in its generated Bazel label. The archive -selected by `sdp_version` is nevertheless the actual 8.0.4 archive. +QNX SDP 8.0.5 uses the `sdp_8.0.0` platform constraint because +`bazel_platforms` does not define an `sdp_8.0.5` constraint. Therefore, an +8.0.5 toolchain still has `sdp_8.0.0` in its generated Bazel label. The archive +selected by `sdp_version` is nevertheless the actual 8.0.5 archive. The download and platform constraint are resolved separately. The archive is -looked up in `packages/version_matrix.bzl` under the real version key, such as -`x86_64-qnx-sdp_8.0.4`. The constraint and generated toolchain label use the -version after `SDP_VERSION_MAPPING` in `rules/common.bzl` is applied, which -currently maps `8.0.4` to `8.0.0`. - -When adding a future patch release, such as 8.0.5, add the corresponding -`x86_64-qnx-sdp_8.0.5` and `aarch64-qnx-sdp_8.0.5` entries to -`packages/version_matrix.bzl` with the new URL, SHA-256 digest, and strip -prefix. If the SDP still uses the `qnx8.0.0` target triple and GCC 12.2.0, -reuse the existing `packages/qnx//sdp/8.0.0/sdp.BUILD` descriptor and add -`"8.0.5": "8.0.0"` to `SDP_VERSION_MAPPING`. If the SDK layout or compiler -version changes, add a new package BUILD directory instead. If the release -needs a distinct platform constraint, add that constraint and its platforms to -`bazel_platforms` as well. - -To use QNX SDP 8.0.4 instead, change only the version in the toolchain -declaration: +looked up in `packages/version_matrix.bzl` under the real version key. QNX SDP +packages shared across CPUs use a CPU-independent key, such as +`qnx-sdp_8.0.5`; Linux package keys continue to include the CPU. The constraint +and generated toolchain label use the version after `SDP_VERSION_MAPPING` in +`rules/common.bzl` is applied, which currently maps `8.0.5` to `8.0.0`. +Both QNX toolchains referencing the same matrix entry also share one generated +package repository, so the archive is declared and extracted only once. + +For example, with `target_os = "qnx"` and `sdp_version = "8.0.5"`, enabling +`use_default_package` looks up the `qnx-sdp_8.0.5` matrix entry and generates +the package repository `qnx_sdp_8_0_5_pkg`. The repository name comes from the +matrix key, not the toolchain's `name` or `target_cpu`. Thus x86_64 and aarch64 +toolchain declarations for this SDP both link the same `@qnx_sdp_8_0_5_pkg`; +their generated toolchain repositories remain separate and retain their +declared names. + +The default SDP 8.0.5 archive is hosted in a private GitHub release and is +available only to S-CORE committers. If you are not an S-CORE committer, you +cannot fetch this default package even if you have a valid QNX license. Create +and host your own SDP package archive, including a BUILD file compatible with +this toolchain, and declare it with `gcc.sdp(...)`. Set +`use_default_package = False` and point `sdp_to_link` at the package name: ```starlark +gcc.sdp( + name = "my_qnx_sdp_pkg", + build_file = "//toolchains:qnx_sdp.BUILD", + sha256 = "", + type = "tar.gz", + url = "https://your-artifact-host/qnx_sdp.tar.gz", +) + gcc.toolchain( name = "qnx_toolchain", - target_cpu = "x86_64", # or "aarch64" + target_cpu = "x86_64", # or "aarch64" target_os = "qnx", - sdp_version = "8.0.4", - use_default_package = True, - license_path = "/path/to/your/qnx/license", + sdp_version = "8.0.5", # use the version packaged in your archive + sdp_to_link = "my_qnx_sdp_pkg", + use_default_package = False, ) ``` -If both SDP versions are needed in the same workspace, declare them with -different repository names so that either one can be selected explicitly: +When adding a future patch release, add one version-matrix entry for a shared +QNX package, keyed by `qnx-sdp_`, with its URL, SHA-256 digest, and +strip prefix. If the SDP still uses the `qnx8.0.0` target triple and GCC +12.2.0, reuse the existing `packages/qnx/sdp/8.0/sdp.BUILD` descriptor and add +the version mapping to `SDP_VERSION_MAPPING`. If the SDK layout or compiler +version changes, add a new package BUILD descriptor instead. If the release +needs a distinct platform constraint, add that constraint and its platforms to +`bazel_platforms` as well. + +For builds targeting both CPUs, declare a toolchain for each CPU. Both can +link the shared default QNX package: ```starlark gcc.toolchain( - name = "qnx_800_toolchain", + name = "qnx_x86_64_toolchain", target_cpu = "x86_64", target_os = "qnx", - sdp_version = "8.0.0", + sdp_version = "8.0.5", use_default_package = True, ) gcc.toolchain( - name = "qnx_804_toolchain", - target_cpu = "x86_64", + name = "qnx_aarch64_toolchain", + target_cpu = "aarch64", target_os = "qnx", - sdp_version = "8.0.4", + sdp_version = "8.0.5", use_default_package = True, ) - -use_repo(gcc, "qnx_800_toolchain", "qnx_804_toolchain") ``` -Use the corresponding generated repository in each Bazel configuration. Do -not register both toolchains in the same configuration: they currently have -the same target compatibility constraints. +The package repository is `@qnx_sdp_8_0_5_pkg` for both. Select the matching +CPU-specific generated toolchain repository in each Bazel configuration. #### Step 2: Add Bazel Configuration @@ -146,20 +164,6 @@ build:aarch64-qnx --sandbox_writable_path=/var/tmp > NOTE: Configuration variables are just an example, it's not mandatory to use exact configuration variables. -The platform label remains `sdp_8.0.0` when selecting the 8.0.4 package. If -both versions are declared as in Step 1, separate configurations can select -them as follows: - -```text -# QNX SDP 8.0.0 -build:x86_64-qnx-800 --platforms=@score_bazel_platforms//:x86_64-qnx-sdp_8.0.0-posix -build:x86_64-qnx-800 --extra_toolchains=@qnx_800_toolchain//:x86_64-qnx-sdp_8.0.0 - -# QNX SDP 8.0.4 -build:x86_64-qnx-804 --platforms=@score_bazel_platforms//:x86_64-qnx-sdp_8.0.0-posix -build:x86_64-qnx-804 --extra_toolchains=@qnx_804_toolchain//:x86_64-qnx-sdp_8.0.0 -``` - Notice that the generated target uses an underscore in `sdp_8.0.0`; a label such as `x86_64-qnx-sdp-8.0.0` does not exist. @@ -198,7 +202,7 @@ gcc.toolchain( name = "qnx_x86_64", target_cpu = "x86_64", target_os = "qnx", - sdp_version = "8.0.0", + sdp_version = "8.0.5", use_default_package = True, ) @@ -206,7 +210,7 @@ gcc.toolchain( name = "qnx_aarch64", target_cpu = "aarch64", target_os = "qnx", - sdp_version = "8.0.0", + sdp_version = "8.0.5", use_default_package = True, ) ``` @@ -319,18 +323,7 @@ cc_binary( You can verify the toolchain by building with explicit platform and toolchain selection: -For **x86_64-qnx with QNX SDP 8.0.0**: -```bash -bazel build \ - --platforms=@score_bazel_platforms//:x86_64-qnx-sdp_8.0.0-posix \ - --extra_toolchains=@qnx_toolchain//:x86_64-qnx-sdp_8.0.0 \ - //:hello_qnx -``` - -For **x86_64-qnx with QNX SDP 8.0.4**, use `sdp_version = "8.0.4"` in -`MODULE.bazel`. The platform and generated toolchain target still use the -`sdp_8.0.0` label: - +For **x86_64-qnx with QNX SDP 8.0.5**: ```bash bazel build \ --platforms=@score_bazel_platforms//:x86_64-qnx-sdp_8.0.0-posix \ @@ -508,7 +501,7 @@ gcc.toolchain( name = "qnx_toolchain", target_cpu = "x86_64", target_os = "qnx", - sdp_version = "8.0.0", + sdp_version = "8.0.5", use_default_package = True, license_path = "/path/to/your/license/file", ) @@ -524,7 +517,7 @@ gcc.toolchain( name = "qnx_toolchain", target_cpu = "x86_64", target_os = "qnx", - sdp_version = "8.0.0", + sdp_version = "8.0.5", use_default_package = True, license_path = "/path/to/your/license/file", license_info_url = "https://your-license-server.com/qnx-license", @@ -614,7 +607,7 @@ bazel test --config=aarch64-qnx //... When adapting the template above for your module, consider: -- [ ] **Replace SDP version**: Set `sdp_version` to the exact SDP package version; for SDP 8.0.4, keep the `sdp_8.0.0` platform/toolchain label until an `sdp_8.0.4` constraint is available +- [ ] **Replace SDP version**: Set `sdp_version` to the exact SDP package version; SDP 8.0.5 uses the `sdp_8.0.0` platform/toolchain label - [ ] **Update paths**: Adapt default paths and examples to your environment conventions - [ ] **Update configuration variables**: Adapt configuration variables to your moodule configurations - [ ] **Add module-specific targets**: Include examples of building your actual targets, not just generic `//...` diff --git a/extensions/gcc.bzl b/extensions/gcc.bzl index dfd3432..c3226d0 100644 --- a/extensions/gcc.bzl +++ b/extensions/gcc.bzl @@ -311,7 +311,6 @@ def _create_and_link_sdp(toolchain_info): Fails: If the resolved matrix key is not found in VERSION_MATRIX. """ - pkg_name = "{}{}".format(toolchain_info["name"], _PACKAGE_SUFFIX) # Resolve package identifier from original version fields, not the # constraint-remapped tc_identifier. tc_identifier may differ from @@ -325,12 +324,19 @@ def _create_and_link_sdp(toolchain_info): else: pkg_identifier = toolchain_info["tc_identifier"] - matrix_key = "{cpu}-{os}{identifier}{runtime_es}".format( - cpu = toolchain_info["tc_cpu"], - os = toolchain_info["tc_os"], + if toolchain_info["tc_os"] == _OS_QNX: + matrix_prefix = toolchain_info["tc_os"] + else: + matrix_prefix = "{}-{}".format(toolchain_info["tc_cpu"], toolchain_info["tc_os"]) + matrix_key = "{prefix}{identifier}{runtime_es}".format( + prefix = matrix_prefix, identifier = "-{}".format(pkg_identifier) if pkg_identifier != "" else "", runtime_es = "-{}".format(toolchain_info["tc_runtime_ecosystem"]) if toolchain_info["tc_runtime_ecosystem"] != "" else "", ) + if toolchain_info["tc_os"] == _OS_QNX: + pkg_name = "{}{}".format(matrix_key.replace("-", "_").replace(".", "_"), _PACKAGE_SUFFIX) + else: + pkg_name = "{}{}".format(toolchain_info["name"], _PACKAGE_SUFFIX) # Validate and retrieve matrix entry if matrix_key not in VERSION_MATRIX: @@ -363,6 +369,15 @@ def _create_and_link_sdp(toolchain_info): "files": matrix.get("files"), } +def _append_unique_package(packages, package_info): + """Adds an archive once, rejecting conflicting definitions with the same repository name.""" + for existing in packages: + if existing["name"] == package_info["name"]: + if existing != package_info: + fail("Conflicting package definitions use the repository name '{}'.".format(package_info["name"])) + return + packages.append(package_info) + def _resolve_identifier(toolchain_info): """Resolves the toolchain identifier from version fields. @@ -461,7 +476,7 @@ def _get_info(mctx): continue if tc["use_default_package"]: - packages.append(_create_and_link_sdp(tc)) + _append_unique_package(packages, _create_and_link_sdp(tc)) _resolve_qnx_gcc_version(tc) diff --git a/packages/qnx/aarch64/sdp/8.0.0/BUILD b/packages/qnx/sdp/8.0/BUILD similarity index 100% rename from packages/qnx/aarch64/sdp/8.0.0/BUILD rename to packages/qnx/sdp/8.0/BUILD diff --git a/packages/qnx/aarch64/sdp/8.0.0/sdp.BUILD b/packages/qnx/sdp/8.0/sdp.BUILD similarity index 71% rename from packages/qnx/aarch64/sdp/8.0.0/sdp.BUILD rename to packages/qnx/sdp/8.0/sdp.BUILD index 57ff397..3e83c2c 100644 --- a/packages/qnx/aarch64/sdp/8.0.0/sdp.BUILD +++ b/packages/qnx/sdp/8.0/sdp.BUILD @@ -20,7 +20,7 @@ filegroup( ) filegroup( - name = "cxx_builtin_include_directories", + name = "cxx_builtin_include_directories_aarch64", srcs = [ "host/linux/x86_64/usr/lib/gcc/aarch64-unknown-nto-qnx8.0.0/12.2.0/include", "target/qnx/usr/include", @@ -29,10 +29,24 @@ filegroup( ) filegroup( - name = "ar", + name = "cxx_builtin_include_directories_x86_64", + srcs = [ + "host/linux/x86_64/usr/lib/gcc/x86_64-pc-nto-qnx8.0.0/12.2.0/include", + "target/qnx/usr/include", + "target/qnx/usr/include/c++/v1", + ], +) + +filegroup( + name = "ar_aarch64", srcs = ["host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx8.0.0-ar"], ) +filegroup( + name = "ar_x86_64", + srcs = ["host/linux/x86_64/usr/bin/x86_64-pc-nto-qnx8.0.0-ar"], +) + filegroup( name = "cc", srcs = ["host/linux/x86_64/usr/bin/qcc"], @@ -44,7 +58,12 @@ filegroup( ) filegroup( - name = "strip", + name = "strip_aarch64", + srcs = ["host/linux/x86_64/usr/bin/x86_64-pc-nto-qnx8.0.0-strip"], +) + +filegroup( + name = "strip_x86_64", srcs = ["host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx8.0.0-strip"], ) @@ -74,10 +93,15 @@ filegroup( ) filegroup( - name = "gcov", + name = "gcov_aarch64", srcs = ["host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx8.0.0-gcov"], ) +filegroup( + name = "gcov_x86_64", + srcs = ["host/linux/x86_64/usr/bin/x86_64-pc-nto-qnx8.0.0-gcov"], +) + filegroup( name = "mkifs", srcs = ["host/linux/x86_64/usr/bin/mkifs"], diff --git a/packages/qnx/x86_64/sdp/8.0.0/BUILD b/packages/qnx/x86_64/sdp/8.0.0/BUILD deleted file mode 100644 index e69de29..0000000 diff --git a/packages/qnx/x86_64/sdp/8.0.0/sdp.BUILD b/packages/qnx/x86_64/sdp/8.0.0/sdp.BUILD deleted file mode 100644 index f010392..0000000 --- a/packages/qnx/x86_64/sdp/8.0.0/sdp.BUILD +++ /dev/null @@ -1,84 +0,0 @@ -# ******************************************************************************* -# 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 -# ******************************************************************************* -package(default_visibility = [ - "//visibility:public", -]) - -filegroup( - name = "all_files", - srcs = glob(["*/**/*"]), -) - -filegroup( - name = "cxx_builtin_include_directories", - srcs = [ - "host/linux/x86_64/usr/lib/gcc/x86_64-pc-nto-qnx8.0.0/12.2.0/include", - "target/qnx/usr/include", - "target/qnx/usr/include/c++/v1", - ], -) - -filegroup( - name = "ar", - srcs = ["host/linux/x86_64/usr/bin/x86_64-pc-nto-qnx8.0.0-ar"], -) - -filegroup( - name = "cc", - srcs = ["host/linux/x86_64/usr/bin/qcc"], -) - -filegroup( - name = "cxx", - srcs = ["host/linux/x86_64/usr/bin/q++"], -) - -filegroup( - name = "strip", - srcs = ["host/linux/x86_64/usr/bin/x86_64-pc-nto-qnx8.0.0-strip"], -) - -filegroup( - name = "host_all", - srcs = glob(["host/linux/x86_64/**/*"]), -) - -filegroup( - name = "host_dir", - srcs = ["host/linux/x86_64"], -) - -filegroup( - name = "target_all", - srcs = glob(["target/qnx/**/*"]), -) - -filegroup( - name = "sysroot_dir", - srcs = ["."], -) - -filegroup( - name = "target_dir", - srcs = ["target/qnx"], -) - -filegroup( - name = "gcov", - srcs = ["host/linux/x86_64/usr/bin/x86_64-pc-nto-qnx8.0.0-gcov"], -) - -filegroup( - name = "mkifs", - srcs = ["host/linux/x86_64/usr/bin/mkifs"], -) diff --git a/packages/version_matrix.bzl b/packages/version_matrix.bzl index 3a4b479..55e39b1 100644 --- a/packages/version_matrix.bzl +++ b/packages/version_matrix.bzl @@ -117,18 +117,12 @@ VERSION_MATRIX = { "strip_prefix": "sysroot", "url": "https://github.com/eclipse-score/os_autosd/releases/download/v0.2.0/autosd-toolchain-crossland.tar.gz", }, - "aarch64-qnx-sdp_8.0.0": { - "build_file": "@score_bazel_cpp_toolchains//packages/qnx/aarch64/sdp/8.0.0:sdp.BUILD", - "sha256": "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63", - "strip_prefix": "installation", - "url": "https://www.qnx.com/download/download/79858/installation.tgz", - "gcc_version": "12.2.0", - }, - "aarch64-qnx-sdp_8.0.4": { - "build_file": "@score_bazel_cpp_toolchains//packages/qnx/aarch64/sdp/8.0.0:sdp.BUILD", - "sha256": "146312c0bf22aab66e8294a06403f2ec6cfeeb074d8fa11549faffd84b7fe778", + "qnx-sdp_8.0.5": { + "build_file": "@score_bazel_cpp_toolchains//packages/qnx/sdp/8.0:sdp.BUILD", + "sha256": "eaf000e6d8fe8b96685a0c0d5041e9fe62fe36c9fc3f0854033a7be9fbec8c89", "strip_prefix": "", - "url": "https://www.qnx.com/download/download/88447/installation_qnx_804_260520.tar.xz", + "type": "tar.gz", + "url": "https://api.github.com/repos/eclipse-score/qnx_sdp_pkg/releases/assets/706198299", "gcc_version": "12.2.0", }, "x86_64-linux-gcc_12.2.0": { @@ -369,18 +363,4 @@ VERSION_MATRIX = { "rm -rf \"$tmp\"", ], }, - "x86_64-qnx-sdp_8.0.0": { - "build_file": "@score_bazel_cpp_toolchains//packages/qnx/x86_64/sdp/8.0.0:sdp.BUILD", - "sha256": "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63", - "strip_prefix": "installation", - "url": "https://www.qnx.com/download/download/79858/installation.tgz", - "gcc_version": "12.2.0", - }, - "x86_64-qnx-sdp_8.0.4": { - "build_file": "@score_bazel_cpp_toolchains//packages/qnx/x86_64/sdp/8.0.0:sdp.BUILD", - "sha256": "146312c0bf22aab66e8294a06403f2ec6cfeeb074d8fa11549faffd84b7fe778", - "strip_prefix": "", - "url": "https://www.qnx.com/download/download/88447/installation_qnx_804_260520.tar.xz", - "gcc_version": "12.2.0", - }, } diff --git a/rules/common.bzl b/rules/common.bzl index 083e652..4c18657 100644 --- a/rules/common.bzl +++ b/rules/common.bzl @@ -22,6 +22,7 @@ load("@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", "flag_group") # uses the older identifier. SDP_VERSION_MAPPING = { "8.0.4": "8.0.0", + "8.0.5": "8.0.0", } # GCC version bundled with each QNX SDP major release, keyed by SDP major version. diff --git a/rules/gcc.bzl b/rules/gcc.bzl index 05dd175..fd6df36 100644 --- a/rules/gcc.bzl +++ b/rules/gcc.bzl @@ -28,6 +28,10 @@ _PLACEHOLDER_TOOLCHAIN_PKG = "%{toolchain_pkg}%" _TRIPLE_AARCH64_QNX_FMT = "aarch64-unknown-nto-qnx{sdp}" _TRIPLE_GENERIC_QNX_FMT = "{cpu}-pc-nto-qnx{sdp}" +def build_tool_suffix(tc_cpu): + """Returns the target CPU suffix used by QNX package labels.""" + return "_{}".format(tc_cpu) + def dict_union(x, y): """Merges two dictionaries into a new dictionary. @@ -63,13 +67,13 @@ filegroup( cc_toolchain_config( name = "cc_toolchain_config", - ar_binary = "@{tc_pkg_repo}//:ar", + ar_binary = "@{tc_pkg_repo}//:ar{tc_suffix}", cc_binary = "@{tc_pkg_repo}//:cc", cxx_binary = "@{tc_pkg_repo}//:cxx", - gcov_binary = "@{tc_pkg_repo}//:gcov", - strip_binary = "@{tc_pkg_repo}//:strip", + gcov_binary = "@{tc_pkg_repo}//:gcov{tc_suffix}", + strip_binary = "@{tc_pkg_repo}//:strip{tc_suffix}", sysroot = "@{tc_pkg_repo}//:sysroot_dir", - cxx_builtin_include_directories = ["@{tc_pkg_repo}//:cxx_builtin_include_directories"], + cxx_builtin_include_directories = ["@{tc_pkg_repo}//:cxx_builtin_include_directories{tc_suffix}"], target_cpu = "{tc_cpu}", target_os = "{tc_os}", known_features = _KNOWN_FEATURES, @@ -84,6 +88,7 @@ cc_toolchain_config( tc_os = rctx.attr.tc_os, tc_extra_known_features = label_list_to_string(rctx.attr.extra_known_features), tc_extra_enabled_features = label_list_to_string(rctx.attr.extra_enabled_features), + tc_suffix = build_tool_suffix(rctx.attr.tc_cpu) if rctx.attr.tc_os == "qnx" else "", ) def get_custom_cc_features_qnx(rctx, canonical_pkg_name): diff --git a/tests/MODULE.bazel b/tests/MODULE.bazel index 0bca1f7..9e1a883 100644 --- a/tests/MODULE.bazel +++ b/tests/MODULE.bazel @@ -48,7 +48,7 @@ bazel_dep(name = "googletest", version = "1.17.0") # QNX unit-test runner (provides //src:run_under_qnx used to execute QNX test # binaries under emulation via --run_under on the QNX configs). # ******************************************************************************* -bazel_dep(name = "score_qnx_unit_tests", version = "0.2.0", dev_dependency = True) +bazel_dep(name = "score_qnx_unit_tests", version = "0.3.0", dev_dependency = True) # ******************************************************************************* # Set dependency to Bazel C/C++ Toolchain repository - with overriding path @@ -151,7 +151,7 @@ gcc.toolchain( ) # ******************************************************************************* -# Setting GCC (CPU:x86_64|OS:QNX|version(sdp):8.0.4|ES:posix) +# Setting GCC (CPU:x86_64|OS:QNX|version(sdp):8.0.5|ES:posix) # ******************************************************************************* # gcc.toolchain( # name = "score_qcc_toolchain", @@ -162,22 +162,22 @@ gcc.toolchain( # ) # ******************************************************************************* -# Setting GCC (CPU:x86_64|OS:QNX|version(sdp):8.0.4|ES:posix) +# Setting GCC (CPU:x86_64|OS:QNX|version(sdp):8.0.5|ES:posix) # ******************************************************************************* gcc.toolchain( name = "score_qcc_toolchain", - sdp_version = "8.0.4", + sdp_version = "8.0.5", target_cpu = "x86_64", target_os = "qnx", use_default_package = True, ) # ******************************************************************************* -# Setting GCC (CPU:aarch64|OS:QNX|version(sdp):8.0.4|ES:posix) +# Setting GCC (CPU:aarch64|OS:QNX|version(sdp):8.0.5|ES:posix) # ******************************************************************************* gcc.toolchain( name = "score_qcc_arm_toolchain", - sdp_version = "8.0.4", + sdp_version = "8.0.5", target_cpu = "aarch64", target_os = "qnx", use_default_package = True, @@ -227,6 +227,7 @@ gcc.toolchain( use_repo( gcc, "my_toolchain", + "qnx_sdp_8_0_5_pkg", "score_aarch64_gcc_toolchain", "score_aarch64_gcc_toolchain_15", "score_autosd_10_cross_toolchain", @@ -237,9 +238,7 @@ use_repo( "score_gcc_toolchain_15", "score_gcc_toolchain_bp", "score_qcc_arm_toolchain", - "score_qcc_arm_toolchain_pkg", "score_qcc_toolchain", - "score_qcc_toolchain_pkg", ) # ******************************************************************************* @@ -253,7 +252,7 @@ bazel_dep(name = "score_rules_imagefs", version = "0.0.4", dev_dependency = True imagefs = use_extension("@score_rules_imagefs//extensions:imagefs.bzl", "imagefs", dev_dependency = True) imagefs.toolchain( name = "score_qnx_x86_64_ifs_toolchain", - sdp_to_import = "@score_qcc_toolchain_pkg", + sdp_to_import = "@qnx_sdp_8_0_5_pkg", sdp_version = "8.0.0", target_cpu = "x86_64", target_os = "qnx", @@ -265,7 +264,7 @@ imagefs.toolchain( # ******************************************************************************* imagefs.toolchain( name = "score_qnx_aarch64_ifs_toolchain", - sdp_to_import = "@score_qcc_arm_toolchain_pkg", + sdp_to_import = "@qnx_sdp_8_0_5_pkg", sdp_version = "8.0.0", target_cpu = "aarch64", target_os = "qnx", diff --git a/tests/MODULE.bazel.lock b/tests/MODULE.bazel.lock index d182a48..2efbf84 100644 --- a/tests/MODULE.bazel.lock +++ b/tests/MODULE.bazel.lock @@ -580,8 +580,8 @@ "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_python_basics/0.3.1/MODULE.bazel": "99c491109937542e61df090222666a8613ef946fa7bb2b2d5ba648b2baba03ad", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_python_basics/0.3.2/MODULE.bazel": "f25490f64035a0e3a0d53ad9cb6164e8325ce6cf2a7ee68c6ae153840cb2497e", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_python_basics/0.3.4/MODULE.bazel": "53bd16dfbb1fb8ecf6822fb26f9f4e8333bac7b14d12bb02bf84078063820a31", - "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_qnx_unit_tests/0.2.0/MODULE.bazel": "aaffff67916dd058737aac8e04368f12b214e7646ff58adbab48e6429d1a5410", - "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_qnx_unit_tests/0.2.0/source.json": "c40a614fd88beab7cb65b8640debd44eff3fbc32a7839734ef1112f265d2eeef", + "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_qnx_unit_tests/0.3.0/MODULE.bazel": "1e4737455108eaf6e482b6cedc2c588b4935c4ec8efcd1c53d81e0dd765247a3", + "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_qnx_unit_tests/0.3.0/source.json": "07c574f14574ba2cb46fd84eb28600f44599a2c29e1023dbdb777985ee4b80c0", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_rules_imagefs/0.0.3/MODULE.bazel": "d87fcd3485438284fa96d6a5a81923d6b6672468947423517cc43c4d7692ca6a", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_rules_imagefs/0.0.4/MODULE.bazel": "e0a846244a2bb99939d8c3bde2d3d6b5a5c868e0514aeb6af37657d39622e68d", "https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/modules/score_rules_imagefs/0.0.4/source.json": "d8bd021bff025a483a04e5fbd0f73b745bcdb90daa1f2ac01f4cc16a34f7174a", @@ -1400,8 +1400,8 @@ }, "@@score_bazel_cpp_toolchains+//extensions:gcc.bzl%gcc": { "general": { - "bzlTransitiveDigest": "nsbKejNA4VOLaazXnN2o7EG2He4yPLlWVRa7tJ7JK0Q=", - "usagesDigest": "BkOcTZ5iNKR+5duxzNN9Vybfv5/191KgNSvkoOHbhGE=", + "bzlTransitiveDigest": "8aun0qKH2NHbhrt2FJnFH30qaJEKO8C+JDFKyZQahqY=", + "usagesDigest": "3VpqDziV5jWwniMyJZpXR4frOWjtR1rEJ584UGNhxVo=", "recordedInputs": [ "REPO_MAPPING:,score_bazel_cpp_toolchains score_bazel_cpp_toolchains+", "REPO_MAPPING:bazel_tools,rules_cc rules_cc+", @@ -1517,40 +1517,20 @@ "type": "" } }, - "score_qcc_toolchain_pkg": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", - "attributes": { - "urls": [ - "https://www.qnx.com/download/download/88447/installation_qnx_804_260520.tar.xz" - ], - "build_file": "@@score_bazel_cpp_toolchains+//packages/qnx/x86_64/sdp/8.0.0:sdp.BUILD", - "files": {}, - "patch_args": [], - "patch_cmds": [], - "patch_strip": 0, - "patch_tool": "", - "patches": [], - "sha256": "146312c0bf22aab66e8294a06403f2ec6cfeeb074d8fa11549faffd84b7fe778", - "strip_prefix": "", - "type": "" - } - }, - "score_qcc_arm_toolchain_pkg": { - "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "qnx_sdp_8_0_5_pkg": { + "repoRuleId": "@@score_bazel_cpp_toolchains+//rules:github_release_archive.bzl%github_release_archive", "attributes": { - "urls": [ - "https://www.qnx.com/download/download/88447/installation_qnx_804_260520.tar.xz" - ], - "build_file": "@@score_bazel_cpp_toolchains+//packages/qnx/aarch64/sdp/8.0.0:sdp.BUILD", + "url": "https://api.github.com/repos/eclipse-score/qnx_sdp_pkg/releases/assets/706198299", + "build_file": "@@score_bazel_cpp_toolchains+//packages/qnx/sdp/8.0:sdp.BUILD", "files": {}, "patch_args": [], "patch_cmds": [], "patch_strip": 0, "patch_tool": "", "patches": [], - "sha256": "146312c0bf22aab66e8294a06403f2ec6cfeeb074d8fa11549faffd84b7fe778", + "sha256": "eaf000e6d8fe8b96685a0c0d5041e9fe62fe36c9fc3f0854033a7be9fbec8c89", "strip_prefix": "", - "type": "" + "type": "tar.gz" } }, "score_autosd_10_toolchain_pkg": { @@ -1800,12 +1780,12 @@ "license_info_value": "", "license_path": "/opt/score_qnx/license/licenses", "sdk_version": "", - "sdp_version": "8.0.4", + "sdp_version": "8.0.5", "tc_compiler_library_search_paths": [], "tc_cpu": "x86_64", "tc_identifier": "sdp_8.0.0", "tc_os": "qnx", - "tc_pkg_repo": "score_qcc_toolchain_pkg", + "tc_pkg_repo": "qnx_sdp_8_0_5_pkg", "tc_system_toolchain": false, "tc_runtime_ecosystem": "", "gcc_version": "12.2.0", @@ -1826,12 +1806,12 @@ "license_info_value": "", "license_path": "/opt/score_qnx/license/licenses", "sdk_version": "", - "sdp_version": "8.0.4", + "sdp_version": "8.0.5", "tc_compiler_library_search_paths": [], "tc_cpu": "aarch64", "tc_identifier": "sdp_8.0.0", "tc_os": "qnx", - "tc_pkg_repo": "score_qcc_arm_toolchain_pkg", + "tc_pkg_repo": "qnx_sdp_8_0_5_pkg", "tc_system_toolchain": false, "tc_runtime_ecosystem": "", "gcc_version": "12.2.0", @@ -2127,10 +2107,9 @@ "@@score_rules_imagefs+//extensions:imagefs.bzl%imagefs": { "general": { "bzlTransitiveDigest": "4qMGnB7+T2rXYxW5iSvXX6nlCv/jNBvR6B0r5AHvEQQ=", - "usagesDigest": "4LvOoMbWgpZh1KrPMaxsrJ/9n3DRlU6JijkThVx2Cw0=", + "usagesDigest": "SQsHWA7B0eqvEqOBRPtJh+eH8EvC9pPlq4Vh681JMTc=", "recordedInputs": [ - "REPO_MAPPING:,score_qcc_arm_toolchain_pkg score_bazel_cpp_toolchains++gcc+score_qcc_arm_toolchain_pkg", - "REPO_MAPPING:,score_qcc_toolchain_pkg score_bazel_cpp_toolchains++gcc+score_qcc_toolchain_pkg", + "REPO_MAPPING:,qnx_sdp_8_0_5_pkg score_bazel_cpp_toolchains++gcc+qnx_sdp_8_0_5_pkg", "REPO_MAPPING:score_rules_imagefs+,bazel_tools bazel_tools", "REPO_MAPPING:score_rules_imagefs+,score_rules_imagefs score_rules_imagefs+" ], @@ -2140,7 +2119,7 @@ "attributes": { "tc_cpu": "x86_64", "tc_os": "qnx", - "tc_pkg_repo": "'@@score_bazel_cpp_toolchains++gcc+score_qcc_toolchain_pkg'", + "tc_pkg_repo": "'@@score_bazel_cpp_toolchains++gcc+qnx_sdp_8_0_5_pkg'", "sdp_version": "8.0.0", "tc_type": "ifs" } @@ -2150,7 +2129,7 @@ "attributes": { "tc_cpu": "aarch64", "tc_os": "qnx", - "tc_pkg_repo": "'@@score_bazel_cpp_toolchains++gcc+score_qcc_arm_toolchain_pkg'", + "tc_pkg_repo": "'@@score_bazel_cpp_toolchains++gcc+qnx_sdp_8_0_5_pkg'", "sdp_version": "8.0.0", "tc_type": "ifs" }