Skip to content

Commit 2ed562d

Browse files
authored
Merge pull request #73 from etas-contrib/paulquiring/targets-and-toolchains
Support correct targets & toolchains
2 parents 84303c2 + fa071ea commit 2ed562d

6 files changed

Lines changed: 1330 additions & 672 deletions

File tree

.bazelrc

Lines changed: 51 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,66 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/
15+
common --registry=https://bcr.bazel.build
16+
117
build --java_language_version=17
218
build --tool_java_language_version=17
319
build --java_runtime_version=remotejdk_17
420
build --tool_java_runtime_version=remotejdk_17
21+
build --credential_helper=*.qnx.com=%workspace%/scripts/internal/qnx_creds.py
522

23+
# Common test flags for all platforms
624
test --test_output=errors
25+
test --@score_baselibs//score/mw/log/flags:KRemote_Logging=False
26+
test --@score_baselibs//score/json:base_library=nlohmann
27+
test --cxxopt=-Wno-deprecated-declarations
728

8-
common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/
9-
common --registry=https://bcr.bazel.build
10-
common --credential_helper=*.qnx.com=%workspace%/scripts/internal/qnx_creds.py
29+
# Common Lifecycle Toolchain flags for build (do not use it in case of system toolchains!)
30+
build:toolchain_common --incompatible_strict_action_env
31+
build:toolchain_common --host_platform=@score_bazel_platforms//:x86_64-linux
32+
## Ferrocene must be common compiler for HOST. To ensure metadata compatibility for proc macro crate
33+
build:toolchain_common --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu
34+
build:stub --@score_baselibs//score/mw/log/flags:KRemote_Logging=False
35+
build:stub --@score_baselibs//score/json:base_library=nlohmann
36+
37+
# Target configuration for CPU:x86-64|OS:Linux build (do not use it in case of system toolchains!)
38+
build:x86_64-linux --config=stub
39+
build:x86_64-linux --config=toolchain_common
40+
build:x86_64-linux --platforms=@score_bazel_platforms//:x86_64-linux-gcc_12.2.0-posix
41+
build:x86_64-linux --extra_toolchains=@score_gcc_x86_64_toolchain//:x86_64-linux-gcc_12.2.0-posix
42+
build:x86_64-linux --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu
1143

12-
build:x86_64-linux --platforms=@score_bazel_platforms//:x86_64-linux
13-
build:x86_64-linux --define=config=x86_64-linux
44+
# TODO arm64-linux when rust support is there
1445

15-
build:build_qnx8 --platforms=@score_bazel_platforms//:arm64-qnx8_0
16-
build:build_qnx8 --extra_toolchains=@toolchains_qnx_qcc//:qcc_aarch64
17-
build:build_qnx8 --extra_toolchains=@score_toolchains_rust//toolchains/aarch64-unknown-qnx8_0:toolchain_aarch64_qnx8_0
18-
build:build_qnx8 --define=config=build_qnx8
46+
# Target configuration for CPU:x86-64|OS:QNX build (do not use it in case of system toolchains!)
47+
build:x86_64-qnx --config=stub
48+
build:x86_64-qnx --config=toolchain_common
49+
build:x86_64-qnx --platforms=@score_bazel_platforms//:x86_64-qnx-sdp_8.0.0-posix
50+
build:x86_64-qnx --extra_toolchains=@score_qcc_x86_64_toolchain//:x86_64-qnx-sdp_8.0.0-posix
51+
build:x86_64-qnx --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_pc_nto_qnx800
1952

20-
# TODO: Enable when rust toolchain for x86_64-qnx becomes available
21-
# build:x86_64-qnx --platforms=@score_bazel_platforms//:x86_64-qnx
22-
# build:x86_64-qnx --extra_toolchains=@toolchains_qnx_qcc//:qcc_x86_64
23-
# build:x86_64-qnx --define=config=x86_64-qnx
53+
# Target configuration for CPU:AArch64|OS:QNX build (do not use it in case of system toolchains!)
54+
build:arm64-qnx --config=stub
55+
build:arm64-qnx --config=toolchain_common
56+
build:arm64-qnx --incompatible_strict_action_env
57+
build:arm64-qnx --platforms=@score_bazel_platforms//:aarch64-qnx-sdp_8.0.0-posix
58+
build:arm64-qnx --extra_toolchains=@score_qcc_aarch64_toolchain//:aarch64-qnx-sdp_8.0.0-posix
59+
build:arm64-qnx --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_aarch64_unknown_nto_qnx800
2460

