|
1 |
| -common --noenable_bzlmod |
| 1 | +############################################################################### |
| 2 | +## Bazel Configuration Flags |
| 3 | +## |
| 4 | +## `.bazelrc` is a Bazel configuration file. |
| 5 | +## https://bazel.build/docs/best-practices#bazelrc-file |
| 6 | +############################################################################### |
2 | 7 |
|
3 |
| -# This isn't currently the defaut in Bazel, but we enable it to test we'll be ready if/when it flips. |
4 |
| -build --incompatible_disallow_empty_glob |
| 8 | +# https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config |
| 9 | +common --enable_platform_specific_config |
| 10 | + |
| 11 | +# Enable the only currently supported report type |
| 12 | +# https://bazel.build/reference/command-line-reference#flag--combined_report |
| 13 | +coverage --combined_report=lcov |
| 14 | + |
| 15 | +# Avoid fully cached builds reporting no coverage and failing CI |
| 16 | +# https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs |
| 17 | +coverage --experimental_fetch_all_coverage_outputs |
| 18 | + |
| 19 | +# Required for some of the tests |
| 20 | +# https://bazel.build/reference/command-line-reference#flag--experimental_cc_shared_library |
| 21 | +common --experimental_cc_shared_library |
| 22 | + |
| 23 | +############################################################################### |
| 24 | +## Unique configuration groups |
| 25 | +############################################################################### |
| 26 | + |
| 27 | +# Enable use of the nightly toolchains. |
| 28 | +build:nightly --@rules_rust//rust/toolchain/channel=nightly |
| 29 | + |
| 30 | +# Enable rustfmt for all targets in the workspace |
| 31 | +build:rustfmt --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect |
| 32 | +build:rustfmt --output_groups=+rustfmt_checks |
| 33 | + |
| 34 | +# Enable clippy for all targets in the workspace |
| 35 | +build:clippy --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect |
| 36 | +build:clippy --output_groups=+clippy_checks |
| 37 | + |
| 38 | +# Enable unpretty for all targets in the workspace |
| 39 | +build:unpretty --aspects=@rules_rust//rust:defs.bzl%rust_unpretty_aspect |
| 40 | +build:unpretty --output_groups=+rust_unpretty |
| 41 | + |
| 42 | +# `unpretty` requires the nightly toolchain. See tracking issue: |
| 43 | +# https://github.com/rust-lang/rust/issues/43364 |
| 44 | +build:unpretty --config=nightly |
| 45 | + |
| 46 | +############################################################################### |
| 47 | +## Incompatibility flags |
| 48 | +############################################################################### |
| 49 | + |
| 50 | +# https://github.com/bazelbuild/bazel/issues/8195 |
| 51 | +build --incompatible_disallow_empty_glob=true |
| 52 | + |
| 53 | +# https://github.com/bazelbuild/bazel/issues/12821 |
| 54 | +build --nolegacy_external_runfiles |
| 55 | + |
| 56 | +# Required for cargo_build_script support before Bazel 7 |
| 57 | +build --incompatible_merge_fixed_and_default_shell_env |
| 58 | + |
| 59 | +############################################################################### |
| 60 | +## Bzlmod |
| 61 | +############################################################################### |
| 62 | + |
| 63 | +# A configuration for disabling bzlmod. |
| 64 | +common:no-bzlmod --noenable_bzlmod --enable_workspace |
| 65 | + |
| 66 | +# Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock |
| 67 | +common --lockfile_mode=off |
| 68 | + |
| 69 | +# Allow bazel configuration flags to locate the core rules to avoid adding local |
| 70 | +# override paths to the `MODULE.bazel` file and breaking downstream consumers. |
| 71 | +common --override_module=rules_rust=../../ |
| 72 | + |
| 73 | +############################################################################### |
| 74 | +## Custom user flags |
| 75 | +## |
| 76 | +## This should always be the last thing in the `.bazelrc` file to ensure |
| 77 | +## consistent behavior when setting flags in that file as `.bazelrc` files are |
| 78 | +## evaluated top to bottom. |
| 79 | +############################################################################### |
| 80 | + |
| 81 | +try-import %workspace%/user.bazelrc |
0 commit comments