blob: a599f6d853c5fa0398a0cc70e23566e66f67fd68 [file] [log] [blame]
Tim Windelschmidt6c851e22024-01-11 15:23:48 +01001# Do not upload locally executed action results to the remote cache.
2# This should be the default for local builds so local builds cannot poison the remote cache.
3# It should be flipped to `--remote_upload_local_results` on CI
4# by using `--bazelrc=.aspect/bazelrc/ci.bazelrc`.
5# Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results
6build --noremote_upload_local_results
7
8# Don't allow network access for build actions in the sandbox.
9# Ensures that you don't accidentally make non-hermetic actions/tests which depend on remote
10# services.
11# Developers should tag targets with `tags=["requires-network"]` to opt-out of the enforcement.
12# Docs: https://bazel.build/reference/command-line-reference#flag--sandbox_default_allow_network
13build --sandbox_default_allow_network=false
14
15# Warn if a test's timeout is significantly longer than the test's actual execution time.
16# Bazel's default for test_timeout is medium (5 min), but most tests should instead be short (1 min).
17# While a test's timeout should be set such that it is not flaky, a test that has a highly
18# over-generous timeout can hide real problems that crop up unexpectedly.
19# For instance, a test that normally executes in a minute or two should not have a timeout of
20# ETERNAL or LONG as these are much, much too generous.
21# Docs: https://bazel.build/docs/user-manual#test-verbose-timeout-warnings
22test --test_verbose_timeout_warnings
23
24# Allow the Bazel server to check directory sources for changes. Ensures that the Bazel server
25# notices when a directory changes, if you have a directory listed in the srcs of some target.
26# Recommended when using
27# [copy_directory](https://github.com/aspect-build/bazel-lib/blob/main/docs/copy_directory.md) and
28# [rules_js](https://github.com/aspect-build/rules_js) since npm package are source directories
29# inputs to copy_directory actions.
30# Docs: https://bazel.build/reference/command-line-reference#flag--host_jvm_args
31startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1
32
33# Allow exclusive tests to run in the sandbox. Fixes a bug where Bazel doesn't enable sandboxing for
34# tests with `tags=["exclusive"]`.
35# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_exclusive_test_sandboxed
36test --incompatible_exclusive_test_sandboxed
37
38# Use a static value for `PATH` and does not inherit `LD_LIBRARY_PATH`. Doesn't let environment
39# variables like `PATH` sneak into the build, which can cause massive cache misses when they change.
40# Use `--action_env=ENV_VARIABLE` if you want to inherit specific environment variables from the
41# client, but note that doing so can prevent cross-user caching if a shared cache is used.
42# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_strict_action_env
43build --incompatible_strict_action_env
44
45# Propagate tags from a target declaration to the actions' execution requirements.
46# Ensures that tags applied in your BUILD file, like `tags=["no-remote"]`
47# get propagated to actions created by the rule.
48# Without this option, you rely on rules authors to manually check the tags you passed
49# and apply relevant ones to the actions they create.
50# See https://github.com/bazelbuild/bazel/issues/8830 for details.
51# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_allow_tags_propagation
52build --experimental_allow_tags_propagation
53fetch --experimental_allow_tags_propagation
54query --experimental_allow_tags_propagation
55
56# Do not automatically create `__init__.py` files in the runfiles of Python targets. Fixes the wrong
57# default that comes from Google's internal monorepo by using `__init__.py` to delimit a Python
58# package. Precisely, when a `py_binary` or `py_test` target has `legacy_create_init` set to `auto (the
59# default), it is treated as false if and only if this flag is set. See
60# https://github.com/bazelbuild/bazel/issues/10076.
61# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_default_to_explicit_init_py
62build --incompatible_default_to_explicit_init_py
63
64# Set default value of `allow_empty` to `False` in `glob()`. This prevents a common mistake when
65# attempting to use `glob()` to match files in a subdirectory that is opaque to the current package
66# because it contains a BUILD file. See https://github.com/bazelbuild/bazel/issues/8195.
67# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_disallow_empty_glob
68common --incompatible_disallow_empty_glob
69
70# Always download coverage files for tests from the remote cache. By default, coverage files are not
71# downloaded on test result cahce hits when --remote_download_minimal is enabled, making it impossible
72# to generate a full coverage report.
73# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs
74# detching remote cache results
75test --experimental_fetch_all_coverage_outputs