25-
common --@score_baselibs//score/mw/log/flags:KRemote_Logging=False
26-
common --@score_baselibs//score/json:base_library=nlohmann
61+
# to be removed
62+
build:build_qnx8 --config=arm64-qnx
2763

2864
## default is a stdout logger which looks like dlt logs
2965
## uncomment below to use score::mw::log instead of the stdout logger
3066
# build --cxxopt=-DLC_LOG_SCORE_MW_LOG
31-
32-
build --cxxopt=-std=c++17
33-
build --cxxopt=-Wno-missing-template-arg-list-after-template-kw
34-
# Required to build baselibs dependency which uses some deprecated APIs
35-
# & mismatched new/delete
36-
build --cxxopt=-Wno-mismatched-new-delete
37-
build --cxxopt=-Wno-deprecated-declarations
38-
39-
build --strip=never
40-
build --enable_bzlmod
41-
42-
common --extra_toolchains=@gcc_toolchain//:host_gcc_12
43-
common --extra_toolchains=@score_toolchains_rust//toolchains/x86_64-unknown-linux-gnu:toolchain_x86_64_linux

.github/workflows/build.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# *******************************************************************************
2-
# Copyright (c) 2025 Contributors to the Eclipse Foundation
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
33
#
44
# See the NOTICE file(s) distributed with this work for additional
55
# information regarding copyright ownership.
@@ -10,7 +10,6 @@
1010
#
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
13-
1413
name: Bazel Build
1514

1615
on:
@@ -30,7 +29,6 @@ jobs:
3029
- name: Setup Bazel
3130
uses: bazel-contrib/setup-bazel@0.15.0
3231
with:
33-
bazelisk-version: 1.26.0 # newest LTS before 1 Jun 2025
3432
disk-cache: true
3533
repository-cache: true
3634
bazelisk-cache: true
@@ -57,4 +55,4 @@ jobs:
5755
5856
- name: Build with Bazel
5957
run: |
60-
bazel build //...
58+
bazel build --config x86_64-linux //...

.github/workflows/build_qnx8.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# *******************************************************************************
2-
# Copyright (c) 2025 Contributors to the Eclipse Foundation
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
33
#
44
# See the NOTICE file(s) distributed with this work for additional
55
# information regarding copyright ownership.
@@ -23,9 +23,12 @@ jobs:
2323
permissions:
2424
contents: read
2525
pull-requests: read
26+
strategy:
27+
matrix:
28+
config: ['arm64-qnx', 'x86_64-qnx']
2629
with:
27-
bazel-target: '//src/...'
28-
bazel-config: 'build_qnx8'
30+
bazel-target: '//src/... //examples/...'
31+
bazel-config: ${{ matrix.config }}
2932
credential-helper: 'scripts/internal/qnx_creds.py'
3033
environment-name: 'workflow-approval'
3134
secrets:

MODULE.bazel

