Leopold | eb2fb7b | 2022-06-08 13:18:51 +0200 | [diff] [blame] | 1 | # Enable strict_action_env (use static PATH and do not inherit environment variables). |
| 2 | # This avoids unnecessary cache invalidations. |
| 3 | build --incompatible_strict_action_env=true |
| 4 | |
Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 5 | # Run all spawns in our own hermetic sandbox sysroot. |
| 6 | #build --experimental_use_hermetic_linux_sandbox |
| 7 | # TODO: https://github.com/bazelbuild/rules_go/issues/1910 |
Leopold | 7fbf104 | 2023-01-06 19:57:37 +0100 | [diff] [blame] | 8 | build --action_env=MONOGON_SANDBOX_DIGEST |
| 9 | import %workspace%/.bazelrc.sandbox |
| 10 | |
Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 11 | # No local CPP toolchain resolution. In our sandbox root, it doesn't make sense - |
| 12 | # anything auto-detected during analysis stage is on the host instead of the sandbox. |
| 13 | # Sysroot rebuild is pure Go and doesn't need it either. |
| 14 | # The flag ensures we fail early if we somehow depend on the host toolchain, |
| 15 | # and do not spend unnecessary time on autodiscovery. |
| 16 | build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 |
| 17 | |
| 18 | # Use new-style C++ toolchain resolution. |
| 19 | build --incompatible_enable_cc_toolchain_resolution |
| 20 | |
| 21 | # In our monorepo, we mostly ignore the host platform since we bring our own |
| 22 | # execution environment. However, we still need to run a small number of tools |
| 23 | # such as gazelle. We can just use rules_go's pure-Go platform. Attempting to |
| 24 | # build CGO binaries for the host will fail (and does not make sense). |
| 25 | # The host is lava - it could be NixOS (or even potentially macOS/Windows). |
| 26 | build --host_platform=@io_bazel_rules_go//go/toolchain:linux_amd64 |
| 27 | |
| 28 | # Target platform for the monorepo is currently the same as the host platform, |
| 29 | # but we'll support cross-compilation at some point. Do not rely on it. |
| 30 | build --platforms=//build/platforms:linux_amd64 |
| 31 | # Make sure our platform is picked instead of the --host_platform. |
| 32 | build --extra_execution_platforms=//build/platforms:linux_amd64 |
| 33 | |
Leopold | eb2fb7b | 2022-06-08 13:18:51 +0200 | [diff] [blame] | 34 | # Build resources |
Leopold Schabel | 5c80aca | 2019-10-22 15:48:58 +0200 | [diff] [blame] | 35 | startup --batch_cpu_scheduling --io_nice_level 7 |
Leopold | afb925b | 2023-01-08 16:57:28 +0100 | [diff] [blame] | 36 | test --test_output=errors |
Lorenz Brun | 5d7d2a4 | 2020-04-06 14:11:02 +0200 | [diff] [blame] | 37 | |
Leopold | 96b03c7 | 2022-06-08 12:59:58 +0200 | [diff] [blame] | 38 | # selinux: |
| 39 | # build with SELinux (containerd, kubelet) |
| 40 | # no_zfs,no_aufs,no_devicemapper: |
| 41 | # disable containerd features we don't need |
| 42 | # providerless,dockerless: |
| 43 | # build k8s without cloud provider and docker support |
Serge Bazanski | 46e72ab | 2022-09-05 15:13:22 +0200 | [diff] [blame] | 44 | # nowasm: |
| 45 | # disable wasm plugin support in sqlc |
| 46 | build --define gotags=selinux,seccomp,no_zfs,no_aufs,no_devicemapper,providerless,dockerless,nowasm |
Serge Bazanski | bb7db92 | 2020-04-30 12:43:10 +0200 | [diff] [blame] | 47 | |
| 48 | # Build with C++17. |
| 49 | build --cxxopt=-std=c++17 |
| 50 | |
Lorenz Brun | f640211 | 2020-05-04 16:50:31 +0200 | [diff] [blame] | 51 | # Set workspace status file and stamp |
| 52 | build --stamp --workspace_status_command=./build/print-workspace-status.sh |
Serge Bazanski | 385c12f | 2020-06-17 12:12:42 +0200 | [diff] [blame] | 53 | |
Serge Bazanski | c3ad846 | 2021-01-08 16:45:51 +0100 | [diff] [blame] | 54 | # Load CI bazelrc if present. |
| 55 | try-import %workspace%/ci.bazelrc |
Leopold | 3154587 | 2022-06-08 13:22:32 +0200 | [diff] [blame] | 56 | |
| 57 | # Load custom per-user settings. |
| 58 | try-import %workspace%/.bazelrc.user |