| # Import Aspect bazelrc presets |
| import %workspace%/third_party/bazelrc/aspect/bazel8.bazelrc |
| import %workspace%/third_party/bazelrc/aspect/convenience.bazelrc |
| import %workspace%/third_party/bazelrc/aspect/correctness.bazelrc |
| import %workspace%/third_party/bazelrc/aspect/performance.bazelrc |
| |
| # We still require WORKSPACE support as bazeldnf isn't bzlmod compatible yet. |
| common --enable_workspace |
| |
| # rules_proto_grpc isn't fully compatible with Bazel 8 yet. |
| common --noincompatible_disallow_ctx_resolve_tools |
| |
| # Actually make the lock file a lock file by not updating it without any |
| # request to do so. |
| common --lockfile_mode=error |
| |
| # Allow empty globs as there are a lot until we replace our rust toolchain and |
| # qemu BUILD files. |
| common --noincompatible_disallow_empty_glob |
| |
| # Don't warn about too high test timeout as these can vary a lot. |
| test --notest_verbose_timeout_warnings |
| |
| # Set compilation mode (-c) to debug when running with --config dbg. |
| build:dbg --compilation_mode=dbg |
| |
| # Run race config with race detector |
| build:race --@io_bazel_rules_go//go/config:race |
| build:race --no@io_bazel_rules_go//go/config:pure |
| |
| # Only download the final result, the intermediate files can stay on the |
| # server side. |
| build:remote --remote_download_toplevel |
| build:remote --noremote_upload_local_results |
| |
| # Set the execution platform which adds constraints for the scheduler. |
| build:remote --extra_execution_platforms=//build/platforms:remote_x86_64 |
| |
| # Enable pure by default. Specific go_binary targets which need cgo should set |
| # `pure = "off"`. |
| build --@io_bazel_rules_go//go/config:pure |
| |
| # Force netgo and osusergo |
| build --@io_bazel_rules_go//go/config:tags=osusergo,netgo |
| |
| # Run all spawns in our own hermetic sandbox sysroot. |
| build --experimental_use_hermetic_linux_sandbox |
| build --sandbox_fake_hostname |
| build --sandbox_fake_username |
| build --action_env=MONOGON_SANDBOX_DIGEST |
| import %workspace%/.bazelrc.sandbox |
| |
| # Stop propagation of settings to exec config by default. |
| # See https://github.com/bazelbuild/bazel/issues/22457 |
| build --experimental_exclude_starlark_flags_from_exec_config |
| # These flags need to be propagated for nogo to work. We currently need to |
| # reference rules_go with the canonical repo name; this is no longer necessary |
| # once the fix for https://github.com/bazelbuild/bazel/issues/25208 is released. |
| build --experimental_propagate_custom_flag=@@rules_go+//go/private:request_nogo |
| build --experimental_propagate_custom_flag=@@rules_go+//go/private:bootstrap_nogo |
| |
| # Hardwire all action envs to just use /usr/bin from the above sandbox. This is |
| # necessary on NixOS Bazel builds, as they really like to inject /nix/store/* |
| # paths otherwise. We also explicitly set it to /usr/bin only (no /bin) as |
| # otherwise calling gcc from /bin/gcc breaks its own resolution of subordinate |
| # commands (like cc1, as, etc.). |
| build --action_env=PATH=/usr/bin |
| build --host_action_env=PATH=/usr/bin |
| |
| # Make all shell run actions use /bin/bash instead of whatever the host might |
| # have set. Again, looking at you, Bazel-on-NixOS. |
| build --shell_executable=/bin/bash |
| |
| # No local CPP toolchain resolution. In our sandbox root, it doesn't make sense - |
| # anything auto-detected during analysis stage is on the host instead of the sandbox. |
| # Sysroot rebuild is pure Go and doesn't need it either. |
| # The flag ensures we fail early if we somehow depend on the host toolchain, |
| # and do not spend unnecessary time on autodiscovery. |
| build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 |
| |
| # Use new-style C++ toolchain resolution. |
| build --incompatible_enable_cc_toolchain_resolution |
| |
| # Use new-style proto toolchain resolution. |
| build --incompatible_enable_proto_toolchain_resolution |
| |
| # In our monorepo, we mostly ignore the host platform since we bring our own |
| # execution environment. However, we still need to run a small number of tools |
| # such as gazelle. |
| build --host_platform=//build/platforms:linux_x86_64 |
| |
| # Target platform for the monorepo is currently the same as the host platform, |
| # but we'll support cross-compilation at some point. Do not rely on it. |
| build --platforms=//build/platforms:linux_x86_64 |
| # Make sure our platform is picked instead of the --host_platform. |
| build --extra_execution_platforms=//build/platforms:linux_x86_64 |
| |
| # Build resources |
| startup --batch_cpu_scheduling --io_nice_level 7 |
| |
| # Build with C++17. |
| build --cxxopt=-std=c++17 |
| |
| # Set workspace status file and stamp |
| build --stamp --workspace_status_command=./build/print-workspace-status.py |
| |
| # The --nostamp Bazel flag does not work in this repo; instead use |
| # --config=nostamp to disable stamping with commit info. |
| build:nostamp --workspace_status_command="./build/print-workspace-status.py --nostamp" |
| |
| # Assume a 10k IOPS device (average NVMe) and 64GiB of RAM for test scheduling. |
| test --local_resources=iops=10000 --local_resources=ram=64000 |
| |
| common --experimental_downloader_config=build/bazel/bazel_downloader.cfg |
| |
| # Load custom per-user settings. |
| try-import %workspace%/.bazelrc.user |