Skip to content
Draft
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
48 changes: 13 additions & 35 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

# Sanitizer and clang-tidy flags from score_cpp_policies
import %workspace%/tools/preset.bazelrc

build --java_language_version=17
build --tool_java_language_version=17
build --java_runtime_version=remotejdk_17
Expand Down Expand Up @@ -111,43 +114,18 @@ coverage --cxxopt=-fprofile-update=atomic
# Dynamic analysis (sanitizers) for Linux host builds/tests
# ==============================================================================

# Debug symbols for sanitizer stack traces
test:with_debug_symbols --cxxopt=-g1
test:with_debug_symbols --strip=never

# AddressSanitizer + UndefinedBehaviorSanitizer + LeakSanitizer (Combined)
build:asan_ubsan_lsan --config=x86_64-linux
build:asan_ubsan_lsan --features=asan
build:asan_ubsan_lsan --features=ubsan
build:asan_ubsan_lsan --features=lsan
build:asan_ubsan_lsan --platform_suffix=asan_ubsan_lsan
test:asan_ubsan_lsan --config=with_debug_symbols
build:asan --config=x86_64-linux
build:ubsan --config=x86_64-linux
build:lsan --config=x86_64-linux
build:tsan --config=x86_64-linux

test:asan_ubsan_lsan --test_tag_filters=-no-asan,-no-lsan,-no-ubsan
test:asan_ubsan_lsan --@score_cpp_policies//sanitizers/flags:sanitizer=asan_ubsan_lsan
test:asan_ubsan_lsan --run_under=@score_cpp_policies//sanitizers:wrapper

# Shortcuts for individual sanitizers
build:asan --config=asan_ubsan_lsan
test:asan --test_tag_filters=-no-asan
build:ubsan --config=asan_ubsan_lsan
test:ubsan --test_tag_filters=-no-ubsan
build:lsan --config=asan_ubsan_lsan
test:lsan --test_tag_filters=-no-lsan

# ThreadSanitizer (cannot be combined with ASan/LSan)
build:tsan --config=x86_64-linux
build:tsan --features=tsan
build:tsan --platform_suffix=tsan
test:asan --test_tag_filters=-no-asan
test:ubsan --test_tag_filters=-no-ubsan
test:lsan --test_tag_filters=-no-lsan
test:tsan --test_tag_filters=-no-tsan

# GCC 12 promotes TSan limitation on atomic_thread_fence to -Werror=tsan.
# Downgrade to warning so external deps (score_baselibs) compile; TSan still runs.
build:tsan --cxxopt=-Wno-error=tsan
test:tsan --config=with_debug_symbols
test:tsan --cxxopt=-O1
test:tsan --test_tag_filters=-no-tsan
test:tsan --@score_cpp_policies//sanitizers/flags:sanitizer=tsan
test:tsan --run_under=@score_cpp_policies//sanitizers:wrapper

# Clang-tidy: bazel test --config=clang-tidy //score/...
test:clang-tidy --aspects=//tools/lint:linters.bzl%clang_tidy_aspect
test:clang-tidy --output_groups=+rules_lint_report
test:clang-tidy --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux
23 changes: 21 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ bazel_dep(name = "rules_cc", version = "0.2.17")
bazel_dep(name = "aspect_rules_lint", version = "2.5.0")

bazel_dep(name = "score_cpp_policies", version = "0.0.0", dev_dependency = True)

# FIXME: pinned to score_cpp_policies#13, switch to upstream once merged.
git_override(
module_name = "score_cpp_policies",
commit = "b6551c217fbb0daf948b493c4ba69eb7fe8359a5",
remote = "https://github.com/eclipse-score/score_cpp_policies.git",
commit = "b2bec2a914d358606aac3fc29f861a63ce1a5d92",
remote = "https://github.com/RSingh1511/score_cpp_policies.git",
)

bazel_dep(name = "bazelrc-preset.bzl", version = "1.9.2", dev_dependency = True)
bazel_dep(name = "toolchains_llvm", version = "1.7.0", dev_dependency = True)

bazel_dep(name = "buildifier_prebuilt", version = "8.5.1")
Expand Down Expand Up @@ -88,6 +91,15 @@ use_repo(oci, "ubuntu_24_04", "ubuntu_24_04_linux_amd64")

# Toolchains and extensions
bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.5.1", dev_dependency = True)

# FIXME: pinned to eclipse-score/bazel_cpp_toolchains#52 (adds extra_known_features to
# gcc.toolchain). Drop this override and bump to the release version once that PR merges.
git_override(
module_name = "score_bazel_cpp_toolchains",
commit = "c78d5e9f936e3c9d8791e420925d8b36c2564e52",
remote = "https://github.com/eclipse-score/bazel_cpp_toolchains.git",
)

bazel_dep(name = "score_toolchains_rust", version = "0.8.0", dev_dependency = True)

# S-CORE crates
Expand Down Expand Up @@ -116,6 +128,13 @@ gcc.toolchain(
target_os = "linux",
use_default_package = True,
version = "12.2.0",
extra_known_features = [
"@score_cpp_policies//sanitizers/features:asan",
"@score_cpp_policies//sanitizers/features:ubsan",
"@score_cpp_policies//sanitizers/features:lsan",
"@score_cpp_policies//sanitizers/features:tsan",
"@score_cpp_policies//sanitizers/features:debug_symbols",
],
)
gcc.toolchain(
name = "score_qcc_x86_64_toolchain",
Expand Down
26 changes: 22 additions & 4 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# *******************************************************************************
# Copyright (c) 2026 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
# *******************************************************************************

load("@bazelrc-preset.bzl", "bazelrc_preset")
load("@score_cpp_policies//:presets.bzl", "PRESETS")

# Generates tools/preset.bazelrc, imported by the root .bazelrc.
bazelrc_preset(
name = "preset",
extra_presets = PRESETS,
)
Loading
Loading