diff --git a/docs/bazelrc_presets.md b/docs/bazelrc_presets.md index b2d1491..1c9dc3b 100644 --- a/docs/bazelrc_presets.md +++ b/docs/bazelrc_presets.md @@ -7,7 +7,7 @@ Aspect bazelrc presets; see https://docs.aspect.build/guides/bazelrc ## write_aspect_bazelrc_presets
-write_aspect_bazelrc_presets(name, presets) +write_aspect_bazelrc_presets(name, presets, kwargs)Keeps your vendored copy of Aspect recommended `.bazelrc` presets up-to-date. @@ -28,5 +28,6 @@ See https://docs.aspect.build/guides/bazelrc for more info. | :------------- | :------------- | :------------- | | name | a unique name for this target | none | | presets | a list of preset names to keep up-to-date
write_aspect_bazelrc_presets( name = "update_aspect_bazelrc_presets", presets = [ "bazel6", "ci", "convenience", "correctness", "debug", "javascript", "performance", ], )
| ["bazel5", "bazel6", "ci", "convenience", "correctness", "debug", "javascript", "performance"]
|
+| kwargs | Additional arguments to pass to write_source_files
| none |
diff --git a/e2e/bzlmod/.aspect/bazelrc/BUILD.bazel b/e2e/bzlmod/.aspect/bazelrc/BUILD.bazel
index a3e6c28..6d65186 100644
--- a/e2e/bzlmod/.aspect/bazelrc/BUILD.bazel
+++ b/e2e/bzlmod/.aspect/bazelrc/BUILD.bazel
@@ -5,7 +5,6 @@ load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", "write_aspect_bazelrc_presets
write_aspect_bazelrc_presets(
name = "update_aspect_bazelrc_presets",
presets = [
- "ci",
"convenience",
"correctness",
"debug",
diff --git a/e2e/bzlmod/.bazelrc b/e2e/bzlmod/.bazelrc
index da1c792..11798a0 100644
--- a/e2e/bzlmod/.bazelrc
+++ b/e2e/bzlmod/.bazelrc
@@ -2,6 +2,11 @@
# Settings that apply only to CI are in .aspect/bazelrc/ci.bazelrc
# Import Aspect bazelrc presets
+import %workspace%/.aspect/bazelrc/convenience.bazelrc
+import %workspace%/.aspect/bazelrc/correctness.bazelrc
+import %workspace%/.aspect/bazelrc/debug.bazelrc
+import %workspace%/.aspect/bazelrc/javascript.bazelrc
+import %workspace%/.aspect/bazelrc/performance.bazelrc
### PROJECT SPECIFIC OPTIONS ###
diff --git a/e2e/bzlmod_write_source_files_external/.aspect/bazelrc/BUILD.bazel b/e2e/bzlmod_write_source_files_external/.aspect/bazelrc/BUILD.bazel
index a3e6c28..6d65186 100644
--- a/e2e/bzlmod_write_source_files_external/.aspect/bazelrc/BUILD.bazel
+++ b/e2e/bzlmod_write_source_files_external/.aspect/bazelrc/BUILD.bazel
@@ -5,7 +5,6 @@ load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", "write_aspect_bazelrc_presets
write_aspect_bazelrc_presets(
name = "update_aspect_bazelrc_presets",
presets = [
- "ci",
"convenience",
"correctness",
"debug",
diff --git a/e2e/bzlmod_write_source_files_external/.aspect/bazelrc/ci.bazelrc b/e2e/bzlmod_write_source_files_external/.aspect/bazelrc/ci.bazelrc
deleted file mode 100644
index 749c158..0000000
--- a/e2e/bzlmod_write_source_files_external/.aspect/bazelrc/ci.bazelrc
+++ /dev/null
@@ -1,75 +0,0 @@
-# We recommend enforcing a policy that keeps your CI from being slowed down
-# by individual test targets that should be optimized
-# or split up into multiple test targets with sharding or manually.
-# Set this flag to exclude targets that have their timeout set to eternal (>15m) from running on CI.
-# Docs: https://bazel.build/docs/user-manual#test-timeout-filters
-build --test_timeout_filters=-eternal
-
-# Set this flag to enable re-tries of failed tests on CI.
-# When any test target fails, try one or more times. This applies regardless of whether the "flaky"
-# tag appears on the target definition.
-# This is a tradeoff: legitimately failing tests will take longer to report,
-# but we can paper over flaky tests that pass most of the time.
-# The alternative is to mark every flaky test with the `flaky = True` attribute, but this requires
-# the buildcop to make frequent code edits.
-# Not recommended for local builds so that the flakiness is observed during development and thus
-# is more likely to get fixed.
-# Note that when passing after the first attempt, Bazel will give a special "FLAKY" status.
-# Docs: https://bazel.build/docs/user-manual#flaky-test-attempts
-build --flaky_test_attempts=2
-
-# Announce all announces command options read from the bazelrc file(s) when starting up at the
-# beginning of each Bazel invocation. This is very useful on CI to be able to inspect what Bazel rc
-# settings are being applied on each run.
-# Docs: https://bazel.build/docs/user-manual#announce-rc
-build --announce_rc
-
-# Add a timestamp to each message generated by Bazel specifying the time at which the message was
-# displayed.
-# Docs: https://bazel.build/docs/user-manual#show-timestamps
-build --show_timestamps
-
-# Only show progress every 60 seconds on CI.
-# Docs: https://bazel.build/reference/command-line-reference#flag--progress_report_interval
-build --progress_report_interval=60
-
-# Only show progress every 60 seconds on CI.
-# https://bazel.build/reference/command-line-reference#flag--show_progress_rate_limit
-build --show_progress_rate_limit=60
-
-# Don't use cursor controls in its screen output.
-# Docs: https://bazel.build/docs/user-manual#curses
-build --curses=no
-
-# Use colors to highlight its output on the screen. Set to `no` if your CI does not display colors.
-# Docs: https://bazel.build/docs/user-manual#color
-build --color=yes
-
-# The terminal width in columns. Configure this to override the default value based on what your CI system renders.
-# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/runtime/UiOptions.java#L151
-build --terminal_columns=80
-
-######################################
-# Generic remote cache configuration #
-######################################
-
-# Only download remote outputs of top level targets to the local machine.
-# Docs: https://bazel.build/reference/command-line-reference#flag--remote_download_toplevel
-build --remote_download_toplevel
-
-# The maximum amount of time to wait for remote execution and cache calls.
-# https://bazel.build/reference/command-line-reference#flag--remote_timeout
-build --remote_timeout=3600
-
-# Upload locally executed action results to the remote cache.
-# Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results
-build --remote_upload_local_results
-
-# Fall back to standalone local execution strategy if remote execution fails. If the grpc remote
-# cache connection fails, it will fail the build, add this so it falls back to the local cache.
-# Docs: https://bazel.build/reference/command-line-reference#flag--remote_local_fallback
-build --remote_local_fallback
-
-# Fixes builds hanging on CI that get the TCP connection closed without sending RST packets.
-# Docs: https://bazel.build/reference/command-line-reference#flag--grpc_keepalive_time
-build --grpc_keepalive_time=30s
diff --git a/e2e/bzlmod_write_source_files_external/.bazelrc b/e2e/bzlmod_write_source_files_external/.bazelrc
index 9a76c93..a3c465e 100644
--- a/e2e/bzlmod_write_source_files_external/.bazelrc
+++ b/e2e/bzlmod_write_source_files_external/.bazelrc
@@ -4,9 +4,9 @@
# Import Aspect bazelrc presets
import %workspace%/.aspect/bazelrc/convenience.bazelrc
import %workspace%/.aspect/bazelrc/correctness.bazelrc
-import %workspace%/.aspect/bazelrc/performance.bazelrc
import %workspace%/.aspect/bazelrc/debug.bazelrc
import %workspace%/.aspect/bazelrc/javascript.bazelrc
+import %workspace%/.aspect/bazelrc/performance.bazelrc
### PROJECT SPECIFIC OPTIONS ###
diff --git a/e2e/copy_to_directory/.aspect/bazelrc/BUILD.bazel b/e2e/copy_to_directory/.aspect/bazelrc/BUILD.bazel
index a3e6c28..6d65186 100644
--- a/e2e/copy_to_directory/.aspect/bazelrc/BUILD.bazel
+++ b/e2e/copy_to_directory/.aspect/bazelrc/BUILD.bazel
@@ -5,7 +5,6 @@ load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", "write_aspect_bazelrc_presets
write_aspect_bazelrc_presets(
name = "update_aspect_bazelrc_presets",
presets = [
- "ci",
"convenience",
"correctness",
"debug",
diff --git a/e2e/copy_to_directory/.aspect/bazelrc/ci.bazelrc b/e2e/copy_to_directory/.aspect/bazelrc/ci.bazelrc
deleted file mode 100644
index 749c158..0000000
--- a/e2e/copy_to_directory/.aspect/bazelrc/ci.bazelrc
+++ /dev/null
@@ -1,75 +0,0 @@
-# We recommend enforcing a policy that keeps your CI from being slowed down
-# by individual test targets that should be optimized
-# or split up into multiple test targets with sharding or manually.
-# Set this flag to exclude targets that have their timeout set to eternal (>15m) from running on CI.
-# Docs: https://bazel.build/docs/user-manual#test-timeout-filters
-build --test_timeout_filters=-eternal
-
-# Set this flag to enable re-tries of failed tests on CI.
-# When any test target fails, try one or more times. This applies regardless of whether the "flaky"
-# tag appears on the target definition.
-# This is a tradeoff: legitimately failing tests will take longer to report,
-# but we can paper over flaky tests that pass most of the time.
-# The alternative is to mark every flaky test with the `flaky = True` attribute, but this requires
-# the buildcop to make frequent code edits.
-# Not recommended for local builds so that the flakiness is observed during development and thus
-# is more likely to get fixed.
-# Note that when passing after the first attempt, Bazel will give a special "FLAKY" status.
-# Docs: https://bazel.build/docs/user-manual#flaky-test-attempts
-build --flaky_test_attempts=2
-
-# Announce all announces command options read from the bazelrc file(s) when starting up at the
-# beginning of each Bazel invocation. This is very useful on CI to be able to inspect what Bazel rc
-# settings are being applied on each run.
-# Docs: https://bazel.build/docs/user-manual#announce-rc
-build --announce_rc
-
-# Add a timestamp to each message generated by Bazel specifying the time at which the message was
-# displayed.
-# Docs: https://bazel.build/docs/user-manual#show-timestamps
-build --show_timestamps
-
-# Only show progress every 60 seconds on CI.
-# Docs: https://bazel.build/reference/command-line-reference#flag--progress_report_interval
-build --progress_report_interval=60
-
-# Only show progress every 60 seconds on CI.
-# https://bazel.build/reference/command-line-reference#flag--show_progress_rate_limit
-build --show_progress_rate_limit=60
-
-# Don't use cursor controls in its screen output.
-# Docs: https://bazel.build/docs/user-manual#curses
-build --curses=no
-
-# Use colors to highlight its output on the screen. Set to `no` if your CI does not display colors.
-# Docs: https://bazel.build/docs/user-manual#color
-build --color=yes
-
-# The terminal width in columns. Configure this to override the default value based on what your CI system renders.
-# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/runtime/UiOptions.java#L151
-build --terminal_columns=80
-
-######################################
-# Generic remote cache configuration #
-######################################
-
-# Only download remote outputs of top level targets to the local machine.
-# Docs: https://bazel.build/reference/command-line-reference#flag--remote_download_toplevel
-build --remote_download_toplevel
-
-# The maximum amount of time to wait for remote execution and cache calls.
-# https://bazel.build/reference/command-line-reference#flag--remote_timeout
-build --remote_timeout=3600
-
-# Upload locally executed action results to the remote cache.
-# Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results
-build --remote_upload_local_results
-
-# Fall back to standalone local execution strategy if remote execution fails. If the grpc remote
-# cache connection fails, it will fail the build, add this so it falls back to the local cache.
-# Docs: https://bazel.build/reference/command-line-reference#flag--remote_local_fallback
-build --remote_local_fallback
-
-# Fixes builds hanging on CI that get the TCP connection closed without sending RST packets.
-# Docs: https://bazel.build/reference/command-line-reference#flag--grpc_keepalive_time
-build --grpc_keepalive_time=30s
diff --git a/e2e/workspace/.aspect/bazelrc/BUILD.bazel b/e2e/workspace/.aspect/bazelrc/BUILD.bazel
index a3e6c28..6d65186 100644
--- a/e2e/workspace/.aspect/bazelrc/BUILD.bazel
+++ b/e2e/workspace/.aspect/bazelrc/BUILD.bazel
@@ -5,7 +5,6 @@ load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", "write_aspect_bazelrc_presets
write_aspect_bazelrc_presets(
name = "update_aspect_bazelrc_presets",
presets = [
- "ci",
"convenience",
"correctness",
"debug",
diff --git a/e2e/workspace/.aspect/bazelrc/ci.bazelrc b/e2e/workspace/.aspect/bazelrc/ci.bazelrc
deleted file mode 100644
index 749c158..0000000
--- a/e2e/workspace/.aspect/bazelrc/ci.bazelrc
+++ /dev/null
@@ -1,75 +0,0 @@
-# We recommend enforcing a policy that keeps your CI from being slowed down
-# by individual test targets that should be optimized
-# or split up into multiple test targets with sharding or manually.
-# Set this flag to exclude targets that have their timeout set to eternal (>15m) from running on CI.
-# Docs: https://bazel.build/docs/user-manual#test-timeout-filters
-build --test_timeout_filters=-eternal
-
-# Set this flag to enable re-tries of failed tests on CI.
-# When any test target fails, try one or more times. This applies regardless of whether the "flaky"
-# tag appears on the target definition.
-# This is a tradeoff: legitimately failing tests will take longer to report,
-# but we can paper over flaky tests that pass most of the time.
-# The alternative is to mark every flaky test with the `flaky = True` attribute, but this requires
-# the buildcop to make frequent code edits.
-# Not recommended for local builds so that the flakiness is observed during development and thus
-# is more likely to get fixed.
-# Note that when passing after the first attempt, Bazel will give a special "FLAKY" status.
-# Docs: https://bazel.build/docs/user-manual#flaky-test-attempts
-build --flaky_test_attempts=2
-
-# Announce all announces command options read from the bazelrc file(s) when starting up at the
-# beginning of each Bazel invocation. This is very useful on CI to be able to inspect what Bazel rc
-# settings are being applied on each run.
-# Docs: https://bazel.build/docs/user-manual#announce-rc
-build --announce_rc
-
-# Add a timestamp to each message generated by Bazel specifying the time at which the message was
-# displayed.
-# Docs: https://bazel.build/docs/user-manual#show-timestamps
-build --show_timestamps
-
-# Only show progress every 60 seconds on CI.
-# Docs: https://bazel.build/reference/command-line-reference#flag--progress_report_interval
-build --progress_report_interval=60
-
-# Only show progress every 60 seconds on CI.
-# https://bazel.build/reference/command-line-reference#flag--show_progress_rate_limit
-build --show_progress_rate_limit=60
-
-# Don't use cursor controls in its screen output.
-# Docs: https://bazel.build/docs/user-manual#curses
-build --curses=no
-
-# Use colors to highlight its output on the screen. Set to `no` if your CI does not display colors.
-# Docs: https://bazel.build/docs/user-manual#color
-build --color=yes
-
-# The terminal width in columns. Configure this to override the default value based on what your CI system renders.
-# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/runtime/UiOptions.java#L151
-build --terminal_columns=80
-
-######################################
-# Generic remote cache configuration #
-######################################
-
-# Only download remote outputs of top level targets to the local machine.
-# Docs: https://bazel.build/reference/command-line-reference#flag--remote_download_toplevel
-build --remote_download_toplevel
-
-# The maximum amount of time to wait for remote execution and cache calls.
-# https://bazel.build/reference/command-line-reference#flag--remote_timeout
-build --remote_timeout=3600
-
-# Upload locally executed action results to the remote cache.
-# Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results
-build --remote_upload_local_results
-
-# Fall back to standalone local execution strategy if remote execution fails. If the grpc remote
-# cache connection fails, it will fail the build, add this so it falls back to the local cache.
-# Docs: https://bazel.build/reference/command-line-reference#flag--remote_local_fallback
-build --remote_local_fallback
-
-# Fixes builds hanging on CI that get the TCP connection closed without sending RST packets.
-# Docs: https://bazel.build/reference/command-line-reference#flag--grpc_keepalive_time
-build --grpc_keepalive_time=30s
diff --git a/lib/bazelrc_presets.bzl b/lib/bazelrc_presets.bzl
index 46c9d79..271edeb 100644
--- a/lib/bazelrc_presets.bzl
+++ b/lib/bazelrc_presets.bzl
@@ -15,7 +15,8 @@ ALL_PRESETS = [
def write_aspect_bazelrc_presets(
name,
- presets = ALL_PRESETS):
+ presets = ALL_PRESETS,
+ **kwargs):
"""Keeps your vendored copy of Aspect recommended `.bazelrc` presets up-to-date.
This macro uses a [write_source_files](https://docs.aspect.build/rules/aspect_bazel_lib/docs/write_source_files)
@@ -47,6 +48,8 @@ def write_aspect_bazelrc_presets(
],
)
```
+
+ **kwargs: Additional arguments to pass to `write_source_files`
"""
files = {}
@@ -56,4 +59,5 @@ def write_aspect_bazelrc_presets(
write_source_files(
name = name,
files = files,
+ **kwargs
)
diff --git a/lib/tests/bazelrc_presets/all/BUILD.bazel b/lib/tests/bazelrc_presets/all/BUILD.bazel
new file mode 100644
index 0000000..35ec0f2
--- /dev/null
+++ b/lib/tests/bazelrc_presets/all/BUILD.bazel
@@ -0,0 +1,3 @@
+load(":write_aspect_bazelrc_presets.bzl", "write_aspect_bazelrc_presets")
+
+write_aspect_bazelrc_presets(name = "update_aspect_bazelrc_presets")
diff --git a/lib/tests/bazelrc_presets/bazel5.bazelrc b/lib/tests/bazelrc_presets/all/bazel5.bazelrc
similarity index 100%
rename from lib/tests/bazelrc_presets/bazel5.bazelrc
rename to lib/tests/bazelrc_presets/all/bazel5.bazelrc
diff --git a/lib/tests/bazelrc_presets/all/bazel6.bazelrc b/lib/tests/bazelrc_presets/all/bazel6.bazelrc
new file mode 100644
index 0000000..11a1c67
--- /dev/null
+++ b/lib/tests/bazelrc_presets/all/bazel6.bazelrc
@@ -0,0 +1,15 @@
+# Speed up all builds by not checking if external repository files have been modified.
+# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryOptions.java#L244
+build --noexperimental_check_external_repository_files
+fetch --noexperimental_check_external_repository_files
+query --noexperimental_check_external_repository_files
+
+# Directories used by sandboxed non-worker execution may be reused to avoid unnecessary setup costs.
+# Save time on Sandbox creation and deletion when many of the same kind of action run during the
+# build.
+# Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories
+build --reuse_sandbox_directories
+
+# Avoid this flag being enabled by remote_download_minimal or remote_download_toplevel
+# See https://meroton.com/blog/bazel-6-errors-build-without-the-bytes/
+build --noexperimental_action_cache_store_output_metadata
diff --git a/e2e/bzlmod/.aspect/bazelrc/ci.bazelrc b/lib/tests/bazelrc_presets/all/ci.bazelrc
similarity index 100%
rename from e2e/bzlmod/.aspect/bazelrc/ci.bazelrc
rename to lib/tests/bazelrc_presets/all/ci.bazelrc
diff --git a/lib/tests/bazelrc_presets/convenience.bazelrc b/lib/tests/bazelrc_presets/all/convenience.bazelrc
similarity index 100%
rename from lib/tests/bazelrc_presets/convenience.bazelrc
rename to lib/tests/bazelrc_presets/all/convenience.bazelrc
diff --git a/lib/tests/bazelrc_presets/correctness.bazelrc b/lib/tests/bazelrc_presets/all/correctness.bazelrc
similarity index 100%
rename from lib/tests/bazelrc_presets/correctness.bazelrc
rename to lib/tests/bazelrc_presets/all/correctness.bazelrc
diff --git a/lib/tests/bazelrc_presets/debug.bazelrc b/lib/tests/bazelrc_presets/all/debug.bazelrc
similarity index 100%
rename from lib/tests/bazelrc_presets/debug.bazelrc
rename to lib/tests/bazelrc_presets/all/debug.bazelrc
diff --git a/lib/tests/bazelrc_presets/javascript.bazelrc b/lib/tests/bazelrc_presets/all/javascript.bazelrc
similarity index 100%
rename from lib/tests/bazelrc_presets/javascript.bazelrc
rename to lib/tests/bazelrc_presets/all/javascript.bazelrc
diff --git a/lib/tests/bazelrc_presets/performance.bazelrc b/lib/tests/bazelrc_presets/all/performance.bazelrc
similarity index 100%
rename from lib/tests/bazelrc_presets/performance.bazelrc
rename to lib/tests/bazelrc_presets/all/performance.bazelrc
diff --git a/lib/tests/bazelrc_presets/all/write_aspect_bazelrc_presets.bzl b/lib/tests/bazelrc_presets/all/write_aspect_bazelrc_presets.bzl
new file mode 100644
index 0000000..693a022
--- /dev/null
+++ b/lib/tests/bazelrc_presets/all/write_aspect_bazelrc_presets.bzl
@@ -0,0 +1,11 @@
+"Simple wrapper around write_aspect_bazelrc_presets for testing"
+
+load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", _write_aspect_bazelrc_presets = "write_aspect_bazelrc_presets")
+load("@aspect_bazel_lib_host//:defs.bzl", "host")
+
+def write_aspect_bazelrc_presets(**kwargs):
+ if host.bazel_version[0] != "5":
+ # Don't stamp this target out if we're testing against Bazel 5. The bazel6.bazelrc file is
+ # deleted on CI when testing Bazel 5 which breaks analysis for this target. See
+ # https://github.com/aspect-build/bazel-lib/blob/fff5f10ad8e6921a45816e256f588d8020b3f2ee/.github/workflows/ci.yaml#L145.
+ _write_aspect_bazelrc_presets(**kwargs)
diff --git a/lib/tests/bazelrc_presets/ci.bazelrc b/lib/tests/bazelrc_presets/ci.bazelrc
deleted file mode 100644
index 749c158..0000000
--- a/lib/tests/bazelrc_presets/ci.bazelrc
+++ /dev/null
@@ -1,75 +0,0 @@
-# We recommend enforcing a policy that keeps your CI from being slowed down
-# by individual test targets that should be optimized
-# or split up into multiple test targets with sharding or manually.
-# Set this flag to exclude targets that have their timeout set to eternal (>15m) from running on CI.
-# Docs: https://bazel.build/docs/user-manual#test-timeout-filters
-build --test_timeout_filters=-eternal
-
-# Set this flag to enable re-tries of failed tests on CI.
-# When any test target fails, try one or more times. This applies regardless of whether the "flaky"
-# tag appears on the target definition.
-# This is a tradeoff: legitimately failing tests will take longer to report,
-# but we can paper over flaky tests that pass most of the time.
-# The alternative is to mark every flaky test with the `flaky = True` attribute, but this requires
-# the buildcop to make frequent code edits.
-# Not recommended for local builds so that the flakiness is observed during development and thus
-# is more likely to get fixed.
-# Note that when passing after the first attempt, Bazel will give a special "FLAKY" status.
-# Docs: https://bazel.build/docs/user-manual#flaky-test-attempts
-build --flaky_test_attempts=2
-
-# Announce all announces command options read from the bazelrc file(s) when starting up at the
-# beginning of each Bazel invocation. This is very useful on CI to be able to inspect what Bazel rc
-# settings are being applied on each run.
-# Docs: https://bazel.build/docs/user-manual#announce-rc
-build --announce_rc
-
-# Add a timestamp to each message generated by Bazel specifying the time at which the message was
-# displayed.
-# Docs: https://bazel.build/docs/user-manual#show-timestamps
-build --show_timestamps
-
-# Only show progress every 60 seconds on CI.
-# Docs: https://bazel.build/reference/command-line-reference#flag--progress_report_interval
-build --progress_report_interval=60
-
-# Only show progress every 60 seconds on CI.
-# https://bazel.build/reference/command-line-reference#flag--show_progress_rate_limit
-build --show_progress_rate_limit=60
-
-# Don't use cursor controls in its screen output.
-# Docs: https://bazel.build/docs/user-manual#curses
-build --curses=no
-
-# Use colors to highlight its output on the screen. Set to `no` if your CI does not display colors.
-# Docs: https://bazel.build/docs/user-manual#color
-build --color=yes
-
-# The terminal width in columns. Configure this to override the default value based on what your CI system renders.
-# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/runtime/UiOptions.java#L151
-build --terminal_columns=80
-
-######################################
-# Generic remote cache configuration #
-######################################
-
-# Only download remote outputs of top level targets to the local machine.
-# Docs: https://bazel.build/reference/command-line-reference#flag--remote_download_toplevel
-build --remote_download_toplevel
-
-# The maximum amount of time to wait for remote execution and cache calls.
-# https://bazel.build/reference/command-line-reference#flag--remote_timeout
-build --remote_timeout=3600
-
-# Upload locally executed action results to the remote cache.
-# Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results
-build --remote_upload_local_results
-
-# Fall back to standalone local execution strategy if remote execution fails. If the grpc remote
-# cache connection fails, it will fail the build, add this so it falls back to the local cache.
-# Docs: https://bazel.build/reference/command-line-reference#flag--remote_local_fallback
-build --remote_local_fallback
-
-# Fixes builds hanging on CI that get the TCP connection closed without sending RST packets.
-# Docs: https://bazel.build/reference/command-line-reference#flag--grpc_keepalive_time
-build --grpc_keepalive_time=30s
diff --git a/lib/tests/bazelrc_presets/BUILD.bazel b/lib/tests/bazelrc_presets/subset/BUILD.bazel
similarity index 56%
rename from lib/tests/bazelrc_presets/BUILD.bazel
rename to lib/tests/bazelrc_presets/subset/BUILD.bazel
index 019a4f6..3304432 100644
--- a/lib/tests/bazelrc_presets/BUILD.bazel
+++ b/lib/tests/bazelrc_presets/subset/BUILD.bazel
@@ -1,16 +1,10 @@
-"Aspect bazelrc presets; see https://docs.aspect.build/guides/bazelrc"
-
load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", "write_aspect_bazelrc_presets")
write_aspect_bazelrc_presets(
name = "update_aspect_bazelrc_presets",
presets = [
+ # Just pick a few to test the `presets` attribute
"bazel5",
- "ci",
- "convenience",
- "correctness",
- "debug",
"javascript",
- "performance",
],
)
diff --git a/lib/tests/bazelrc_presets/subset/bazel5.bazelrc b/lib/tests/bazelrc_presets/subset/bazel5.bazelrc
new file mode 100644
index 0000000..c9d7744
--- /dev/null
+++ b/lib/tests/bazelrc_presets/subset/bazel5.bazelrc
@@ -0,0 +1,5 @@
+# Performance improvement for WORKSPACE evaluation
+# of slow rulesets, for example rules_k8s has been
+# observed to take 10 seconds without this flag.
+# See https://github.com/bazelbuild/bazel/issues/13907
+common --incompatible_existing_rules_immutable_view
diff --git a/lib/tests/bazelrc_presets/subset/javascript.bazelrc b/lib/tests/bazelrc_presets/subset/javascript.bazelrc
new file mode 100644
index 0000000..dc76864
--- /dev/null
+++ b/lib/tests/bazelrc_presets/subset/javascript.bazelrc
@@ -0,0 +1,28 @@
+# Aspect recommended Bazel flags when using Aspect's JavaScript rules: https://github.com/aspect-build/rules_js
+# Docs for Node.js flags: https://nodejs.org/en/docs/guides/debugging-getting-started/#command-line-options
+
+# Support for debugging Node.js tests. Use bazel run with `--config=debug` to turn on the NodeJS
+# inspector agent. The node process will break before user code starts and wait for the debugger to
+# connect. Pass the --inspect-brk option to all tests which enables the node inspector agent. See
+# https://nodejs.org/de/docs/guides/debugging-getting-started/#command-line-options for more
+# details.
+# Docs: https://nodejs.org/en/docs/guides/debugging-getting-started/#command-line-options
+run:debug -- --node_options=--inspect-brk
+
+# Enable runfiles on all platforms. Runfiles are on by default on Linux and MacOS but off on
+# Windows.
+#
+# In general, rules_js and derivate rule sets assume that runfiles are enabled and do not support no
+# runfiles case because it does not scale to teach all Node.js tools to use the runfiles manifest.
+#
+# If you are developing on Windows, you must either run bazel with administrator privileges or
+# enable developer mode. If you do not you may hit this error on Windows:
+#
+# Bazel needs to create symlinks to build the runfiles tree.
+# Creating symlinks on Windows requires one of the following:
+# 1. Bazel is run with administrator privileges.
+# 2. The system version is Windows 10 Creators Update (1703) or later
+# and developer mode is enabled.
+#
+# Docs: https://bazel.build/reference/command-line-reference#flag--enable_runfiles
+build --enable_runfiles