Lines changed: 52 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# *******************************************************************************
2-
# Copyright (c) 2025 Contributors to the Eclipse Foundation
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
33
#
44
# See the NOTICE file(s) distributed with this work for additional
55
# information regarding copyright ownership.
@@ -18,7 +18,7 @@ module(
1818
# Bazel global rules
1919
bazel_dep(name = "rules_python", version = "1.4.1")
2020
bazel_dep(name = "rules_rust", version = "0.61.0")
21-
bazel_dep(name = "rules_cc", version = "0.2.9")
21+
bazel_dep(name = "rules_cc", version = "0.2.14")
2222
bazel_dep(name = "aspect_rules_lint", version = "1.5.3")
2323
bazel_dep(name = "buildifier_prebuilt", version = "8.2.0.2")
2424
bazel_dep(name = "platforms", version = "1.0.0")
@@ -27,27 +27,66 @@ bazel_dep(name = "download_utils", version = "1.0.1")
2727
bazel_dep(name = "googletest", version = "1.17.0.bcr.1")
2828

2929
# S-CORE process rules
30-
bazel_dep(name = "score_bazel_platforms", version = "0.0.3")
30+
bazel_dep(name = "score_bazel_platforms", version = "0.0.4")
3131
bazel_dep(name = "score_docs_as_code", version = "2.3.0")
32-
bazel_dep(name = "score_tooling", version = "1.0.5")
32+
bazel_dep(name = "score_tooling", version = "1.1.0")
3333
bazel_dep(name = "score_rust_policies", version = "0.0.3")
3434

3535
bazel_dep(name = "score_process", version = "1.4.0", dev_dependency = True)
3636
bazel_dep(name = "score_platform", version = "0.5.1", dev_dependency = True)
3737

38-
# Toolchains and extensions
39-
bazel_dep(name = "score_toolchains_gcc", version = "0.5", dev_dependency = True)
40-
bazel_dep(name = "score_toolchains_qnx", version = "0.0.6", dev_dependency = True)
41-
bazel_dep(name = "rust_qnx8_toolchain", version = "1.2.0", dev_dependency = True)
42-
bazel_dep(name = "score_toolchains_rust", version = "0.1.1", dev_dependency = True)
38+
## Configure the C++ toolchain
39+
bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.2.2", dev_dependency = True)
40+
41+
gcc = use_extension("@score_bazel_cpp_toolchains//extensions:gcc.bzl", "gcc", dev_dependency = True)
42+
gcc.toolchain(
43+
name = "score_gcc_x86_64_toolchain",
44+
target_cpu = "x86_64",
45+
target_os = "linux",
46+
use_default_package = True,
47+
version = "12.2.0",
48+
)
49+
gcc.toolchain(
50+
name = "score_gcc_aarch64_toolchain",
51+
target_cpu = "aarch64",
52+
target_os = "linux",
53+
use_default_package = True,
54+
version = "12.2.0",
55+
)
56+
gcc.toolchain(
57+
name = "score_qcc_x86_64_toolchain",
58+
sdp_version = "8.0.0",
59+
target_cpu = "x86_64",
60+
target_os = "qnx",
61+
use_default_package = True,
62+
version = "12.2.0",
63+
)
64+
gcc.toolchain(
65+
name = "score_qcc_aarch64_toolchain",
66+
sdp_version = "8.0.0",
67+
target_cpu = "aarch64",
68+
target_os = "qnx",
69+
use_default_package = True,
70+
version = "12.2.0",
71+
)
72+
use_repo(
73+
gcc,
74+
"score_gcc_aarch64_toolchain",
75+
"score_gcc_x86_64_toolchain",
76+
"score_qcc_aarch64_toolchain",
77+
"score_qcc_x86_64_toolchain",
78+
)
79+
80+
## Rust Toolchain
81+
bazel_dep(name = "score_toolchains_rust", version = "0.4.0", dev_dependency = True)
4382

4483
# S-CORE crates
45-
bazel_dep(name = "score_crates", version = "0.0.6")
84+
bazel_dep(name = "score_crates", version = "0.0.7")
4685

4786
git_override(
48-
module_name = "score_toolchains_rust",
49-
commit = "bcf8e5364f72cf136ec81960350a82e2b5c45449",
50-
remote = "https://github.com/eclipse-score/toolchains_rust.git",
87+
module_name = "rules_rust",
88+
commit = "293337fd6402ec3dfbeb8f2d589f38ad9124dadd",
89+
remote = "https://github.com/pawelrutkaq/rules_rust.git", # To be fixed once rule_rust is in score bazel registry
5190
)
5291

5392
git_override(
@@ -56,31 +95,6 @@ git_override(
5695
remote = "https://github.com/google/flatbuffers.git",
5796
)
5897

59-
archive_override(
60-
module_name = "rust_qnx8_toolchain",
61-
strip_prefix = "qnx8",
62-
urls = [
63-
"https://github.com/qorix-group/rust-lang-qnx8/releases/download/1.2.0/qnx8_rust_toolchain.tar.gz",
64-
],
65-
)
66-
67-
# Extensions
68-
69-
gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency = True)
70-
gcc.toolchain(
71-
sha256 = "457f5f20f57528033cb840d708b507050d711ae93e009388847e113b11bf3600",
72-
strip_prefix = "x86_64-unknown-linux-gnu",
73-
url = "https://github.com/eclipse-score/toolchains_gcc_packages/releases/download/0.0.1/x86_64-unknown-linux-gnu_gcc12.tar.gz",
74-
)
75-
use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc")
76-
77-
toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx", dev_dependency = True)
78-
toolchains_qnx.sdp(
79-
sha256 = "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63",
80-
strip_prefix = "installation",
81-
url = "https://www.qnx.com/download/download/79858/installation.tgz",
82-
)
83-
8498
deb = use_repo_rule("@download_utils//download/deb:defs.bzl", "download_deb")
8599

86100
deb(
@@ -99,10 +113,6 @@ python.toolchain(
99113
)
100114
use_repo(python)
101115

102-
use_repo(toolchains_qnx, "toolchains_qnx_sdp")
103-
use_repo(toolchains_qnx, "toolchains_qnx_qcc")
104-
use_repo(toolchains_qnx, "toolchains_qnx_ifs")
105-
106116
bazel_dep(name = "score_baselibs_rust", version = "0.0.5")
107117
bazel_dep(name = "score_baselibs", version = "0.2.2")
108118

0 commit comments

Comments
 (0)