Skip to content
Open
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
Binary file added .DS_Store
Binary file not shown.
95 changes: 88 additions & 7 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,94 @@
common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/
common --registry=https://bcr.bazel.build

build --java_language_version=17
build --tool_java_language_version=17
build --java_runtime_version=remotejdk_17
build --tool_java_runtime_version=remotejdk_17
build --credential_helper="*.qnx.com=%workspace%/.github/tools/qnx_credential_helper.py"

#Baselibs flags
build --@score_baselibs//score/json:base_library=nlohmann
build --@score_baselibs//score/mw/log/flags:KRemote_Logging=False

# Clippy linting (enabled by default)
build --aspects=@score_rust_policies//clippy:linters.bzl%clippy_strict
build --output_groups=+rules_lint_human
build:lint --@aspect_rules_lint//lint:fail_on_violation=true

test --test_output=errors


# Target configuration for CPU:x86-64|OS:Linux build (do not use it in case of system toolchains!)
#build:x86_64-linux --config=_bl_stub
#build:x86_64-linux --config=_bl_toolchain_common
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
test:x86_64-linux --config=_common

# Target configuration for CPU:AArch64|OS:Linux build (do not use it in case of system toolchains!)
#build:aarch64-linux --config=_bl_stub
#build:aarch64-linux --config=_bl_toolchain_common
build:aarch64-linux --config=_common
build:aarch64-linux --platforms=@score_bazel_platforms//:aarch64-linux-gcc_12.2.0-posix
build:aarch64-linux --extra_toolchains=@score_gcc_aarch64_toolchain//:aarch64-linux-gcc_12.2.0-posix
test:aarch64-linux --config=_common


# Target configuration for CPU:x86-64|OS:QNX build (do not use it in case of system toolchains!)
#build:x86_64-qnx --config=_bl_stub
#build:x86_64-qnx --config=_bl_toolchain_common
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
test:x86_64-qnx --config=_common

# Target configuration for CPU:AArch64|OS:QNX build (do not use it in case of system toolchains!)
#build:aarch64-qnx --config=_bl_stub
#build:aarch64-qnx --config=_bl_toolchain_common
build:aarch64-qnx --config=_common
build:aarch64-qnx --incompatible_strict_action_env
build:aarch64-qnx --platforms=@score_bazel_platforms//:aarch64-qnx-sdp_8.0.0-posix
build:aarch64-qnx --extra_toolchains=@score_qcc_aarch64_toolchain//:aarch64-qnx-sdp_8.0.0-posix
test:aarch64-qnx --config=_common

# Target configuration for CPU:AArch64|OS:QNX build with Ferrocene Rust toolchain (do not use it in case of system toolchains!)
build:per-arm64-qnx --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_aarch64_unknown_nto_qnx800

coverage --features=coverage
coverage --combined_report=lcov
coverage --cache_test_results=no

# Sanitizer configuration for C++
test:asan_ubsan_lsan --features=asan
test:asan_ubsan_lsan --features=ubsan
test:asan_ubsan_lsan --features=lsan
test:asan_ubsan_lsan --copt -g3
test:asan_ubsan_lsan --platform_suffix=asan_ubsan_lsan
test:asan_ubsan_lsan --test_env=ASAN_OPTIONS="exitcode=55 allow_addr2line=1 verbosity=1 coverage=1 check_initialization_order=1 detect_stack_use_after_return=1 print_stats=1 halt_on_error=1 allocator_may_return_null=1 detect_leaks=1"
test:asan_ubsan_lsan --test_env=UBSAN_OPTIONS="exitcode=55 allow_addr2line=1 verbosity=1 coverage=1 print_stacktrace=1 halt_on_error=1"

# -------------------------------------------------------------------------------
# Ferrocene Rust coverage config
# -------------------------------------------------------------------------------
build:ferrocene-coverage --@rules_rust//rust/settings:extra_rustc_flag=-Cinstrument-coverage
build:ferrocene-coverage --@rules_rust//rust/settings:extra_rustc_flag=-Clink-dead-code
build:ferrocene-coverage --@rules_rust//rust/settings:extra_rustc_flag=-Ccodegen-units=1
build:ferrocene-coverage --@rules_rust//rust/settings:extra_rustc_flag=-Cdebuginfo=2
build:ferrocene-coverage --@rules_rust//rust/settings:extra_exec_rustc_flag=-Cinstrument-coverage
build:ferrocene-coverage --@rules_rust//rust/settings:extra_exec_rustc_flag=-Clink-dead-code
build:ferrocene-coverage --@rules_rust//rust/settings:extra_exec_rustc_flag=-Ccodegen-units=1
build:ferrocene-coverage --@rules_rust//rust/settings:extra_exec_rustc_flag=-Cdebuginfo=2
test:ferrocene-coverage --run_under=@score_tooling//coverage:llvm_profile_wrapper

