• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1###############################################################################
2## Bazel Configuration Flags
3##
4## `.bazelrc` is a Bazel configuration file.
5## https://bazel.build/docs/best-practices#bazelrc-file
6###############################################################################
7
8# https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config
9common --enable_platform_specific_config
10
11# https://bazel.build/docs/windows#symlink
12startup --windows_enable_symlinks
13build:windows --enable_runfiles
14
15# Enable the only currently supported report type
16# https://bazel.build/reference/command-line-reference#flag--combined_report
17coverage --combined_report=lcov
18
19# Avoid fully cached builds reporting no coverage and failing CI
20# https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs
21coverage --experimental_fetch_all_coverage_outputs
22
23# Required for some of the tests
24# https://bazel.build/reference/command-line-reference#flag--experimental_cc_shared_library
25common --experimental_cc_shared_library
26
27###############################################################################
28## Unique configuration groups
29###############################################################################
30
31# Enable rustfmt for all targets in the workspace
32build:rustfmt --aspects=//rust:defs.bzl%rustfmt_aspect
33build:rustfmt --output_groups=+rustfmt_checks
34
35# Enable clippy for all targets in the workspace
36build:clippy --aspects=//rust:defs.bzl%rust_clippy_aspect
37build:clippy --output_groups=+clippy_checks
38
39# Enable unpretty for all targets in the workspace
40build:unpretty --aspects=//rust:defs.bzl%rust_unpretty_aspect
41build:unpretty --output_groups=+rust_unpretty
42
43# `unpretty` requires the nightly toolchain. See tracking issue:
44# https://github.com/rust-lang/rust/issues/43364
45build:unpretty --//rust/toolchain/channel=nightly
46
47###############################################################################
48## Incompatibility flags
49###############################################################################
50
51# https://github.com/bazelbuild/bazel/issues/8195
52build --incompatible_disallow_empty_glob=true
53
54# https://github.com/bazelbuild/bazel/issues/12821
55build --nolegacy_external_runfiles
56
57###############################################################################
58## Bzlmod
59###############################################################################
60
61# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel
62# https://github.com/bazelbuild/rules_rust/issues/2181
63common --noenable_bzlmod
64
65###############################################################################
66## Custom user flags
67##
68## This should always be the last thing in the `.bazelrc` file to ensure
69## consistent behavior when setting flags in that file as `.bazelrc` files are
70## evaluated top to bottom.
71###############################################################################
72
73try-import %workspace%/user.bazelrc
74