blob: 1527f4245be25e6bf3689e6fe829578466e3cc93 [file] [log] [blame]
Tim Windelschmidt6c851e22024-01-11 15:23:48 +01001# Import Aspect bazelrc presets
2import %workspace%/third_party/bazelrc/aspect/bazel7.bazelrc
3import %workspace%/third_party/bazelrc/aspect/convenience.bazelrc
4import %workspace%/third_party/bazelrc/aspect/correctness.bazelrc
5import %workspace%/third_party/bazelrc/aspect/performance.bazelrc
6
Tim Windelschmidtd7f59932024-07-24 23:37:03 +02007# Actually make the lock file a lock file by not updating it without any
8# request to do so.
9common --lockfile_mode=error
10
Tim Windelschmidt6c851e22024-01-11 15:23:48 +010011# Allow empty globs as there are a lot until we replace our rust toolchain and
12# qemu BUILD files.
13common --noincompatible_disallow_empty_glob
14
15# Don't warn about too high test timeout as these can vary a lot.
16test --notest_verbose_timeout_warnings
17
Leopold Schabel8661db32024-07-24 16:28:27 +000018# Set compilation mode (-c) to debug when running with --config dbg.
Lorenz Brun65702192023-08-31 16:27:38 +020019build:dbg --compilation_mode=dbg
20
Tim Windelschmidt25e0d8f2024-12-02 23:46:24 +010021# Run race config with race detector
22build:race --@io_bazel_rules_go//go/config:race
23
24# Force netgo and osusergo
25build --@io_bazel_rules_go//go/config:tags=osusergo,netgo
26
Leopoldbc93c2b2023-01-14 13:12:23 +010027# Run all spawns in our own hermetic sandbox sysroot.
Leopold Schabel9508b122023-07-14 17:54:17 +020028build --experimental_use_hermetic_linux_sandbox
Tim Windelschmidt6c851e22024-01-11 15:23:48 +010029build --sandbox_fake_hostname
30build --sandbox_fake_username
Leopold7fbf1042023-01-06 19:57:37 +010031build --action_env=MONOGON_SANDBOX_DIGEST
32import %workspace%/.bazelrc.sandbox
33
Tim Windelschmidt6c851e22024-01-11 15:23:48 +010034# Enable revised output directory hash suffix computation
35build --experimental_output_directory_naming_scheme=diff_against_dynamic_baseline
36build --experimental_exec_configuration_distinguisher=off
37
Serge Bazanskif9c82492024-09-16 16:50:39 +020038# Enable resource set configuration via starlark for actions
39build --experimental_action_resource_set
40
Leopold Schabel9508b122023-07-14 17:54:17 +020041# Hardwire all action envs to just use /usr/bin from the above sandbox. This is
42# necessary on NixOS Bazel builds, as they really like to inject /nix/store/*
43# paths otherwise. We also explicitly set it to /usr/bin only (no /bin) as
44# otherwise calling gcc from /bin/gcc breaks its own resolution of subordinate
45# commands (like cc1, as, etc.).
46build --action_env=PATH=/usr/bin
47build --host_action_env=PATH=/usr/bin
48
49# Make all shell run actions use /bin/bash instead of whatever the host might
50# have set. Again, looking at you, Bazel-on-NixOS.
51build --shell_executable=/bin/bash
52
Leopoldbc93c2b2023-01-14 13:12:23 +010053# No local CPP toolchain resolution. In our sandbox root, it doesn't make sense -
54# anything auto-detected during analysis stage is on the host instead of the sandbox.
55# Sysroot rebuild is pure Go and doesn't need it either.
56# The flag ensures we fail early if we somehow depend on the host toolchain,
57# and do not spend unnecessary time on autodiscovery.
58build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
59
60# Use new-style C++ toolchain resolution.
61build --incompatible_enable_cc_toolchain_resolution
62
Tim Windelschmidt886abba2024-07-17 21:29:55 +020063# Use new-style proto toolchain resolution.
64build --incompatible_enable_proto_toolchain_resolution
65
Leopoldbc93c2b2023-01-14 13:12:23 +010066# In our monorepo, we mostly ignore the host platform since we bring our own
67# execution environment. However, we still need to run a small number of tools
Serge Bazanski139550a2023-06-20 13:30:27 +020068# such as gazelle.
69build --host_platform=//build/platforms:linux_amd64
Leopoldbc93c2b2023-01-14 13:12:23 +010070
71# Target platform for the monorepo is currently the same as the host platform,
72# but we'll support cross-compilation at some point. Do not rely on it.
73build --platforms=//build/platforms:linux_amd64
74# Make sure our platform is picked instead of the --host_platform.
75build --extra_execution_platforms=//build/platforms:linux_amd64
76
Leopoldeb2fb7b2022-06-08 13:18:51 +020077# Build resources
Leopold Schabel5c80aca2019-10-22 15:48:58 +020078startup --batch_cpu_scheduling --io_nice_level 7
Lorenz Brun5d7d2a42020-04-06 14:11:02 +020079
Serge Bazanskibb7db922020-04-30 12:43:10 +020080# Build with C++17.
81build --cxxopt=-std=c++17
82
Lorenz Brunf6402112020-05-04 16:50:31 +020083# Set workspace status file and stamp
Serge Bazanskia6a03922023-11-13 19:57:48 +010084build --stamp --workspace_status_command=./build/print-workspace-status.py
Serge Bazanski385c12f2020-06-17 12:12:42 +020085
Serge Bazanski99b02142024-04-17 16:33:28 +020086test --experimental_allow_tags_propagation
87# Assume a 10k IOPS device (average NVMe) and 64GiB of RAM for test scheduling.
Tim Windelschmidt5be299e2024-07-13 02:59:52 +020088test --local_resources=iops=10000 --local_resources=ram=64000
Tim Windelschmidtf1e0fa12024-07-17 21:28:23 +020089
Tim Windelschmidt5178dd72024-12-04 04:38:45 +010090common --experimental_downloader_config=build/bazel/bazel_downloader.cfg
91
Tim Windelschmidtf1e0fa12024-07-17 21:28:23 +020092# Load custom per-user settings.
Serge Bazanskif9c82492024-09-16 16:50:39 +020093try-import %workspace%/.bazelrc.user