fork/rules_rust

git clone https://git.julia.blue/fork/rules_rust

UebelAndreAdded bzlmod support to all extension rules. (#3037)a7aba2d0

main
3.1 KiB77 linesraw
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# Enable the only currently supported report type
12# https://bazel.build/reference/command-line-reference#flag--combined_report
13coverage --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
17coverage --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
21common --experimental_cc_shared_library
22
23###############################################################################
24## Unique configuration groups
25###############################################################################
26
27# Enable use of the nightly toolchains.
28build:nightly --@rules_rust//rust/toolchain/channel=nightly
29
30# Enable rustfmt for all targets in the workspace
31build:rustfmt --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect
32build:rustfmt --output_groups=+rustfmt_checks
33
34# Enable clippy for all targets in the workspace
35build:clippy --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
36build:clippy --output_groups=+clippy_checks
37
38# Enable unpretty for all targets in the workspace
39build:unpretty --aspects=@rules_rust//rust:defs.bzl%rust_unpretty_aspect
40build:unpretty --output_groups=+rust_unpretty
41
42# `unpretty` requires the nightly toolchain. See tracking issue:
43# https://github.com/rust-lang/rust/issues/43364
44build:unpretty --config=nightly
45
46###############################################################################
47## Incompatibility flags
48###############################################################################
49
50# https://github.com/bazelbuild/bazel/issues/8195
51build --incompatible_disallow_empty_glob=true
52
53# https://github.com/bazelbuild/bazel/issues/12821
54build --nolegacy_external_runfiles
55
56# Required for cargo_build_script support before Bazel 7
57build --incompatible_merge_fixed_and_default_shell_env
58
59###############################################################################
60## Bzlmod
61###############################################################################
62
63# A configuration for disabling bzlmod.
64common:no-bzlmod --noenable_bzlmod --enable_workspace
65
66# Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock
67common --lockfile_mode=off
68
69###############################################################################
70## Custom user flags
71##
72## This should always be the last thing in the `.bazelrc` file to ensure
73## consistent behavior when setting flags in that file as `.bazelrc` files are
74## evaluated top to bottom.
75###############################################################################
76
77try-import %workspace%/user.bazelrc