| Tim Windelschmidt | 6c851e2 | 2024-01-11 15:23:48 +0100 | [diff] [blame] | 1 | # Import Aspect bazelrc presets |
| Tim Windelschmidt | 2979a43 | 2025-02-24 18:55:52 +0100 | [diff] [blame] | 2 | import %workspace%/third_party/bazelrc/aspect/bazel8.bazelrc |
| Tim Windelschmidt | 6c851e2 | 2024-01-11 15:23:48 +0100 | [diff] [blame] | 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 | 2979a43 | 2025-02-24 18:55:52 +0100 | [diff] [blame] | 7 | # rules_proto_grpc isn't fully compatible with Bazel 8 yet. |
| 8 | common --noincompatible_disallow_ctx_resolve_tools |
| 9 | |
| Tim Windelschmidt | d7f5993 | 2024-07-24 23:37:03 +0200 | [diff] [blame] | 10 | # Actually make the lock file a lock file by not updating it without any |
| 11 | # request to do so. |
| 12 | common --lockfile_mode=error |
| 13 | |
| Tim Windelschmidt | 6c851e2 | 2024-01-11 15:23:48 +0100 | [diff] [blame] | 14 | # Allow empty globs as there are a lot until we replace our rust toolchain and |
| 15 | # qemu BUILD files. |
| 16 | common --noincompatible_disallow_empty_glob |
| 17 | |
| 18 | # Don't warn about too high test timeout as these can vary a lot. |
| 19 | test --notest_verbose_timeout_warnings |
| 20 | |
| Leopold Schabel | 8661db3 | 2024-07-24 16:28:27 +0000 | [diff] [blame] | 21 | # Set compilation mode (-c) to debug when running with --config dbg. |
| Lorenz Brun | 6570219 | 2023-08-31 16:27:38 +0200 | [diff] [blame] | 22 | build:dbg --compilation_mode=dbg |
| 23 | |
| Tim Windelschmidt | 25e0d8f | 2024-12-02 23:46:24 +0100 | [diff] [blame] | 24 | # Run race config with race detector |
| 25 | build:race --@io_bazel_rules_go//go/config:race |
| Jan Schär | 0fd36f4 | 2025-04-29 10:26:03 +0000 | [diff] [blame] | 26 | build:race --no@io_bazel_rules_go//go/config:pure |
| Tim Windelschmidt | 25e0d8f | 2024-12-02 23:46:24 +0100 | [diff] [blame] | 27 | |
| Tim Windelschmidt | 32e7430 | 2025-01-15 04:37:26 +0100 | [diff] [blame] | 28 | # Only download the final result, the intermediate files can stay on the |
| 29 | # server side. |
| 30 | build:remote --remote_download_toplevel |
| 31 | build:remote --noremote_upload_local_results |
| 32 | |
| 33 | # Set the execution platform which adds constraints for the scheduler. |
| Jan Schär | 51c6748 | 2025-05-05 13:11:55 +0000 | [diff] [blame] | 34 | build:remote --extra_execution_platforms=//build/platforms:remote_x86_64 |
| Tim Windelschmidt | 32e7430 | 2025-01-15 04:37:26 +0100 | [diff] [blame] | 35 | |
| Lorenz Brun | 27f2efb | 2025-06-28 11:53:12 +0200 | [diff] [blame] | 36 | # We have some large uploads and actions, the default 60s is not enough. |
| 37 | build:remote --remote_timeout=360s |
| 38 | |
| Jan Schär | 0fd36f4 | 2025-04-29 10:26:03 +0000 | [diff] [blame] | 39 | # Enable pure by default. Specific go_binary targets which need cgo should set |
| 40 | # `pure = "off"`. |
| 41 | build --@io_bazel_rules_go//go/config:pure |
| 42 | |
| Tim Windelschmidt | 25e0d8f | 2024-12-02 23:46:24 +0100 | [diff] [blame] | 43 | # Force netgo and osusergo |
| 44 | build --@io_bazel_rules_go//go/config:tags=osusergo,netgo |
| 45 | |
| Jan Schär | afb922c | 2025-05-19 10:18:37 +0000 | [diff] [blame] | 46 | # Include platform in output directory name. For each platform we use, a short |
| 47 | # name should be assigned here, otherwise Bazel uses a hash. |
| 48 | build --experimental_platform_in_output_dir |
| 49 | build --noexperimental_use_platforms_in_output_dir_legacy_heuristic |
| 50 | build --experimental_override_name_platform_in_output_dir=//build/platforms:linux_x86_64=linux-x86_64 |
| 51 | build --experimental_override_name_platform_in_output_dir=//build/platforms:linux_aarch64=linux-aarch64 |
| 52 | build --experimental_override_name_platform_in_output_dir=//build/platforms:uefi_x86_64=uefi-x86_64 |
| 53 | build --experimental_override_name_platform_in_output_dir=//build/platforms:uefi_aarch64=uefi-aarch64 |
| 54 | build --experimental_override_name_platform_in_output_dir=//build/platforms:remote_x86_64=remote-x86_64 |
| 55 | build --experimental_override_name_platform_in_output_dir=@io_bazel_rules_go//go/toolchain:darwin_amd64=go-darwin-amd64 |
| 56 | build --experimental_override_name_platform_in_output_dir=@io_bazel_rules_go//go/toolchain:darwin_arm64=go-darwin-arm64 |
| 57 | build --experimental_override_name_platform_in_output_dir=@io_bazel_rules_go//go/toolchain:windows_amd64=go-windows-amd64 |
| 58 | build --experimental_override_name_platform_in_output_dir=@io_bazel_rules_go//go/toolchain:windows_arm64=go-windows-arm64 |
| 59 | |
| Jan Schär | af72f68 | 2025-05-19 09:58:13 +0000 | [diff] [blame] | 60 | # Enable path mapping to improve cache hit rate. |
| 61 | # Actions in custom rules can opt in with supports-path-mapping. |
| 62 | # See https://github.com/bazelbuild/bazel/discussions/22658 |
| 63 | build --experimental_output_paths=strip |
| 64 | |
| Jan Schär | a81e2a6 | 2025-05-05 12:02:24 +0000 | [diff] [blame] | 65 | # Stop propagation of settings to exec config by default. |
| 66 | # See https://github.com/bazelbuild/bazel/issues/22457 |
| 67 | build --experimental_exclude_starlark_flags_from_exec_config |
| 68 | # These flags need to be propagated for nogo to work. We currently need to |
| 69 | # reference rules_go with the canonical repo name; this is no longer necessary |
| 70 | # once the fix for https://github.com/bazelbuild/bazel/issues/25208 is released. |
| 71 | build --experimental_propagate_custom_flag=@@rules_go+//go/private:request_nogo |
| 72 | build --experimental_propagate_custom_flag=@@rules_go+//go/private:bootstrap_nogo |
| 73 | |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 74 | # No local CPP toolchain resolution. In our sandbox root, it doesn't make sense - |
| 75 | # anything auto-detected during analysis stage is on the host instead of the sandbox. |
| 76 | # Sysroot rebuild is pure Go and doesn't need it either. |
| 77 | # The flag ensures we fail early if we somehow depend on the host toolchain, |
| 78 | # and do not spend unnecessary time on autodiscovery. |
| 79 | build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 |
| 80 | |
| 81 | # Use new-style C++ toolchain resolution. |
| 82 | build --incompatible_enable_cc_toolchain_resolution |
| Tim Windelschmidt | 2da91b9 | 2025-04-15 21:10:12 +0200 | [diff] [blame] | 83 | build --experimental_cc_static_library |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 84 | |
| Tim Windelschmidt | 886abba | 2024-07-17 21:29:55 +0200 | [diff] [blame] | 85 | # Use new-style proto toolchain resolution. |
| 86 | build --incompatible_enable_proto_toolchain_resolution |
| 87 | |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 88 | # In our monorepo, we mostly ignore the host platform since we bring our own |
| 89 | # 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] | 90 | # such as gazelle. |
| Jan Schär | 51c6748 | 2025-05-05 13:11:55 +0000 | [diff] [blame] | 91 | build --host_platform=//build/platforms:linux_x86_64 |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 92 | |
| 93 | # Target platform for the monorepo is currently the same as the host platform, |
| 94 | # but we'll support cross-compilation at some point. Do not rely on it. |
| Jan Schär | 51c6748 | 2025-05-05 13:11:55 +0000 | [diff] [blame] | 95 | build --platforms=//build/platforms:linux_x86_64 |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 96 | # Make sure our platform is picked instead of the --host_platform. |
| Jan Schär | 51c6748 | 2025-05-05 13:11:55 +0000 | [diff] [blame] | 97 | build --extra_execution_platforms=//build/platforms:linux_x86_64 |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 98 | |
| Leopold | eb2fb7b | 2022-06-08 13:18:51 +0200 | [diff] [blame] | 99 | # Build resources |
| Leopold Schabel | 5c80aca | 2019-10-22 15:48:58 +0200 | [diff] [blame] | 100 | startup --batch_cpu_scheduling --io_nice_level 7 |
| Lorenz Brun | 5d7d2a4 | 2020-04-06 14:11:02 +0200 | [diff] [blame] | 101 | |
| Serge Bazanski | bb7db92 | 2020-04-30 12:43:10 +0200 | [diff] [blame] | 102 | # Build with C++17. |
| 103 | build --cxxopt=-std=c++17 |
| 104 | |
| Lorenz Brun | f640211 | 2020-05-04 16:50:31 +0200 | [diff] [blame] | 105 | # Set workspace status file and stamp |
| Serge Bazanski | a6a0392 | 2023-11-13 19:57:48 +0100 | [diff] [blame] | 106 | build --stamp --workspace_status_command=./build/print-workspace-status.py |
| Serge Bazanski | 385c12f | 2020-06-17 12:12:42 +0200 | [diff] [blame] | 107 | |
| Jan Schär | bddad35 | 2025-04-23 14:55:26 +0000 | [diff] [blame] | 108 | # The --nostamp Bazel flag does not work in this repo; instead use |
| 109 | # --config=nostamp to disable stamping with commit info. |
| 110 | build:nostamp --workspace_status_command="./build/print-workspace-status.py --nostamp" |
| 111 | |
| Serge Bazanski | 99b0214 | 2024-04-17 16:33:28 +0200 | [diff] [blame] | 112 | # 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] | 113 | test --local_resources=iops=10000 --local_resources=ram=64000 |
| Tim Windelschmidt | f1e0fa1 | 2024-07-17 21:28:23 +0200 | [diff] [blame] | 114 | |
| Tim Windelschmidt | 78fd25b | 2025-07-02 21:30:09 +0200 | [diff] [blame] | 115 | common --downloader_config=build/bazel/bazel_downloader.cfg |
| Tim Windelschmidt | 5178dd7 | 2024-12-04 04:38:45 +0100 | [diff] [blame] | 116 | |
| Tim Windelschmidt | f1e0fa1 | 2024-07-17 21:28:23 +0200 | [diff] [blame] | 117 | # Load custom per-user settings. |
| Serge Bazanski | f9c8249 | 2024-09-16 16:50:39 +0200 | [diff] [blame] | 118 | try-import %workspace%/.bazelrc.user |