| Tim Windelschmidt | 6c851e2 | 2024-01-11 15:23:48 +0100 | [diff] [blame] | 1 | # Import Aspect bazelrc presets |
| 2 | import %workspace%/third_party/bazelrc/aspect/bazel7.bazelrc |
| 3 | import %workspace%/third_party/bazelrc/aspect/convenience.bazelrc |
| 4 | import %workspace%/third_party/bazelrc/aspect/correctness.bazelrc |
| 5 | import %workspace%/third_party/bazelrc/aspect/performance.bazelrc |
| 6 | |
| Tim Windelschmidt | d7f5993 | 2024-07-24 23:37:03 +0200 | [diff] [blame] | 7 | # Actually make the lock file a lock file by not updating it without any |
| 8 | # request to do so. |
| 9 | common --lockfile_mode=error |
| 10 | |
| Tim Windelschmidt | 6c851e2 | 2024-01-11 15:23:48 +0100 | [diff] [blame] | 11 | # Allow empty globs as there are a lot until we replace our rust toolchain and |
| 12 | # qemu BUILD files. |
| 13 | common --noincompatible_disallow_empty_glob |
| 14 | |
| 15 | # Don't warn about too high test timeout as these can vary a lot. |
| 16 | test --notest_verbose_timeout_warnings |
| 17 | |
| Leopold Schabel | 8661db3 | 2024-07-24 16:28:27 +0000 | [diff] [blame] | 18 | # Set compilation mode (-c) to debug when running with --config dbg. |
| Lorenz Brun | 6570219 | 2023-08-31 16:27:38 +0200 | [diff] [blame] | 19 | build:dbg --compilation_mode=dbg |
| 20 | |
| Tim Windelschmidt | 25e0d8f | 2024-12-02 23:46:24 +0100 | [diff] [blame] | 21 | # Run race config with race detector |
| 22 | build:race --@io_bazel_rules_go//go/config:race |
| 23 | |
| Tim Windelschmidt | 32e7430 | 2025-01-15 04:37:26 +0100 | [diff] [blame] | 24 | # Only download the final result, the intermediate files can stay on the |
| 25 | # server side. |
| 26 | build:remote --remote_download_toplevel |
| 27 | build:remote --noremote_upload_local_results |
| 28 | |
| 29 | # Set the execution platform which adds constraints for the scheduler. |
| 30 | build:remote --extra_execution_platforms=//build/platforms:remote_amd64 |
| 31 | |
| Tim Windelschmidt | 25e0d8f | 2024-12-02 23:46:24 +0100 | [diff] [blame] | 32 | # Force netgo and osusergo |
| 33 | build --@io_bazel_rules_go//go/config:tags=osusergo,netgo |
| 34 | |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 35 | # Run all spawns in our own hermetic sandbox sysroot. |
| Leopold Schabel | 9508b12 | 2023-07-14 17:54:17 +0200 | [diff] [blame] | 36 | build --experimental_use_hermetic_linux_sandbox |
| Tim Windelschmidt | 6c851e2 | 2024-01-11 15:23:48 +0100 | [diff] [blame] | 37 | build --sandbox_fake_hostname |
| 38 | build --sandbox_fake_username |
| Leopold | 7fbf104 | 2023-01-06 19:57:37 +0100 | [diff] [blame] | 39 | build --action_env=MONOGON_SANDBOX_DIGEST |
| 40 | import %workspace%/.bazelrc.sandbox |
| 41 | |
| Tim Windelschmidt | 6c851e2 | 2024-01-11 15:23:48 +0100 | [diff] [blame] | 42 | # Enable revised output directory hash suffix computation |
| 43 | build --experimental_output_directory_naming_scheme=diff_against_dynamic_baseline |
| 44 | build --experimental_exec_configuration_distinguisher=off |
| 45 | |
| Serge Bazanski | f9c8249 | 2024-09-16 16:50:39 +0200 | [diff] [blame] | 46 | # Enable resource set configuration via starlark for actions |
| 47 | build --experimental_action_resource_set |
| 48 | |
| Leopold Schabel | 9508b12 | 2023-07-14 17:54:17 +0200 | [diff] [blame] | 49 | # Hardwire all action envs to just use /usr/bin from the above sandbox. This is |
| 50 | # necessary on NixOS Bazel builds, as they really like to inject /nix/store/* |
| 51 | # paths otherwise. We also explicitly set it to /usr/bin only (no /bin) as |
| 52 | # otherwise calling gcc from /bin/gcc breaks its own resolution of subordinate |
| 53 | # commands (like cc1, as, etc.). |
| 54 | build --action_env=PATH=/usr/bin |
| 55 | build --host_action_env=PATH=/usr/bin |
| 56 | |
| 57 | # Make all shell run actions use /bin/bash instead of whatever the host might |
| 58 | # have set. Again, looking at you, Bazel-on-NixOS. |
| 59 | build --shell_executable=/bin/bash |
| 60 | |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 61 | # No local CPP toolchain resolution. In our sandbox root, it doesn't make sense - |
| 62 | # anything auto-detected during analysis stage is on the host instead of the sandbox. |
| 63 | # Sysroot rebuild is pure Go and doesn't need it either. |
| 64 | # The flag ensures we fail early if we somehow depend on the host toolchain, |
| 65 | # and do not spend unnecessary time on autodiscovery. |
| 66 | build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 |
| 67 | |
| 68 | # Use new-style C++ toolchain resolution. |
| 69 | build --incompatible_enable_cc_toolchain_resolution |
| 70 | |
| Tim Windelschmidt | 886abba | 2024-07-17 21:29:55 +0200 | [diff] [blame] | 71 | # Use new-style proto toolchain resolution. |
| 72 | build --incompatible_enable_proto_toolchain_resolution |
| 73 | |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 74 | # In our monorepo, we mostly ignore the host platform since we bring our own |
| 75 | # execution environment. However, we still need to run a small number of tools |
| Serge Bazanski | 139550a | 2023-06-20 13:30:27 +0200 | [diff] [blame] | 76 | # such as gazelle. |
| 77 | build --host_platform=//build/platforms:linux_amd64 |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 78 | |
| 79 | # Target platform for the monorepo is currently the same as the host platform, |
| 80 | # but we'll support cross-compilation at some point. Do not rely on it. |
| 81 | build --platforms=//build/platforms:linux_amd64 |
| 82 | # Make sure our platform is picked instead of the --host_platform. |
| 83 | build --extra_execution_platforms=//build/platforms:linux_amd64 |
| 84 | |
| Leopold | eb2fb7b | 2022-06-08 13:18:51 +0200 | [diff] [blame] | 85 | # Build resources |
| Leopold Schabel | 5c80aca | 2019-10-22 15:48:58 +0200 | [diff] [blame] | 86 | startup --batch_cpu_scheduling --io_nice_level 7 |
| Lorenz Brun | 5d7d2a4 | 2020-04-06 14:11:02 +0200 | [diff] [blame] | 87 | |
| Serge Bazanski | bb7db92 | 2020-04-30 12:43:10 +0200 | [diff] [blame] | 88 | # Build with C++17. |
| 89 | build --cxxopt=-std=c++17 |
| 90 | |
| Lorenz Brun | f640211 | 2020-05-04 16:50:31 +0200 | [diff] [blame] | 91 | # Set workspace status file and stamp |
| Serge Bazanski | a6a0392 | 2023-11-13 19:57:48 +0100 | [diff] [blame] | 92 | build --stamp --workspace_status_command=./build/print-workspace-status.py |
| Serge Bazanski | 385c12f | 2020-06-17 12:12:42 +0200 | [diff] [blame] | 93 | |
| Serge Bazanski | 99b0214 | 2024-04-17 16:33:28 +0200 | [diff] [blame] | 94 | test --experimental_allow_tags_propagation |
| 95 | # Assume a 10k IOPS device (average NVMe) and 64GiB of RAM for test scheduling. |
| Tim Windelschmidt | 5be299e | 2024-07-13 02:59:52 +0200 | [diff] [blame] | 96 | test --local_resources=iops=10000 --local_resources=ram=64000 |
| Tim Windelschmidt | f1e0fa1 | 2024-07-17 21:28:23 +0200 | [diff] [blame] | 97 | |
| Tim Windelschmidt | 5178dd7 | 2024-12-04 04:38:45 +0100 | [diff] [blame] | 98 | common --experimental_downloader_config=build/bazel/bazel_downloader.cfg |
| 99 | |
| Tim Windelschmidt | f1e0fa1 | 2024-07-17 21:28:23 +0200 | [diff] [blame] | 100 | # Load custom per-user settings. |
| Serge Bazanski | f9c8249 | 2024-09-16 16:50:39 +0200 | [diff] [blame] | 101 | try-import %workspace%/.bazelrc.user |