Skip to content

Commit ea9f8d0

Browse files
committed
impl: use new toolchains for cpp and rust
1 parent 007c902 commit ea9f8d0

6 files changed

Lines changed: 200 additions & 30 deletions

File tree

.bazelrc

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,59 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 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+
# -------------------------------------------------------------------------------
15+
# Links to S-CORE Bazel registry and Bazel Central Regoe
16+
# -------------------------------------------------------------------------------
17+
common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/
18+
common --registry=https://bcr.bazel.build
19+
20+
# -------------------------------------------------------------------------------
21+
# Default build flags (all configurations)
22+
# -------------------------------------------------------------------------------
123
build --java_language_version=17
224
build --tool_java_language_version=17
325
build --java_runtime_version=remotejdk_17
426
build --tool_java_runtime_version=remotejdk_17
527

628
test --test_output=errors
729

8-
common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/
9-
common --registry=https://bcr.bazel.build
30+
# -------------------------------------------------------------------------------
31+
# Shared configuration for simple test execution
32+
# -------------------------------------------------------------------------------
33+
build:_common --incompatible_strict_action_env
34+
build:_common --sandbox_writable_path=/var/tmp
35+
build:_common --host_platform=@score_bazel_platforms//:x86_64-linux
36+
37+
# -------------------------------------------------------------------------------
38+
# Config dedicated to host platform CPU:x86_64 and OS:Linux
39+
# -------------------------------------------------------------------------------
40+
build:x86_64-linux --config=_common
41+
build:x86_64-linux --platforms=@score_bazel_platforms//:x86_64-linux-gcc_12.2.0-posix
42+
build:x86_64-linux --extra_toolchains=@score_gcc_x86_64_toolchain//:x86_64-linux-gcc_12.2.0-posix
43+
build:x86_64-linux --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu
44+
45+
# -------------------------------------------------------------------------------
46+
# Config dedicated to target platform CPU:x86_64 and OS:QNX
47+
# -------------------------------------------------------------------------------
48+
build:x86_64-qnx --config=_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
52+
53+
# -------------------------------------------------------------------------------
54+
# Config dedicated to target platform CPU:arm64 and OS:QNX
55+
# -------------------------------------------------------------------------------
56+
build:arm64-qnx --config=_common
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

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.4.0
1+
8.4.2

.github/workflows/build_scenarios.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030

3131
- name: Run build
3232
run: |
33-
bazel build //...
33+
bazel build //... --config=x86_64-linux
3434
3535
- name: Run tests
3636
run: |
37-
bazel test //...
37+
bazel test //... --config=x86_64-linux

BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
13-
load("@score_starpls_lsp//:starpls.bzl", "setup_starpls")
13+
load("@score_tooling//:defs.bzl", "setup_starpls")
1414

