Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 52 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,59 @@
# *******************************************************************************
# 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
# *******************************************************************************

# -------------------------------------------------------------------------------
# Links to S-CORE Bazel registry and Bazel Central Regoe
# -------------------------------------------------------------------------------
common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/
common --registry=https://bcr.bazel.build

# -------------------------------------------------------------------------------
# Default build flags (all configurations)
# -------------------------------------------------------------------------------
build --java_language_version=17
build --tool_java_language_version=17
build --java_runtime_version=remotejdk_17
build --tool_java_runtime_version=remotejdk_17

test --test_output=errors

common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/
common --registry=https://bcr.bazel.build
# -------------------------------------------------------------------------------
# Shared configuration for simple test execution
# -------------------------------------------------------------------------------
build:_common --incompatible_strict_action_env
build:_common --sandbox_writable_path=/var/tmp
build:_common --host_platform=@score_bazel_platforms//:x86_64-linux

# -------------------------------------------------------------------------------
# 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

# -------------------------------------------------------------------------------
# Config dedicated to target platform CPU:x86_64 and OS: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

# -------------------------------------------------------------------------------
# Config dedicated to target platform CPU:arm64 and OS: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
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.4.0
8.4.2
4 changes: 2 additions & 2 deletions .github/workflows/build_scenarios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:

- name: Run build
run: |
bazel build //...
bazel build //... --config=x86_64-linux

- name: Run tests
run: |
bazel test //...
bazel test //... --config=x86_64-linux
2 changes: 1 addition & 1 deletion .github/workflows/fomat_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
pip install -e ".[dev]" || true

- name: Check formatting with Ruff
run: ruff check .
run: ruff check . --exclude scripts/internal

test:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@score_starpls_lsp//:starpls.bzl", "setup_starpls")
load("@score_tooling//:defs.bzl", "setup_starpls")

setup_starpls(
name = "starpls_server",
Expand Down
89 changes: 65 additions & 24 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,75 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
"""
'score_test_scenarios' module.
"""

module(
name = "score_test_scenarios",
version = "0.3.2",
version = "0.0.0",
compatibility_level = 0,
)

# Starlark language server
bazel_dep(name = "score_starpls_lsp", version = "0.1.0", dev_dependency = True)
# 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_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")

# S-CORE process rules
bazel_dep(name = "score_bazel_platforms", version = "0.0.4")
bazel_dep(name = "score_tooling", version = "1.1.0")
bazel_dep(name = "score_rust_policies", version = "0.0.3")

# Toolchains and extensions
bazel_dep(name = "rules_rust", version = "0.61.0")
git_override(
module_name = "rules_rust",
commit = "293337fd6402ec3dfbeb8f2d589f38ad9124dadd",
remote = "https://github.com/pawelrutkaq/rules_rust.git", # To be fixed once rule_rust is in score bazel registry
)

# Python rules.
bazel_dep(name = "rules_python", version = "1.7.0", 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.7.0", dev_dependency = True)

# Others
gcc = use_extension("@score_bazel_cpp_toolchains//extensions:gcc.bzl", "gcc", dev_dependency = True)
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_gcc_aarch64_toolchain",
target_cpu = "aarch64",
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",
)
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",
)
use_repo(
gcc,
"score_gcc_aarch64_toolchain",
"score_gcc_x86_64_toolchain",
"score_qcc_aarch64_toolchain",
"score_qcc_x86_64_toolchain",
)

PYTHON_VERSION = "3.12"

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

# Rust rules.
bazel_dep(name = "rules_rust", version = "0.67.0")

# C/C++ rules.
bazel_dep(name = "rules_cc", version = "0.2.14")

# Rust module dependencies.
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2021",
versions = ["1.85.0"],
)

# Json for C++.
bazel_dep(name = "nlohmann_json", version = "3.12.0")

# Score Rust crates.
bazel_dep(name = "score_crates", version = "0.0.6")
# S-CORE crates
bazel_dep(name = "score_crates", version = "0.0.7")
79 changes: 79 additions & 0 deletions scripts/internal/qnx_creds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/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}"],
}
}
)
)
Loading