| ############################################################################### |
| ## Bazel Configuration Flags |
| ## |
| ## `.bazelrc` is a Bazel configuration file. |
| ## https://bazel.build/docs/best-practices#bazelrc-file |
| ############################################################################### |
| |
| # Enable rustfmt for all targets in the workspace |
| build:rustfmt --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect |
| build:rustfmt --output_groups=+rustfmt_checks |
| |
| # Enable clippy for all targets in the workspace |
| build:clippy --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect |
| build:clippy --output_groups=+clippy_checks |
| |
| ############################################################################### |
| ## Incompatibility flags |
| ############################################################################### |
| |
| # https://github.com/bazelbuild/bazel/issues/8195 |
| build --incompatible_disallow_empty_glob=true |
| |
| # https://github.com/bazelbuild/bazel/issues/12821 |
| build --nolegacy_external_runfiles |
| |
| # Required for cargo_build_script support before Bazel 7 |
| build --incompatible_merge_fixed_and_default_shell_env |
| |
| # https://github.com/bazelbuild/bazel/issues/23043. |
| # TODO: Re-enable after https://github.com/bazelbuild/bazel/issues/24871 is addressed |
| # build --incompatible_autoload_externally= |
| |
| ############################################################################### |
| ## Bzlmod |
| ############################################################################### |
| |
| # A configuration for disabling bzlmod. |
| common:no-bzlmod --noenable_bzlmod --enable_workspace |
| |
| # Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock |
| common --lockfile_mode=off |
| |
| ############################################################################### |
| ## Custom user flags |
| ## |
| ## This should always be the last thing in the `.bazelrc` file to ensure |
| ## consistent behavior when setting flags in that file as `.bazelrc` files are |
| ## evaluated top to bottom. |
| ############################################################################### |
| |
| try-import %workspace%/user.bazelrc |