1515
setup_starpls(
1616
name = "starpls_server",

MODULE.bazel

Lines changed: 65 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,75 @@
1010
#
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
13-
"""
14-
'score_test_scenarios' module.
15-
"""
16-
1713
module(
1814
name = "score_test_scenarios",
19-
version = "0.3.2",
15+
version = "0.0.0",
2016
compatibility_level = 0,
2117
)
2218

23-
# Starlark language server
24-
bazel_dep(name = "score_starpls_lsp", version = "0.1.0", dev_dependency = True)
19+
# Bazel global rules
20+
bazel_dep(name = "rules_python", version = "1.4.1")
21+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
22+
bazel_dep(name = "rules_cc", version = "0.1.1")
23+
bazel_dep(name = "aspect_rules_lint", version = "1.0.3")
24+
bazel_dep(name = "buildifier_prebuilt", version = "7.3.1")
25+
bazel_dep(name = "platforms", version = "1.0.0")
26+
27+
# S-CORE process rules
28+
bazel_dep(name = "score_bazel_platforms", version = "0.0.4")
29+
bazel_dep(name = "score_tooling", version = "1.1.0")
30+
bazel_dep(name = "score_rust_policies", version = "0.0.3")
31+
32+
# Toolchains and extensions
33+
bazel_dep(name = "rules_rust", version = "0.61.0")
34+
git_override(
35+
module_name = "rules_rust",
36+
commit = "293337fd6402ec3dfbeb8f2d589f38ad9124dadd",
37+
remote = "https://github.com/pawelrutkaq/rules_rust.git", # To be fixed once rule_rust is in score bazel registry
38+
)
2539

26-
# Python rules.
27-
bazel_dep(name = "rules_python", version = "1.7.0", dev_dependency = True)
40+
bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.2.2", dev_dependency = True)
41+
bazel_dep(name = "score_toolchains_rust", version = "0.7.0", dev_dependency = True)
42+
43+
# Others
44+
gcc = use_extension("@score_bazel_cpp_toolchains//extensions:gcc.bzl", "gcc", dev_dependency = True)
45+
gcc.toolchain(
46+
name = "score_gcc_x86_64_toolchain",
47+
target_cpu = "x86_64",
48+
target_os = "linux",
49+
use_default_package = True,
50+
version = "12.2.0",
51+
)
52+
gcc.toolchain(
53+
name = "score_gcc_aarch64_toolchain",
54+
target_cpu = "aarch64",
55+
target_os = "linux",
56+
use_default_package = True,
57+
version = "12.2.0",
58+
)
59+
gcc.toolchain(
60+
name = "score_qcc_x86_64_toolchain",
61+
sdp_version = "8.0.0",
62+
target_cpu = "x86_64",
63+
target_os = "qnx",
64+
use_default_package = True,
65+
version = "12.2.0",
66+
)
67+
gcc.toolchain(
68+
name = "score_qcc_aarch64_toolchain",
69+
sdp_version = "8.0.0",
70+
target_cpu = "aarch64",
71+
target_os = "qnx",
72+
use_default_package = True,
73+
version = "12.2.0",
74+
)
75+
use_repo(
76+
gcc,
77+
"score_gcc_aarch64_toolchain",
78+
"score_gcc_x86_64_toolchain",
79+
"score_qcc_aarch64_toolchain",
80+
"score_qcc_x86_64_toolchain",
81+
)
2882

2983
PYTHON_VERSION = "3.12"
3084

@@ -38,21 +92,8 @@ use_repo(python)
3892
# C++ GoogleTest dependencies.
3993
bazel_dep(name = "googletest", version = "1.17.0", dev_dependency = True)
4094

41-
# Rust rules.
42-
bazel_dep(name = "rules_rust", version = "0.67.0")
43-
44-
# C/C++ rules.
45-
bazel_dep(name = "rules_cc", version = "0.2.14")
46-
47-
# Rust module dependencies.
48-
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
49-
rust.toolchain(
50-
edition = "2021",
51-
versions = ["1.85.0"],
52-
)
53-
5495
# Json for C++.
5596
bazel_dep(name = "nlohmann_json", version = "3.12.0")
5697

57-
# Score Rust crates.
58-
bazel_dep(name = "score_crates", version = "0.0.6")
98+
# S-CORE crates
99+
bazel_dep(name = "score_crates", version = "0.0.7")

scripts/internal/qnx_creds.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/usr/bin/env python3
2+
3+
# *******************************************************************************
4+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
5+
#
6+
# See the NOTICE file(s) distributed with this work for additional
7+
# information regarding copyright ownership.
8+
#
9+
# This program and the accompanying materials are made available under the
10+
# terms of the Apache License Version 2.0 which is available at
11+
# https://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# SPDX-License-Identifier: Apache-2.0
14+
# *******************************************************************************
15+
16+
import http.cookiejar
17+
import json
18+
import netrc
19+
import os
20+
import sys
21+
import urllib.parse
22+
import urllib.request
23+
24+
25+
def eprint(*args, **kwargs):
26+
print(*args, file=sys.stderr, **kwargs)
27+
28+
29+
if __name__ == "__main__":
30+
data = json.load(sys.stdin)
31+
32+
if "qnx.com" not in data["uri"]:
33+
eprint("Unsupported domain")
34+
sys.exit(1)
35+
36+
if "SCORE_QNX_USER" in os.environ and "SCORE_QNX_PASSWORD" in os.environ:
37+
login = os.environ["SCORE_QNX_USER"]
38+
password = os.environ["SCORE_QNX_PASSWORD"]
39+
else:
40+
try:
41+
nrc = netrc.netrc()
42+
auth = nrc.authenticators("qnx.com")
43+
if auth:
44+
login, _, password = auth
45+
else:
46+
raise Exception("No credential found for QNX")
47+
except Exception as excp:
48+
eprint(excp)
49+
eprint("Failed getting credentials from .netrc")
50+
sys.exit(1)
51+
52+
data = urllib.parse.urlencode({"userlogin": login, "password": password, "UseCookie": "1"})
53+
data = data.encode("ascii")
54+
55+
cookie_jar = http.cookiejar.CookieJar()
56+
cookie_processor = urllib.request.HTTPCookieProcessor(cookie_jar)
57+
opener = urllib.request.build_opener(cookie_processor)
58+
urllib.request.install_opener(opener)
59+
60+
r = urllib.request.urlopen("https://www.qnx.com/account/login.html", data)
61+
if r.status != 200:
62+
eprint("Failed to login to QNX")
63+
sys.exit(1)
64+
65+
cookies = {c.name: c.value for c in list(cookie_jar)}
66+
if not "myQNX" in cookies:
67+
eprint("Failed to get myQNX cookie from login page")
68+
sys.exit(1)
69+
70+
myQNX = cookies["myQNX"]
71+
print(
72+
json.dumps(
73+
{
74+
"headers": {
75+
"Cookie": [f"myQNX={myQNX}"],
76+
}
77+
}
78+
)
79+
)

0 commit comments

Comments
 (0)