Skip to content

Commit d572882

Browse files
authored
feat: bazel build (#285)
1 parent ab519e9 commit d572882

File tree

363 files changed

+40254
-34238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

363 files changed

+40254
-34238
lines changed

.bazeliskrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
BAZELISK_BASE_URL=https://static.aspect.build/aspect
2+
USE_BAZEL_VERSION=aspect/2025.15.20
3+

.bazelrc

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# =============================================================================
2+
# Common Settings
3+
# =============================================================================
4+
# TODO: Figure out how to use platform specific config
5+
# common --enable_platform_specific_config
6+
# TODO: Add flag for checking empty globs.
7+
# This makes sure bazel doesn't implicitly create missing __init__.py files.
8+
build --incompatible_default_to_explicit_init_py
9+
build --experimental_isolated_extension_usages
10+
11+
# =============================================================================
12+
# Build Performance
13+
# =============================================================================
14+
build --jobs=auto
15+
build --experimental_remote_merkle_tree_cache
16+
build --experimental_remote_cache_compression
17+
build --experimental_remote_cache_async
18+
build --experimental_guard_against_concurrent_changes
19+
build --experimental_reuse_sandbox_directories
20+
21+
# =============================================================================
22+
# Developer Experience
23+
# =============================================================================
24+
build --show_progress_rate_limit=0.5
25+
build --color=yes
26+
build --terminal_columns=120
27+
build --show_timestamps
28+
build --announce_rc # Show which config files are read
29+
build --heap_dump_on_oom # Dump heap on out-of-memory
30+
test --test_output=all # Show all test output in real time
31+
32+
# =============================================================================
33+
# C++ Compiler Settings
34+
# =============================================================================
35+
# Base C++ options
36+
build --cxxopt=-std=c++20
37+
build --host_cxxopt=-std=c++20
38+
39+
# LLVM/Clang toolchain
40+
build --incompatible_enable_cc_toolchain_resolution
41+
build:darwin --extra_toolchains=@llvm_toolchain//:cc-toolchain-aarch64-darwin
42+
build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux
43+
44+
# =============================================================================
45+
# Default Optimization Settings (Release Mode)
46+
# =============================================================================
47+
build --compilation_mode=opt
48+
build --copt=-O3
49+
build --copt=-march=native
50+
build --copt=-DNDEBUG
51+
# TODO This causes a linker error on linux
52+
# build --copt=-flto
53+
build --linkopt=-flto
54+
build --strip=always
55+
build --copt=-ffast-math
56+
build --copt=-mtune=native
57+
58+
# =============================================================================
59+
# Build Configurations
60+
# =============================================================================
61+
# Debug Configuration
62+
build:debug --compilation_mode=dbg
63+
build:debug --copt=-g3
64+
build:debug --strip=never
65+
build:debug --copt=-fno-omit-frame-pointer
66+
build:debug --copt=-DDEBUG
67+
build:debug --sandbox_debug
68+
build:debug --verbose_failures
69+
# Disable optimizations in debug mode
70+
build:debug --copt=-O0
71+
build:debug --copt=-fno-fast-math
72+
build:debug --copt=-fno-lto
73+
build:debug --linkopt=-fno-lto
74+
75+
# Development Configuration (Debug with extras)
76+
build:dev --config=debug
77+
build:dev --compilation_mode=dbg
78+
build:dev --strip=never
79+
80+
# Release Configuration (explicit)
81+
build:release --compilation_mode=opt
82+
build:release --copt=-O3
83+
build:release --copt=-DNDEBUG
84+
build:release --strip=always
85+
86+
# =============================================================================
87+
# Sanitizer Configurations
88+
# =============================================================================
89+
# Address Sanitizer
90+
build:asan --strip=never
91+
build:asan --copt=-fsanitize=address
92+
build:asan --copt=-DADDRESS_SANITIZER
93+
build:asan --copt=-O1
94+
build:asan --copt=-fno-omit-frame-pointer
95+
build:asan --linkopt=-fsanitize=address
96+
97+
# Thread Sanitizer
98+
build:tsan --strip=never
99+
build:tsan --copt=-fsanitize=thread
100+
build:tsan --copt=-DTHREAD_SANITIZER
101+
build:tsan --copt=-O1
102+
build:tsan --copt=-fno-omit-frame-pointer
103+
build:tsan --linkopt=-fsanitize=thread
104+
105+
# Memory Sanitizer
106+
build:msan --strip=never
107+
build:msan --copt=-fsanitize=memory
108+
build:msan --copt=-DMEMORY_SANITIZER
109+
build:msan --copt=-O1
110+
build:msan --copt=-fno-omit-frame-pointer
111+
build:msan --linkopt=-fsanitize=memory
112+
113+
# Undefined Behavior Sanitizer
114+
build:ubsan --strip=never
115+
build:ubsan --copt=-fsanitize=undefined
116+
build:ubsan --copt=-DUNDEFINED_BEHAVIOR_SANITIZER
117+
build:ubsan --copt=-O1
118+
build:ubsan --copt=-fno-omit-frame-pointer
119+
build:ubsan --linkopt=-fsanitize=undefined
120+
121+
# =============================================================================
122+
# Platform Specific Settings
123+
# =============================================================================
124+
# Darwin (macOS) Settings
125+
build:darwin --cxxopt=-mmacosx-version-min=15.2
126+
build:darwin --linkopt=-mmacosx-version-min=15.2
127+
build:darwin --action_env=CC=clang
128+
build:darwin --action_env=CXX=clang++
129+
130+
# Linux Settings
131+
build:linux --action_env=CC=clang
132+
build:linux --action_env=CXX=clang++
133+
build:linux --action_env=LD=clang
134+
build:linux --action_env=LDXX=clang++
135+
build:linux --cxxopt=-D_LINUX
136+
build:linux --copt=-fPIC
137+
# CUDA Settings (A6000, A100, H100)
138+
build:linux --@rules_cuda//cuda:archs=compute_80,sm_80,compute_86,sm_86,compute_90,sm_90
139+
140+
# Windows Settings
141+
build:windows --cxxopt=/D_WINDOWS
142+
143+
# =============================================================================
144+
# Import Local Settings
145+
# =============================================================================
146+
try-import %workspace%/.bazelrc.local

.bazelrc.local

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
###############################################################################
2+
# Local-only builds — no remote interaction
3+
build:local --disk_cache=~/.cache/bazel
4+
5+
###############################################################################
6+
# Local builds + remote cache (shared cache only, for reuse)
7+
build:remote_cache --remote_cache=http://gorgophone.rhpc.nki.nl:8080
8+
build:remote_cache --remote_timeout=60
9+
build:remote_cache --remote_accept_cached=true
10+
build:remote_cache --remote_upload_local_results=true
11+
build:remote_cache --remote_download_outputs=minimal
12+
build:remote_cache --remote_local_fallback=false
13+
###############################################################################
14+
# Fully remote builds (remote execution + remote cache)
15+
build:remote_build --remote_executor=grpc://gorgophone.rhpc.nki.nl:8980
16+
build:remote_build --remote_cache=grpc://gorgophone.rhpc.nki.nl:8980
17+
build:remote_build --remote_timeout=60
18+
build:remote_build --remote_accept_cached=true
19+
build:remote_build --remote_upload_local_results=true
20+
build:remote_build --remote_download_outputs=minimal
21+
22+
# Optionally only offload specific strategies (customizable)
23+
build:remote_build --spawn_strategy=remote
24+
build:remote_build --strategy=CppCompile=remote
25+
build:remote_build --strategy=Javac=remote
26+
build:remote_build --strategy=GoCompile=remote

.bazelrc.local.example

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
###############################################################################
2+
# Local-only builds — no remote interaction
3+
build:local --disk_cache=~/.cache/bazel
4+
5+
###############################################################################
6+
# Local builds + remote cache (shared cache only, for reuse)
7+
build:remote_cache --remote_cache=http://gorgophone.rhpc.nki.nl:8080
8+
build:remote_cache --remote_timeout=60
9+
build:remote_cache --remote_accept_cached=true
10+
build:remote_cache --remote_upload_local_results=true
11+
build:remote_cache --remote_download_outputs=minimal
12+
build:remote_cache --remote_local_fallback=false
13+
###############################################################################
14+
# Fully remote builds (remote execution + remote cache)
15+
build:remote_build --remote_executor=grpc://gorgophone.rhpc.nki.nl:8980
16+
build:remote_build --remote_cache=grpc://gorgophone.rhpc.nki.nl:8980
17+
build:remote_build --remote_timeout=60
18+
build:remote_build --remote_accept_cached=true
19+
build:remote_build --remote_upload_local_results=true
20+
build:remote_build --remote_download_outputs=minimal
21+
22+
# Optionally only offload specific strategies (customizable)
23+
build:remote_build --spawn_strategy=remote
24+
build:remote_build --strategy=CppCompile=remote
25+
build:remote_build --strategy=Javac=remote
26+
build:remote_build --strategy=GoCompile=remote

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.6.1

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
4+
title: ""
55
labels: bug
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
**Describe the bug**

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: ''
4+
title: ""
55
labels: enhancement
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
**Is your feature request related to a problem? Please describe.**

.github/labeler.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
python:
22
- "**/*.py"
33
- "*.py"
4-
54
documentation:
65
- "**/*.md"
76
- "*.md"
87
- "**/*.rst"
98
- "*.rst"
10-
119
docker:
1210
- "docker/Dockerfile"
13-
1411
ci:
1512
- ".github/**"

.github/workflows/black.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
name: Black
2-
32
on: [pull_request]
4-
53
jobs:
64
black:
75
runs-on: ubuntu-latest

.github/workflows/coverage.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
name: CodeCov
2-
on:
2+
on:
33
- push
44
- pull_request
5-
65
jobs:
76
build:
87
runs-on: ubuntu-latest
98
strategy:
109
matrix:
1110
python-version: ['3.10']
1211
steps:
13-
- uses: actions/checkout@v2
14-
- name: Set up Python ${{ matrix.python-version }}
15-
uses: actions/setup-python@v2
16-
with:
17-
python-version: ${{ matrix.python-version }}
18-
- name: Install dependencies
19-
run: |
20-
python -m pip install --upgrade pip setuptools wheel
21-
pip install coverage
22-
pip install -e ".[dev]"
23-
- name: Run Coverage
24-
run: |
25-
coverage run -m pytest --ignore=projects
26-
- name: Upload Coverage to Codecov
27-
uses: codecov/codecov-action@v1
12+
- uses: actions/checkout@v2
13+
- name: Set up Python ${{ matrix.python-version }}
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip setuptools wheel
20+
pip install coverage
21+
pip install -e ".[dev]"
22+
- name: Run Coverage
23+
run: |
24+
coverage run -m pytest --ignore=projects
25+
- name: Upload Coverage to Codecov
26+
uses: codecov/codecov-action@v1

0 commit comments

Comments
 (0)