# -------------------------------------------------------------------------------
# Import local user workspace file, if exists
# -------------------------------------------------------------------------------
try-import %workspace%/user.bazelrc


# Build stamping for version info
build --workspace_status_command=$(pwd)/bazel_stamp_vars.sh

Expand All @@ -26,10 +114,3 @@ build:_common --cxxopt=-Wno-error=deprecated-declarations

# Host platform build configuration
build:host --config=_common

build:x86_64-qnx --config=_common
build:x86_64-qnx --noexperimental_merged_skyframe_analysis_execution
build:x86_64-qnx --incompatible_enable_cc_toolchain_resolution
build:x86_64-qnx --incompatible_strict_action_env
build:x86_64-qnx --platforms=@score_bazel_platforms//:x86_64-qnx
build:x86_64-qnx --extra_toolchains=@toolchains_qnx_qcc//:qcc_x86_64
1 change: 1 addition & 0 deletions .bazelrc.user
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build --action_env=APE_NO_MODIFY_SELF=1
16 changes: 14 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
{
"name": "eclipse-s-core",
"image": "ghcr.io/eclipse-score/devcontainer:v1.1.0"
}
"image": "ghcr.io/eclipse-score/devcontainer:v1.2.0",
"runArgs": [
"--dns=8.8.8.8",
"--dns=8.8.4.4",
"--privileged"
],
"capAdd": [
"SYS_PTRACE"
] // NOTE: APE (Actually Portable Executable) binaries used by Bazel may not work
// in Docker Desktop on macOS/Windows due to linuxkit kernel incompatibility.
// If you experience "assimilate" segfaults:
// - Use WSL2 with native Docker (not Docker Desktop)
// - Run Bazel on the host system instead
// - Rely on CI for format checks}
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,23 @@

name: Scrample Build
on:
pull_request_target:
pull_request:
types: [opened, reopened, synchronize]
merge_group:
types: [checks_requested]
jobs:
qnx-build:
strategy:
fail-fast: false
matrix:
bazel-config: [x86_64-qnx, aarch64-qnx]
uses: eclipse-score/cicd-workflows/.github/workflows/qnx-build.yml@main
permissions:
contents: read
pull-requests: read
with:
bazel-target: "//src:scrample"
bazel-config: "x86_64-qnx"
bazel-target: "//score/..."
bazel-config: ${{ matrix.bazel-config }}
credential-helper: ".github/tools/qnx_credential_helper.py"
environment-name: "workflow-approval"
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/debug-qnx-helper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

chmod +x "${CRED_HELPER}"

PAYLOAD='{"uri": "https://fusion.qnx.com/8/79858/installation.tgz"}'
PAYLOAD='{"uri": "https://fusion.qnx.com/6/85936/installation_qnx_803_260203.tar.xz?tid=3631642_wE_0220075214&ending=installation_qnx_803_260203.tar.xz"}'

