-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.bazelrc
More file actions
104 lines (90 loc) · 6.13 KB
/
Copy path.bazelrc
File metadata and controls
104 lines (90 loc) · 6.13 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
common --enable_bzlmod
common --experimental_isolated_extension_usages
# Disable Aspect telemetry (aspect_tools_telemetry) so builds don't POST to telemetry.aspect.build
common --repo_env=DO_NOT_TRACK=1
# Suppress -Wdeprecated-declarations from protobuf's own internal usage of its
# deprecated APIs (FieldOptions::weak(), RepeatedPtrField(Arena*), etc.).
# All warnings are within external/protobuf+/ — protobuf using APIs that it
# itself deprecated, not fixable from this repo.
# Applied to both target and exec (host) configs since protoc runs in exec.
build --per_file_copt=external/protobuf[+]/.*@-Wno-deprecated-declarations
build --host_per_file_copt=external/protobuf[+]/.*@-Wno-deprecated-declarations
# Suppress noisy warnings from OR-Tools' own sources — upstream code rather
# than something this repo can fix. Keep this scoped to OR-Tools so repo code
# still uses the normal warning policy.
# -Wsign-compare: signed/unsigned comparisons throughout the 9.15 release.
# -Wrange-loop-construct: `for (const auto [a, b] : container)` over containers
# of std::pair/tuple copies the structured binding instead of binding a
# reference (ortools/sat/precedences.cc, linear_propagation.cc, diffn_util.cc,
# pseudo_costs.cc, etc.).
# -Wcomment: ASCII-art diagrams in comments (ortools/util/fixed_shape_binary_tree.h)
# contain backslashes gcc parses as line-continuations.
build --per_file_copt=external/or-tools[+]/.*@-Wno-sign-compare,-Wno-range-loop-construct,-Wno-comment
build --host_per_file_copt=external/or-tools[+]/.*@-Wno-sign-compare,-Wno-range-loop-construct,-Wno-comment
# Reduce runfiles disk usage (prevents "No space left on device" on CI runners).
# Each py_test creates a runfiles tree with ~2,458 symlinks for the Python toolchain;
# with many targets this exhausts the default 20 GB BuildBuddy disk.
# --nobuild_runfile_links: don't eagerly create runfiles trees during build phase
# (created on-demand for test/run). Safe for CI where we only `bazel test` or `bazel run`.
# --nolegacy_external_runfiles: skip duplicate legacy external/<repo> runfiles path,
# keeping only the modern ../<repo> path. Halves external dep symlink count.
build --nobuild_runfile_links
build --nolegacy_external_runfiles
# Disable MODULE.bazel.lock to avoid churn between environments.
# The `ape` module (Actually Portable Executable, transitive dep via aspect_rules_lint)
# has platform-specific resolution that causes the lockfile to differ between local
# dev machines and CI/cloud environments. Since we pin versions explicitly in
# MODULE.bazel and don't use version ranges, the lockfile provides minimal benefit.
common --lockfile_mode=off
# Lint + typecheck enabled by default on all builds.
# Combines lint (ruff, ESLint), typecheck (mypy), and Rust checks (clippy, rustfmt).
# Use Python 3.13 for mypy to parse Python 3.13 syntax (e.g., homeassistant).
# To skip lint (e.g. for fast iterative builds): bazel build --config=nolint //...
build --@rules_python//python/config_settings:python_version=3.13
build --aspects=//devinfra/lint:linters.bzl%ruff,//devinfra/lint:linters.bzl%mypy_aspect,//devinfra/lint:linters.bzl%eslint,@rules_rust//rust:defs.bzl%rust_clippy_aspect,@rules_rust//rust:defs.bzl%rustfmt_aspect
build --output_groups=+rules_lint_report,+mypy,+clippy_checks,+rustfmt_checks
# Make ruff + ESLint findings HARD-FAIL the build instead of only populating the
# rules_lint_report output group. This puts the rules_lint aspects on equal
# footing with mypy/clippy/rustfmt (whose aspect actions already fail the build
# directly): code that doesn't lint clean no longer bazel-builds. --config=nolint
# still bypasses — it drops the rules_lint_report output group, so the
# report-generating action that enforces this flag is never requested.
build --@aspect_rules_lint//lint:fail_on_violation
# Skip lint/typecheck. Bazel evaluates aspects lazily, so removing their
# output groups prevents the aspect actions from running.
build:nolint --output_groups=-rules_lint_report,-mypy,-clippy_checks,-rustfmt_checks
# Remote Build Execution (BuildBuddy). Kept in an importable fragment so the
# NixOS integration fixture exercises the exact workspace policy.
import %workspace%/devinfra/bazel/rbe.bazelrc
# Formatting: use bazel run //devinfra/format (fix) or //devinfra/format.check (check)
# Supports: prettier (JS/TS/CSS/HTML/MD), ruff (Python), shfmt (Shell), buildifier (Bazel), rustfmt (Rust)
# Workspace status command populates volatile metadata (repo URL, branch, user)
# for BuildBuddy UI. Stamping is off by default for hermeticity; release builds
# opt in with --stamp to embed commit/content info via expand_template rules.
build --workspace_status_command=devinfra/stamp.sh
# Use shell-based bootstrap instead of system_python. The default
# (system_python) starts with `#!/usr/bin/env python3` which picks up whatever
# system Python is on PATH. This causes _sre.MAGIC mismatches when system
# Python differs from the hermetic 3.13 toolchain, and stdlib shadowing when
# files like `types.py` exist in the package directory. The script bootstrap
# invokes the hermetic interpreter directly, avoiding both issues.
#
# Subprocess-spawning code uses bazel_subprocess.py to propagate PYTHONPATH.
common --@rules_python//python/config_settings:bootstrap_impl=script
# Don't generate empty __init__.py stubs in runfiles. Fixes protobuf namespace
# packages (google.*) and FreeCAD conda C extension shadowing repo-wide.
# Must use the native flag, not the Starlark @rules_python//... config setting
# (which is ignored in Bazel 8 — see debug/legacy-create-init-investigation.md).
common --incompatible_default_to_explicit_init_py
# Quiet output mode — reduces progress spam for non-interactive contexts.
# --curses=no: disable curses UI
# --show_progress_rate_limit=30: at most one progress update every 30 seconds
common:quiet --curses=no
common:quiet --show_progress_rate_limit=30
# CI and AI agent modes both use quiet output.
common:ci --config=quiet
common:ci --announce_rc
# Live targets remain part of CI builds so their remote lint/typecheck actions
# stay covered. Only their credentialed test processes are excluded.
test:ci --test_tag_filters=-live_openai_api,-manual
common:ai_agent --config=quiet