-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.bazelrc
95 lines (73 loc) · 3.67 KB
/
.bazelrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
###############################################################################
## Bazel Configuration Flags
##
## `.bazelrc` is a Bazel configuration file.
## https://bazel.build/docs/best-practices#bazelrc-file
###############################################################################
# https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config
common --enable_platform_specific_config
# `cargo_build_script` from `rules_rust` requires the use of symlinks so
# symlinks are enabled within this repo as the default toolchain relies on
# them to build Pyo3
# https://bazel.build/docs/windows#symlink
startup --windows_enable_symlinks
build:windows --enable_runfiles
# Enable the only currently supported report type
# https://bazel.build/reference/command-line-reference#flag--combined_report
coverage --combined_report=lcov
# Avoid fully cached builds reporting no coverage and failing CI
# https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs
coverage --experimental_fetch_all_coverage_outputs
# Disable network access in the sandbox by default.
build --sandbox_default_allow_network=false
# Do not use the host detected python toolchain. Always use one explicitly
# registered in the WORKSPACE.
common --repo_env=BAZEL_DO_NOT_DETECT_PYTHON_TOOLCHAIN=1
# # Enable rustfmt for all targets in the workspace
# build --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect
# build:rustfmt --output_groups=+rustfmt_checks
# build:no_rustfmt --output_groups=-rustfmt_checks
# Enable clippy for all targets in the workspace
build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
build:clippy --output_groups=+clippy_checks
build:no_clippy --output_groups=-clippy_checks
# Enable unpretty for all targets in the workspace
build:unpretty --aspects=@rules_rust//rust:defs.bzl%rust_unpretty_aspect
build:unpretty --output_groups=+rust_unpretty
# `unpretty` requires the nightly toolchain. See tracking issue:
# https://github.com/rust-lang/rust/issues/43364
build:unpretty --config=nightly
# Convenience configs for enabling linting and formatting
# build:strict --config=rustfmt
build:strict --config=clippy
# build:no_strict --config=no_rustfmt
build:no_strict --config=no_clippy
# When running test enable all linters and formatters
test --config=strict
###############################################################################
## 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
# Disable legacy __init__.py behavior which is known to conflict with
# modern python versions (3.9+)
build --incompatible_default_to_explicit_init_py
###############################################################################
## 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