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
23 changes: 23 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,26 @@ test:asan_ubsan_lsan --build_tests_only
build:asan --config=asan_ubsan_lsan
build:ubsan --config=asan_ubsan_lsan
build:lsan --config=asan_ubsan_lsan

# Clang-Format
build:clang_format --output_groups=clang_format_output
build:clang_format --aspects=@score_bazel_tools_cc//quality:defs.bzl%clang_format_aspect
build:clang_format --@score_bazel_tools_cc//quality:clang_format_config=//:clang_format_config
build:clang_format --config=x86_64-linux
build:clang_format --host_platform=@platforms//host
build:clang_format --platforms=@platforms//host
build:clang_format --extra_toolchains=@llvm_toolchain//:all

# Clang-Tidy
build:clang_tidy --config=stub
build:clang_tidy --config=x86_64-linux
build:clang_tidy --@score_bazel_tools_cc//quality:quality_clang_tidy_config=//:clang_tidy_config
build:clang_tidy --aspects=@score_bazel_tools_cc//quality:defs.bzl%quality_clang_tidy_aspect
build:clang_tidy --build_tag_filters="-tidy_suite"
build:clang_tidy --force_pic
build:clang_tidy --incompatible_enable_cc_toolchain_resolution
build:clang_tidy --output_groups=clang_tidy_output
build:clang_tidy --verbose_failures
build:clang_tidy --extra_toolchains=@llvm_toolchain//:all
build:clang_tidy --host_platform=@platforms//host
build:clang_tidy --platforms=@platforms//host
48 changes: 0 additions & 48 deletions .clang-format

This file was deleted.

2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Checks: ' -*, bugprone-*, cert-*, clang-analyzer-core.*, clang-analyzer-cplusplus.*, clang-analyzer-security.*, cppcoreguidelines-pro-bounds-pointer-arithmetic, cppcoreguidelines-pro-type-cstyle-cast, hicpp-* '
WarningsAsErrors: 'bugprone-*,cert-*,clang-analyzer-*,hicpp-*'
5 changes: 5 additions & 0 deletions .clang_format
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
BasedOnStyle: Google
ColumnLimit: 120
IndentWidth: 4
---
12 changes: 5 additions & 7 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
Expand All @@ -12,16 +12,14 @@
# *******************************************************************************

name: Formatting checks

permissions:
contents: read
actions: write
on:
pull_request:
types: [opened, reopened, synchronize]
merge_group:
types: [checks_requested]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
formatting-check:
uses: eclipse-score/cicd-workflows/.github/workflows/format.yml@c1c90b1a82a1fab0fc202979dde6686b2162d5a8 # v0.0.0
with:
bazel-target: "test --lockfile_mode=error //:format.check" # optional, this is the default
uses: eclipse-score/cicd-workflows/.github/workflows/format.yml@f57b605a284ca117bcfd9f83ea427096faaac7d1
53 changes: 53 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# *******************************************************************************
# 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
# *******************************************************************************