echo "Running helper with timeout 30s..."
START=$(date +%s)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release_verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ jobs:
SCORE_QNX_USER: ${{ secrets.SCORE_QNX_USER }}
SCORE_QNX_PASSWORD: ${{ secrets.SCORE_QNX_PASSWORD }}
run: |
bazel build --config x86_64-qnx --credential_helper=*.qnx.com=${{ github.workspace }}/.github/tools/qnx_credential_helper.py -- \
//src:scrample
bazel build --config=x86_64-qnx --credential_helper=*.qnx.com=${{ github.workspace }}/.github/tools/qnx_credential_helper.py -- \
//score/src:scrample
- name: Cleanup QNX License
if: always()
run: rm -rf /opt/score_qnx
Expand Down
3 changes: 1 addition & 2 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ copyright_checker(
name = "copyright",
srcs = [
"feo/ad-demo",
"score",
"scorex",
"src",
"tests",
"//:BUILD",
"//:MODULE.bazel",
],
Expand Down
119 changes: 77 additions & 42 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
# *******************************************************************************
module(
name = "score_scrample",
version = "0.1.0",
version = "0.0.0",
compatibility_level = 0,
)

# Configure and register the python toolchain.
bazel_dep(name = "rules_python", version = "1.4.1")
bazel_dep(name = "rules_python", version = "1.8.3")

PYTHON_VERSION = "3.12"

Expand All @@ -27,28 +28,67 @@ python.toolchain(
)
use_repo(python, "python_versions")

# Configure the target toolchain.
bazel_dep(name = "score_toolchains_qnx", version = "0.0.2", dev_dependency = True)

qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx", dev_dependency = True)
qnx.sdp(
sha256 = "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63",
strip_prefix = "installation",
url = "https://www.qnx.com/download/download/79858/installation.tgz",
## Configure the C++ toolchain

bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.2.2", dev_dependency = True)

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",
)
use_repo(qnx, "toolchains_qnx_sdp")
use_repo(qnx, "toolchains_qnx_qcc")

# register_toolchains("@toolchains_qnx_qcc//:qcc_x86_64")

# Add GoogleTest dependency
bazel_dep(name = "googletest", version = "1.17.0")
bazel_dep(name = "googletest", version = "1.17.0.bcr.2")
bazel_dep(name = "google_benchmark", version = "1.9.5")

# rust
bazel_dep(name = "rules_rust", version = "0.67.0")
git_override(
module_name = "rules_rust",
commit = "2b171a7376e69cb1207eced1f66904ce4ae0c819",
remote = "https://github.com/pawelrutkaq/rules_rust.git", # To be fixed once rule_rust is in score bazel registry
)

# Shared Rust policies (Clippy config, etc.), overridden locally during development.
bazel_dep(name = "score_rust_policies", version = "0.0.5", dev_dependency = True)

# Add Rust rules for Rust tests
bazel_dep(name = "rules_rust", version = "0.61.0")

rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(edition = "2021")

# Add boost dependency
bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost")
Expand All @@ -61,27 +101,30 @@ archive_override(
bazel_dep(name = "boost.program_options", version = "1.87.0")

# C/C++ rules for Bazel
bazel_dep(name = "rules_cc", version = "0.2.1")
bazel_dep(name = "rules_cc", version = "0.2.16")

# tooling
bazel_dep(name = "score_tooling", version = "1.0.5")
bazel_dep(name = "score_rust_policies", version = "0.0.3")
bazel_dep(name = "aspect_rules_lint", version = "1.5.3")
bazel_dep(name = "score_tooling", version = "1.1.2")
bazel_dep(name = "aspect_rules_lint", version = "2.0.0")
bazel_dep(name = "buildifier_prebuilt", version = "8.2.0.2")

#docs-as-code
bazel_dep(name = "score_docs_as_code", version = "2.3.3")
bazel_dep(name = "score_process", version = "1.4.2")
bazel_dep(name = "score_baselibs", version = "0.1.3")
bazel_dep(name = "score_communication", version = "0.1.1")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "score_bazel_platforms", version = "0.0.2")
bazel_dep(name = "score_logging", version = "0.0.3")
bazel_dep(name = "score_process", version = "1.4.3")
bazel_dep(name = "score_baselibs", version = "0.2.4")
git_override(
module_name = "score_logging",
commit = "9ed6a88cab10a81bf6b0813712cbd7b9fc7e44c5",
remote = "https://github.com/eclipse-score/logging.git",
module_name = "score_baselibs",
commit = "6951cd2a3045fb7a053acf203833a17704c22ccf",
remote = "https://github.com/eclipse-score/baselibs.git",
)
bazel_dep(name = "score_communication", version = "0.1.2")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "score_bazel_platforms", version = "0.0.4")
bazel_dep(name = "score_logging", version = "0.1.0")
#git_override(
# module_name = "score_logging",
# commit = "9ed6a88cab10a81bf6b0813712cbd7b9fc7e44c5",
# remote = "https://github.com/eclipse-score/logging.git",
#)

# TRLC dependency for requirements traceability
bazel_dep(name = "trlc", version = "0.0.0")
Expand Down Expand Up @@ -144,18 +187,10 @@ crate.from_cargo(
)
use_repo(crate, "ad-demo-local-crates")

# Override feo's dependency on score_docs_as_code to use 2.3.3
single_version_override(
module_name = "score_docs_as_code",
version = "2.3.3",
)
bazel_dep(name = "score_docs_as_code", version = "3.0.0")

bazel_dep(name = "score_feo", version = "1.0.5")

bazel_dep(name = "feo", version = "1.0.1")
git_override(
module_name = "feo",
commit = "05702d0a386daf23912c26ccb2b35b584d3a9e8c",
remote = "https://github.com/eclipse-score/feo.git",
)

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ SCRAMPLE consists of two operational modes:

### Standard Build (Host Platform)
```bash
bazel build --config=host //src:scrample
bazel build --config=host //score/src:scrample
```

### QNX Cross-Compilation
```bash
bazel build --config=x86_64-qnx //src:scrample
bazel build --config=x86_64-qnx //score/src:scrample
```

### Build All Tests
Expand Down Expand Up @@ -192,12 +192,12 @@ The project includes example tests demonstrating the testing infrastructure:

Run all tests:
```bash
bazel test --config=host //tests/...
bazel test --config=host //score/tests/...
```

Run all tests and format checks:
```bash
bazel test --config=host //tests/... //:format.check
bazel test --config=host //score/tests/... //:format.check
```

## Contributing
Expand Down
1 change: 1 addition & 0 deletions cicd-workflows
Submodule cicd-workflows added at 773e90
4 changes: 4 additions & 0 deletions examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ filegroup(
srcs = [
"Cargo.lock",
],
tags = ["no-clippy"],
target_compatible_with = [
"@platforms//os:linux",
],
visibility = ["//visibility:public"],
)
Binary file added feo/.DS_Store
Binary file not shown.
Loading
Loading