-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bazelrc
More file actions
113 lines (101 loc) · 5.14 KB
/
Copy path.bazelrc
File metadata and controls
113 lines (101 loc) · 5.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Aegis Core .bazelrc
# Per ADR-0009 (C++ Build and Toolchain). DO NOT add user-specific
# overrides here — use .bazelrc.user (gitignored) for those.
# --- CLAUDE.md Rule 6: strict directory confinement ---
# Bazel's global output_user_root is overridden by the tools/bazelisk/bazelisk
# wrapper, which resolves it to <repo>/.bazel_cache at startup so Bazel
# never writes to ~/.cache/bazel or /private/var.
# --- C++ language standard (ADR-0009 Sub-decision 1) ---
build --cxxopt=-std=c++20
build --host_cxxopt=-std=c++20
build --cxxopt=-Wall
build --cxxopt=-Wextra
build --host_cxxopt=-Wall
build --host_cxxopt=-Wextra
# -Werror is NOT set at the top level because third-party deps
# (boringssl in particular) have their own BUILD copts=["-Werror"]
# that trip newer Apple Clang. Global --copt is overridden by
# target-level copts; --per_file_copt is applied AFTER target copts
# so it wins. Targeting external/ paths suppresses warnings only
# for third-party code; our engine_cpp/ targets keep strict defaults.
build --per_file_copt=external/.*@-Wno-error
build --per_file_copt=external/.*@-Wno-unused-parameter
build --host_per_file_copt=external/.*@-Wno-error
build --host_per_file_copt=external/.*@-Wno-unused-parameter
# --- macOS without full Xcode (Command Line Tools only) ---
# Bazel's XcodeLocalEnvProvider (invoked by BOTH sandbox and local spawn
# runners on Darwin) calls xcode-locator, which returns the literal
# string "None" when no full Xcode is installed. DottedVersion then
# crashes parsing "None".
#
# Fix: point Bazel explicitly at the Command Line Tools developer dir
# AND provide a fake XCODE_VERSION_OVERRIDE so xcode-locator takes the
# early-return path instead of trying to resolve "None".
# (Bug: bazelbuild/bazel#17037, #21106.)
build --action_env=DEVELOPER_DIR=/Library/Developer/CommandLineTools
build --host_action_env=DEVELOPER_DIR=/Library/Developer/CommandLineTools
build --repo_env=DEVELOPER_DIR=/Library/Developer/CommandLineTools
build --xcode_version_config=@bazel_tools//tools/cpp:host_xcodes
# Stable action environment — prevents cache invalidation when running
# from different shells with different PATH (e.g., interactive terminal
# vs editor / tooling subprocess). Without this, every cross-shell
# `bazel run` sees "Effective client environment has changed" and
# re-compiles all C++ sources including the rules_foreign_cc-wrapped
# llama.cpp + whisper.cpp — ~10 minutes of wasted CPU per invocation.
# The flag enforces a normalized PATH that doesn't inherit from the
# caller's shell. Individual env vars we actually need (like
# DEVELOPER_DIR above) are still propagated via explicit --action_env.
# Diagnosed 2026-04-20 via `--explain` showing PATH-diff-induced misses.
build --incompatible_strict_action_env
# Override Bazel's ancient macOS 10.11 minimum / SDK defaults. Apple Silicon
# machines cannot build against 10.11; use a currently-available SDK.
build --macos_minimum_os=11.0
build --macos_sdk_version=15.4
build --host_macos_minimum_os=11.0
# -Werror is intentionally NOT set at the top level because it makes
# every third-party warning a hard failure. Re-enable per target via
# cc_library(copts=["-Werror"]) in engine_cpp/.
# --- Default backend: CPU (ADR-0009 Sub-decision 4) ---
# This ensures `bazel build` works out of the box on ANY machine
# (including AI agent clones and CI runners) without requiring
# configure_backend.sh or a --config flag. Override with --config=metal
# or --config=cuda for acceleration.
build --define=whisper_backend=cpu
# --- Backend selection — use `--config=metal|cuda|cpu` to override ---
# Developers: run `./tools/scripts/configure_backend.sh` on first clone
# to write your preferred backend to `.bazelrc.user` (gitignored).
# CI: pass the flag directly on the command line.
build:metal --define=whisper_backend=metal
build:metal --copt=-DGGML_USE_METAL
build:metal --linkopt=-framework
build:metal --linkopt=Metal
build:metal --linkopt=-framework
build:metal --linkopt=MetalKit
build:cuda --define=whisper_backend=cuda
build:cuda --copt=-DGGML_USE_CUBLAS
build:cuda --action_env=CUDA_PATH
build:cpu --define=whisper_backend=cpu
build:cpu --copt=-DGGML_USE_AVX2
build:cpu --copt=-mavx2
build:cpu --copt=-mfma
# --- Debug vs release ---
build:debug -c dbg
build:debug --copt=-DAEGIS_DEV_AUDIO_DUMP # ADR-0005 R7 — dev only
build:release -c opt
build:release --strip=always
# --- Test defaults ---
test --test_output=errors
test --test_verbose_timeout_warnings
# --- Lock file policy (Bazel 7+ reproducibility) ---
# MODULE.bazel.lock is committed (not gitignored) per Incident 15.
# Dev default is --lockfile_mode=update — local bazelisk silently
# regenerates the lock if MODULE.bazel changes; developers then commit
# the lock diff alongside the MODULE.bazel edit in the same PR. CI
# could flip this to --lockfile_mode=error as a strict reproducibility
# gate when we want drift to fail the build instead of auto-healing;
# kept at update today because the committed-lock PR is young and
# false positives are more costly than silent auto-update.
common --lockfile_mode=update
# --- Per-developer overrides ---
# Keep at the end so .bazelrc.user wins when both specify the same flag.
try-import %workspace%/.bazelrc.user