repos:
- repo: local
hooks:
- id: copyright-fix
name: //:copyright-fix
entry: bazel run //:copyright-fix
language: system
pass_filenames: false
- id: format-fix
name: //:format.fix
entry: bazel run //:format.fix
language: system
files: (BUILD|BUILD\.bazel|WORKSPACE|\.bazelrc|[^/]+\.(py|bzl|bazel|yaml|yml|rs))$
pass_filenames: false
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: clang-format
entry: bazel build --config=clang_format --keep_going --features=refactor //...
files: '\.(c|cc|cpp|h|hpp)$'
# all relevant files are currently excluded
exclude: |
(?x)^(
externals/|
examples/|
tests/|
score/
)
- id: clang-tidy
entry: bazel build --config=clang_tidy //...
language: system
files: '\.(c|cc|cpp|h|hpp)$'
# all relevant files are currently excluded
exclude: |
(?x)^(
externals/|
examples/|
tests/|
score/
)
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"label": "Refresh compile_commands.json",
"type": "shell",
"isBackground": true,
"command": "bazel run @hedron_compile_commands//:refresh_all",
"command": "bazel run //:generate_compile_commands -- --config=x86_64-linux",
"problemMatcher": [],
"group": {
"kind": "build",
Expand Down
66 changes: 66 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,55 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
load("@score_bazel_tools_cc//quality:defs.bzl", "clang_format_config", "quality_clang_tidy_config")
load("@score_docs_as_code//:docs.bzl", "docs")
load("@score_tooling//:defs.bzl", "copyright_checker", "dash_license_checker", "rust_coverage_report", "setup_starpls", "use_format_targets")
load("//:project_config.bzl", "PROJECT_CONFIG")

# Generate `compile_commands.json`.
# Required for `clangd` support.
refresh_compile_commands(
name = "generate_compile_commands",
exclude_external_sources = True,
target_compatible_with = ["@platforms//os:linux"],
targets = {
"//...": "",
},
)

quality_clang_tidy_config(
name = "clang_tidy_config",
additional_flags = [],
clang_tidy_binary = "@llvm_toolchain//:clang-tidy",
default_feature = "strict",
dependency_attributes = [
"deps",
"srcs",
],
excludes = ["external/"],
feature_mapping = {
"//:.clang-tidy": "strict",
},
target_types = [
"cc_library",
],
unsupported_flags = [],
visibility = ["//visibility:public"],
)

clang_format_config(
name = "clang_format_config",
config_file = "//:.clang_format",
excludes = ["external/"],
target_types = [
"cc_binary",
"cc_library",
],
visibility = ["//visibility:public"],
)

# In order to update the requirements, change the `requirements.in` file and run:
# `bazel run //:requirements.update`.
# This will update the `requirements_lock.txt` file.
Expand Down Expand Up @@ -45,12 +89,34 @@ setup_starpls(
copyright_checker(
name = "copyright",
srcs = [
".github",
"docs",
"examples",
"externals",
"score",
"scripts",
"tests",
"//:BUILD",
"//:MODULE.bazel",
],
config = "@score_tooling//cr_checker/resources:config",
exclusion = "//:cr_checker_exclusion",
extensions = [
"bazel",
"BUILD",
"bzl",
"c",
"cpp",
"h",
"hpp",
"ini",
"py",
"rs",
"rst",
"sh",
"yaml",
"yml",
],
template = "@score_tooling//cr_checker/resources:templates",
visibility = ["//visibility:public"],
)
Expand Down
34 changes: 31 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ bazel_dep(name = "rules_python", version = "1.8.5")
bazel_dep(name = "rules_rust", version = "0.68.2-score")
bazel_dep(name = "rules_cc", version = "0.2.17")
bazel_dep(name = "rules_oci", version = "2.3.0")
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "aspect_rules_lint", version = "2.3.0")
bazel_dep(name = "buildifier_prebuilt", version = "8.5.1")
bazel_dep(name = "platforms", version = "1.0.0")
Expand All @@ -39,6 +40,20 @@ bazel_dep(name = "score_rust_policies", version = "0.0.5", dev_dependency = True
bazel_dep(name = "score_cpp_policies", version = "0.0.1", dev_dependency = True)
bazel_dep(name = "score_process", version = "1.6.0", dev_dependency = True)
bazel_dep(name = "score_platform", version = "0.6.0", dev_dependency = True)
bazel_dep(name = "score_bazel_tools_cc", version = "0.1.0", dev_dependency = True)
single_version_override(
module_name = "score_bazel_tools_cc",
patch_strip = 0,
patches = ["//patches:score_bazel_tools.patch"],
version = "0.1.0",
)

single_version_override(
module_name = "score_bazel_tools_python",
patch_strip = 0,
patches = ["//patches:score_bazel_tools_python.patch"],
version = "0.1.3",
)

## Configure the C++ toolchain
bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.5.4", dev_dependency = True)
Expand Down Expand Up @@ -84,6 +99,18 @@ use_repo(
"score_qcc_x86_64_toolchain_pkg",
)

# LLVM toolchain.
bazel_dep(name = "toolchains_llvm", version = "1.4.0")

llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(
llvm_version = "15.0.2",
stdlib = {"linux-x86_64": "stdc++"},
)
use_repo(llvm, "llvm_toolchain")

register_toolchains("@llvm_toolchain//:all")

# UTs on QNX
bazel_dep(name = "score_qnx_unit_tests", version = "0.2.0", dev_dependency = True)
bazel_dep(name = "score_rules_imagefs", version = "0.0.3", dev_dependency = True)
Expand Down Expand Up @@ -165,8 +192,9 @@ bazel_dep(name = "score_baselibs", version = "0.2.9")
bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
git_override(
module_name = "hedron_compile_commands",
commit = "0e990032f3c5a866e72615cf67e5ce22186dcb97",
commit = "abb61a688167623088f8768cc9264798df6a9d10",
patch_strip = 1,
# Patch for support for Bazel 8.6.0.
patches = ["//patches:hedron_compile_commands_env_vars.patch"],
remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git",
# Replace the commit hash (above) with the latest (https://github.com/hedronvision/bazel-compile-commands-extractor/commits/main).
# Even better, set up Renovate and let it do the work for you (see "Suggestion: Updates" in the README).
)
Loading
Loading