Skip to content

Commit f048405

Browse files
authored
refactor: Bazelrc presets: Almost always use common (#1095)
* refactor: Bazelrc presets: Almost always use common * fix preset tests
1 parent f81fc59 commit f048405

File tree

7 files changed

+26
-24
lines changed

7 files changed

+26
-24
lines changed

.aspect/bazelrc/bazel6.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Not using common here because https://github.com/bazelbuild/bazel/pull/18609 was added in Bazel 6.3.0
2+
13
# Speed up all builds by not checking if external repository files have been modified.
24
# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryOptions.java#L244
35
build --noexperimental_check_external_repository_files

.aspect/bazelrc/bazel7.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ common --check_direct_dependencies=off
1212
# Save time on Sandbox creation and deletion when many of the same kind of action run during the
1313
# build.
1414
# Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories
15-
build --reuse_sandbox_directories
15+
common --reuse_sandbox_directories
1616

1717
# Do not build runfiles symlink forests for external repositories under
1818
# `.runfiles/wsname/external/repo` (in addition to `.runfiles/repo`). This reduces runfiles &
1919
# sandbox creation times & prevents accidentally depending on this feature which may flip to off by
2020
# default in the future. Note, some rules may fail under this flag, please file issues with the rule
2121
# author.
2222
# Docs: https://bazel.build/reference/command-line-reference#flag--legacy_external_runfiles
23-
build --nolegacy_external_runfiles
23+
common --nolegacy_external_runfiles

.aspect/bazelrc/ci.bazelrc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,52 +15,52 @@ test --flaky_test_attempts=2
1515
# beginning of each Bazel invocation. This is very useful on CI to be able to inspect what Bazel rc
1616
# settings are being applied on each run.
1717
# Docs: https://bazel.build/docs/user-manual#announce-rc
18-
build --announce_rc
18+
common --announce_rc
1919

2020
# Add a timestamp to each message generated by Bazel specifying the time at which the message was
2121
# displayed.
2222
# Docs: https://bazel.build/docs/user-manual#show-timestamps
23-
build --show_timestamps
23+
common --show_timestamps
2424

2525
# Only show progress every 60 seconds on CI.
2626
# We want to find a compromise between printing often enough to show that the build isn't stuck,
2727
# but not so often that we produce a long log file that requires a lot of scrolling.
2828
# https://bazel.build/reference/command-line-reference#flag--show_progress_rate_limit
29-
build --show_progress_rate_limit=60
29+
common --show_progress_rate_limit=60
3030

3131
# Use cursor controls in screen output.
3232
# Docs: https://bazel.build/docs/user-manual#curses
33-
build --curses=yes
33+
common --curses=yes
3434

3535
# Use colors to highlight output on the screen. Set to `no` if your CI does not display colors.
3636
# Docs: https://bazel.build/docs/user-manual#color
37-
build --color=yes
37+
common --color=yes
3838

3939
# The terminal width in columns. Configure this to override the default value based on what your CI system renders.
4040
# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/runtime/UiOptions.java#L151
41-
build --terminal_columns=143
41+
common --terminal_columns=143
4242

4343
######################################
4444
# Generic remote cache configuration #
4545
######################################
4646

4747
# Only download remote outputs of top level targets to the local machine.
4848
# Docs: https://bazel.build/reference/command-line-reference#flag--remote_download_toplevel
49-
build --remote_download_toplevel
49+
common --remote_download_toplevel
5050

5151
# The maximum amount of time to wait for remote execution and cache calls.
5252
# https://bazel.build/reference/command-line-reference#flag--remote_timeout
53-
build --remote_timeout=3600
53+
common --remote_timeout=3600
5454

5555
# Upload locally executed action results to the remote cache.
5656
# Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results
57-
build --remote_upload_local_results
57+
common --remote_upload_local_results
5858

5959
# Fall back to standalone local execution strategy if remote execution fails. If the grpc remote
6060
# cache connection fails, it will fail the build, add this so it falls back to the local cache.
6161
# Docs: https://bazel.build/reference/command-line-reference#flag--remote_local_fallback
62-
build --remote_local_fallback
62+
common --remote_local_fallback
6363

6464
# Fixes builds hanging on CI that get the TCP connection closed without sending RST packets.
6565
# Docs: https://bazel.build/reference/command-line-reference#flag--grpc_keepalive_time
66-
build --grpc_keepalive_time=30s
66+
common --grpc_keepalive_time=30s

.aspect/bazelrc/convenience.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Attempt to build & test every target whose prerequisites were successfully built.
22
# Docs: https://bazel.build/docs/user-manual#keep-going
3-
build --keep_going
3+
common --keep_going
44

55
# Output test errors to stderr so users don't have to `cat` or open test failure log files when test
66
# fail. This makes the log noisier in exchange for reducing the time-to-feedback on test failures for
@@ -11,7 +11,7 @@ test --test_output=errors
1111
# Show the output files created by builds that requested more than one target. This helps users
1212
# locate the build outputs in more cases
1313
# Docs: https://bazel.build/docs/user-manual#show-result
14-
build --show_result=20
14+
common --show_result=20
1515

1616
# Bazel picks up host-OS-specific config lines from bazelrc files. For example, if the host OS is
1717
# Linux and you run bazel build, Bazel picks up lines starting with build:linux. Supported OS

.aspect/bazelrc/correctness.bazelrc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# It should be flipped to `--remote_upload_local_results` on CI
44
# by using `--bazelrc=.aspect/bazelrc/ci.bazelrc`.
55
# Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results
6-
build --noremote_upload_local_results
6+
common --noremote_upload_local_results
77

88
# Don't allow network access for build actions in the sandbox.
99
# Ensures that you don't accidentally make non-hermetic actions/tests which depend on remote
1010
# services.
1111
# Developers should tag targets with `tags=["requires-network"]` to opt-out of the enforcement.
1212
# Docs: https://bazel.build/reference/command-line-reference#flag--sandbox_default_allow_network
13-
build --sandbox_default_allow_network=false
13+
common --sandbox_default_allow_network=false
1414

1515
# Warn if a test's timeout is significantly longer than the test's actual execution time.
1616
# Bazel's default for test_timeout is medium (5 min), but most tests should instead be short (1 min).
@@ -40,15 +40,15 @@ test --incompatible_exclusive_test_sandboxed
4040
# Use `--action_env=ENV_VARIABLE` if you want to inherit specific environment variables from the
4141
# client, but note that doing so can prevent cross-user caching if a shared cache is used.
4242
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_strict_action_env
43-
build --incompatible_strict_action_env
43+
common --incompatible_strict_action_env
4444

4545
# Do not automatically create `__init__.py` files in the runfiles of Python targets. Fixes the wrong
4646
# default that comes from Google's internal monorepo by using `__init__.py` to delimit a Python
4747
# package. Precisely, when a `py_binary` or `py_test` target has `legacy_create_init` set to `auto (the
4848
# default), it is treated as false if and only if this flag is set. See
4949
# https://github.com/bazelbuild/bazel/issues/10076.
5050
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_default_to_explicit_init_py
51-
build --incompatible_default_to_explicit_init_py
51+
common --incompatible_default_to_explicit_init_py
5252

5353
# Set default value of `allow_empty` to `False` in `glob()`. This prevents a common mistake when
5454
# attempting to use `glob()` to match files in a subdirectory that is opaque to the current package
@@ -60,5 +60,5 @@ common --incompatible_disallow_empty_glob
6060
# downloaded on test result cache hits when --remote_download_minimal is enabled, making it impossible
6161
# to generate a full coverage report.
6262
# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs
63-
# detching remote cache results
63+
# ditching remote cache results
6464
test --experimental_fetch_all_coverage_outputs

.aspect/bazelrc/performance.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# build.
44
# No longer experimental in Bazel 6: https://github.com/bazelbuild/bazel/commit/c1a95501a5611878e5cc43a3cc531f2b9e47835b
55
# Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories
6-
build --experimental_reuse_sandbox_directories
6+
common --experimental_reuse_sandbox_directories
77

88
# Avoid creating a runfiles tree for binaries or tests until it is needed.
99
# Docs: https://bazel.build/reference/command-line-reference#flag--build_runfile_links
@@ -12,7 +12,7 @@ build --experimental_reuse_sandbox_directories
1212
# This may break local workflows that `build` a binary target, then run the resulting program
1313
# outside of `bazel run`. In those cases, the script will need to call
1414
# `bazel build --build_runfile_links //my/binary:target` and then execute the resulting program.
15-
build --nobuild_runfile_links
15+
common --nobuild_runfile_links
1616

1717
# Needed prior to Bazel 8; see
1818
# https://github.com/bazelbuild/bazel/issues/20577

lib/tests/bazelrc_presets/subset/convenience.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Attempt to build & test every target whose prerequisites were successfully built.
22
# Docs: https://bazel.build/docs/user-manual#keep-going
3-
build --keep_going
3+
common --keep_going
44

55
# Output test errors to stderr so users don't have to `cat` or open test failure log files when test
66
# fail. This makes the log noisier in exchange for reducing the time-to-feedback on test failures for
@@ -11,7 +11,7 @@ test --test_output=errors
1111
# Show the output files created by builds that requested more than one target. This helps users
1212
# locate the build outputs in more cases
1313
# Docs: https://bazel.build/docs/user-manual#show-result
14-
build --show_result=20
14+
common --show_result=20
1515

1616
# Bazel picks up host-OS-specific config lines from bazelrc files. For example, if the host OS is
1717
# Linux and you run bazel build, Bazel picks up lines starting with build:linux. Supported OS

0 commit comments

Comments
 (0)