mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 12:51:55 +00:00
bazel: upgrade rulesets, use aspect recommended bazelrc (#47856)
Some upgrades to aspect rules and using the new `write_aspect_bazelrc_presets` to use the latest recommended bazelrc settings. If those settings change when upgrading `bazel-lib` tests will fail until you run `bazel run //.aspect/bazelrc:update_aspect_bazelrc_presets`, this way the recommended settings stay up to date but tests will fail until you opt-in. ## Test plan CI
This commit is contained in:
parent
05b10631c6
commit
3ee6f78b3a
15
.aspect/bazelrc/BUILD.bazel
Normal file
15
.aspect/bazelrc/BUILD.bazel
Normal file
@ -0,0 +1,15 @@
|
||||
"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 = [
|
||||
"bazel6",
|
||||
"convenience",
|
||||
"correctness",
|
||||
"debug",
|
||||
"javascript",
|
||||
"performance",
|
||||
],
|
||||
)
|
||||
@ -1,21 +1,15 @@
|
||||
# Aspect recommended Bazel 6 only flags for all projects
|
||||
# Aspect's ".bazelrc flags you should enable" blog post: https://blog.aspect.dev/bazelrc-flags
|
||||
# Docs for Bazel flags: https://bazel.build/docs/user-manual & https://bazel.build/reference/command-line-reference
|
||||
|
||||
####################################################################################################
|
||||
# Performance
|
||||
# --
|
||||
# Miscellaneous settings that improve performance
|
||||
####################################################################################################
|
||||
|
||||
# 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
|
||||
build --noexperimental_check_external_repository_files
|
||||
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
|
||||
@ -1,199 +0,0 @@
|
||||
# Aspect recommended Bazel flags for all projects for all Bazel versions
|
||||
# Aspect's ".bazelrc flags you should enable" blog post: https://blog.aspect.dev/bazelrc-flags
|
||||
# Docs for Bazel flags: https://bazel.build/docs/user-manual & https://bazel.build/reference/command-line-reference
|
||||
|
||||
####################################################################################################
|
||||
# Debugging
|
||||
# --
|
||||
# Use --config=debug with `bazel test` or `bazel run` to use these settings
|
||||
####################################################################################################
|
||||
|
||||
# Stream stdout/stderr output from each test in real-time.
|
||||
# Docs: https://bazel.build/docs/user-manual#test-output
|
||||
test:debug --test_output=streamed
|
||||
|
||||
# Run one test at a time.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--test_strategy
|
||||
test:debug --test_strategy=exclusive
|
||||
|
||||
# Prevent long running tests from timing out.
|
||||
# Docs: https://bazel.build/docs/user-manual#test-timeout
|
||||
test:debug --test_timeout=9999
|
||||
|
||||
# Always run tests even if they have cached results.
|
||||
# Docs: https://bazel.build/docs/user-manual#cache-test-results
|
||||
test:debug --nocache_test_results
|
||||
|
||||
####################################################################################################
|
||||
# Performance
|
||||
# --
|
||||
# Miscellaneous settings that improve performance
|
||||
####################################################################################################
|
||||
|
||||
# Merkle tree calculations will be memoized to improve the remote cache hit checking speed. The
|
||||
# memory foot print of the cache is controlled by `--experimental_remote_merkle_tree_cache_size`.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_remote_merkle_tree_cache
|
||||
build --experimental_remote_merkle_tree_cache
|
||||
query --experimental_remote_merkle_tree_cache
|
||||
|
||||
# The number of Merkle trees to memoize to improve the remote cache hit checking speed. Even though
|
||||
# the cache is automatically pruned according to Java's handling of soft references, out-of-memory
|
||||
# errors can occur if set too high. If set to 0 the cache size is unlimited. Optimal value varies
|
||||
# depending on project's size.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_remote_merkle_tree_cache_size
|
||||
build --experimental_remote_merkle_tree_cache_size=1000
|
||||
query --experimental_remote_merkle_tree_cache_size=1000
|
||||
|
||||
# Speed up all builds by not checking if output files have been modified. Lets you make changes to
|
||||
# the output tree without triggering a build for local debugging. For example, you can modify
|
||||
# [rules_js](https://github.com/aspect-build/rules_js) 3rd party npm packages in the output tree
|
||||
# when local debugging.
|
||||
# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/pkgcache/PackageOptions.java#L185
|
||||
build --noexperimental_check_output_files
|
||||
fetch --noexperimental_check_output_files
|
||||
query --noexperimental_check_output_files
|
||||
|
||||
# Don't apply `--noremote_upload_local_results` and `--noremote_accept_cached` to the disk cache.
|
||||
# If you have both `--noremote_upload_local_results` and `--disk_cache`, then this fixes a bug where
|
||||
# Bazel doesn't write to the local disk cache as it treats as a remote cache.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_remote_results_ignore_disk
|
||||
build --incompatible_remote_results_ignore_disk
|
||||
|
||||
# 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.
|
||||
# No longer experimental in Bazel 6: https://github.com/bazelbuild/bazel/commit/c1a95501a5611878e5cc43a3cc531f2b9e47835b
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories
|
||||
build --experimental_reuse_sandbox_directories
|
||||
|
||||
# Avoid waiting on `Waiting for build events upload: Build Event Service`. Don't make the user wait
|
||||
# for uploads, instead allow the bazel command to complete and exit.
|
||||
# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceOptions.java#L133
|
||||
build --bes_upload_mode=fully_async
|
||||
|
||||
# Do not build runfiles symlink forests for external repositories under
|
||||
# `.runfiles/wsname/external/repo` (in addition to `.runfiles/repo`). This reduces runfiles &
|
||||
# sandbox creation times & prevents accidentally depending on this feature which may flip to off by
|
||||
# default in the future. Note, some rules may fail under this flag, please file issues with the rule
|
||||
# author.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--legacy_external_runfiles
|
||||
build --nolegacy_external_runfiles
|
||||
run --nolegacy_external_runfiles
|
||||
test --nolegacy_external_runfiles
|
||||
|
||||
# Some actions are always IO-intensive but require little compute. It's wasteful to put the output
|
||||
# in the remote cache, it just saturates the network and fills the cache storage causing earlier
|
||||
# evictions. It's also not worth sending them for remote execution. For actions like PackageTar it's
|
||||
# faster to just re-run the work locally every time. You'll have to look at an execution log to
|
||||
# figure out what other action mnemonics you care about.
|
||||
# https://bazel.build/reference/command-line-reference#flag--modify_execution_info
|
||||
build --modify_execution_info=PackageTar=+no-remote
|
||||
|
||||
####################################################################################################
|
||||
# Correctness
|
||||
# --
|
||||
# Flags that affect correctness
|
||||
####################################################################################################
|
||||
|
||||
# Do not upload locally executed action results to the remote cache. This should be the default for
|
||||
# local builds so local builds cannot poison the remote cache. It should be flipped to
|
||||
# `--remote_upload_local_results` on CI by using `--bazelrc=.aspect/bazelrc/ci.bazelrc`.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results
|
||||
build --noremote_upload_local_results
|
||||
|
||||
# Don't allow network access for build actions in the sandbox.
|
||||
# Ensures that you don't accidentally make non-hermetic actions/tests which depend on remote
|
||||
# services. Tag an individual target with `tags=["requires-network"]` to opt-out of the enforcement.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--sandbox_default_allow_network
|
||||
build --sandbox_default_allow_network=false
|
||||
test --sandbox_default_allow_network=false
|
||||
|
||||
# Warn if a test's timeout is significantly longer than the test's actual execution time. Bazel's
|
||||
# default for test_timeout is medium (5 min), but most tests should instead be short (1 min). While
|
||||
# a test's timeout should be set such that it is not flaky, a test that has a highly over-generous
|
||||
# timeout can hide real problems that crop up unexpectedly. For instance, a test that normally
|
||||
# executes in a minute or two should not have a timeout of ETERNAL or LONG as these are much, much
|
||||
# too generous.
|
||||
# Docs: https://bazel.build/docs/user-manual#test-verbose-timeout-warnings
|
||||
test --test_verbose_timeout_warnings
|
||||
|
||||
# Allow the Bazel server to check directory sources for changes. Ensures that the Bazel server
|
||||
# notices when a directory changes, if you have a directory listed in the srcs of some target.
|
||||
# Recommended when using
|
||||
# [copy_directory](https://github.com/aspect-build/bazel-lib/blob/main/docs/copy_directory.md) and
|
||||
# [rules_js](https://github.com/aspect-build/rules_js) since npm package are source directories
|
||||
# inputs to copy_directory actions.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--host_jvm_args
|
||||
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1
|
||||
|
||||
# Allow exclusive tests to run in the sandbox. Fixes a bug where Bazel doesn't enable sandboxing for
|
||||
# tests with `tags=["exclusive"]`.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_exclusive_test_sandboxed
|
||||
test --incompatible_exclusive_test_sandboxed
|
||||
|
||||
# Use a static value for `PATH` and does not inherit `LD_LIBRARY_PATH`. Doesn't let environment
|
||||
# variables like `PATH` sneak into the build, which can cause massive cache misses when they change.
|
||||
# Use `--action_env=ENV_VARIABLE` if you want to inherit specific environment variables from the
|
||||
# client, but note that doing so can prevent cross-user caching if a shared cache is used.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_strict_action_env
|
||||
build --incompatible_strict_action_env
|
||||
|
||||
# Propagated tags from a target to the actions' execution requirements. Ensures that tags applied in
|
||||
# your BUILD file, like `tags=["no-remote"]` get propagated to actions created by the rule. Without
|
||||
# this option, you rely on rules authors to manually check the tags you passed and apply relevant
|
||||
# ones to the actions they create. See https://github.com/bazelbuild/bazel/issues/8830 for details.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_allow_tags_propagation
|
||||
build --experimental_allow_tags_propagation
|
||||
fetch --experimental_allow_tags_propagation
|
||||
query --experimental_allow_tags_propagation
|
||||
|
||||
# Checking the ctime of input files of an action before uploading it to a remote cache. Prevents
|
||||
# concurrent local file modification from poisoning the build cache.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_guard_against_concurrent_changes
|
||||
build --experimental_guard_against_concurrent_changes
|
||||
|
||||
# Do not automatically create `__init__.py` files in the runfiles of Python targets. Fixes the wrong
|
||||
# default that comes from Google's internal monorepo by using `__init__.py` to delimit a Python
|
||||
# package. Precisely, when a `py_binary` or `py_test` target has `legacy_create_init` set to `auto (the
|
||||
# default), it is treated as false if and only if this flag is set. See
|
||||
# https://github.com/bazelbuild/bazel/issues/10076.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_default_to_explicit_init_py
|
||||
build --incompatible_default_to_explicit_init_py
|
||||
|
||||
####################################################################################################
|
||||
# Convenience
|
||||
# --
|
||||
# Miscellaneous convenience settings
|
||||
####################################################################################################
|
||||
|
||||
# Attempt to build & test every target whose prerequisites were successfully built.
|
||||
# Docs: https://bazel.build/docs/user-manual#keep-going
|
||||
build --keep_going
|
||||
test --keep_going
|
||||
|
||||
# Output test errors to stderr so users don't have to `cat` or open test failure log files when test
|
||||
# fail. This makes the log noiser in exchange for reducing the time-to-feedback on test failures for
|
||||
# users.
|
||||
# Docs: https://bazel.build/docs/user-manual#test-output
|
||||
test --test_output=errors
|
||||
|
||||
# Show the output files created by builds that requested more than one target. This helps users
|
||||
# locate the build outputs in more cases
|
||||
# Docs: https://bazel.build/docs/user-manual#show-result
|
||||
build --show_result=20
|
||||
|
||||
# Bazel picks up host-OS-specific config lines from bazelrc files. For example, if the host OS is
|
||||
# Linux and you run bazel build, Bazel picks up lines starting with build:linux. Supported OS
|
||||
# identifiers are `linux`, `macos`, `windows`, `freebsd`, and `openbsd`. Enabling this flag is
|
||||
# equivalent to using `--config=linux` on Linux, `--config=windows` on Windows, etc.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config
|
||||
build --enable_platform_specific_config
|
||||
fetch --enable_platform_specific_config
|
||||
test --enable_platform_specific_config
|
||||
query --enable_platform_specific_config
|
||||
|
||||
# Output a heap dump if an OOM is thrown during a Bazel invocation (including OOMs due to
|
||||
# `--experimental_oom_more_eagerly_threshold`). The dump will be written to
|
||||
# `<output_base>/<invocation_id>.heapdump.hprof`.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--heap_dump_on_oom
|
||||
build --heap_dump_on_oom
|
||||
29
.aspect/bazelrc/convenience.bazelrc
Normal file
29
.aspect/bazelrc/convenience.bazelrc
Normal file
@ -0,0 +1,29 @@
|
||||
# Attempt to build & test every target whose prerequisites were successfully built.
|
||||
# Docs: https://bazel.build/docs/user-manual#keep-going
|
||||
build --keep_going
|
||||
test --keep_going
|
||||
|
||||
# Output test errors to stderr so users don't have to `cat` or open test failure log files when test
|
||||
# fail. This makes the log noiser in exchange for reducing the time-to-feedback on test failures for
|
||||
# users.
|
||||
# Docs: https://bazel.build/docs/user-manual#test-output
|
||||
test --test_output=errors
|
||||
|
||||
# Show the output files created by builds that requested more than one target. This helps users
|
||||
# locate the build outputs in more cases
|
||||
# Docs: https://bazel.build/docs/user-manual#show-result
|
||||
build --show_result=20
|
||||
|
||||
# Bazel picks up host-OS-specific config lines from bazelrc files. For example, if the host OS is
|
||||
# Linux and you run bazel build, Bazel picks up lines starting with build:linux. Supported OS
|
||||
# identifiers are `linux`, `macos`, `windows`, `freebsd`, and `openbsd`. Enabling this flag is
|
||||
# equivalent to using `--config=linux` on Linux, `--config=windows` on Windows, etc.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config
|
||||
common --enable_platform_specific_config
|
||||
|
||||
# Output a heap dump if an OOM is thrown during a Bazel invocation
|
||||
# (including OOMs due to `--experimental_oom_more_eagerly_threshold`).
|
||||
# The dump will be written to `<output_base>/<invocation_id>.heapdump.hprof`.
|
||||
# You may need to configure CI to capture this artifact and upload for later use.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--heap_dump_on_oom
|
||||
build --heap_dump_on_oom
|
||||
68
.aspect/bazelrc/correctness.bazelrc
Normal file
68
.aspect/bazelrc/correctness.bazelrc
Normal file
@ -0,0 +1,68 @@
|
||||
# Do not upload locally executed action results to the remote cache.
|
||||
# This should be the default for local builds so local builds cannot poison the remote cache.
|
||||
# It should be flipped to `--remote_upload_local_results` on CI
|
||||
# by using `--bazelrc=.aspect/bazelrc/ci.bazelrc`.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results
|
||||
build --noremote_upload_local_results
|
||||
|
||||
# Don't allow network access for build actions in the sandbox.
|
||||
# Ensures that you don't accidentally make non-hermetic actions/tests which depend on remote
|
||||
# services.
|
||||
# Developers should tag targets with `tags=["requires-network"]` to opt-out of the enforcement.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--sandbox_default_allow_network
|
||||
build --sandbox_default_allow_network=false
|
||||
test --sandbox_default_allow_network=false
|
||||
|
||||
# Warn if a test's timeout is significantly longer than the test's actual execution time.
|
||||
# Bazel's default for test_timeout is medium (5 min), but most tests should instead be short (1 min).
|
||||
# While a test's timeout should be set such that it is not flaky, a test that has a highly
|
||||
# over-generous timeout can hide real problems that crop up unexpectedly.
|
||||
# For instance, a test that normally executes in a minute or two should not have a timeout of
|
||||
# ETERNAL or LONG as these are much, much too generous.
|
||||
# Docs: https://bazel.build/docs/user-manual#test-verbose-timeout-warnings
|
||||
test --test_verbose_timeout_warnings
|
||||
|
||||
# Allow the Bazel server to check directory sources for changes. Ensures that the Bazel server
|
||||
# notices when a directory changes, if you have a directory listed in the srcs of some target.
|
||||
# Recommended when using
|
||||
# [copy_directory](https://github.com/aspect-build/bazel-lib/blob/main/docs/copy_directory.md) and
|
||||
# [rules_js](https://github.com/aspect-build/rules_js) since npm package are source directories
|
||||
# inputs to copy_directory actions.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--host_jvm_args
|
||||
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1
|
||||
|
||||
# Allow exclusive tests to run in the sandbox. Fixes a bug where Bazel doesn't enable sandboxing for
|
||||
# tests with `tags=["exclusive"]`.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_exclusive_test_sandboxed
|
||||
test --incompatible_exclusive_test_sandboxed
|
||||
|
||||
# Use a static value for `PATH` and does not inherit `LD_LIBRARY_PATH`. Doesn't let environment
|
||||
# variables like `PATH` sneak into the build, which can cause massive cache misses when they change.
|
||||
# Use `--action_env=ENV_VARIABLE` if you want to inherit specific environment variables from the
|
||||
# client, but note that doing so can prevent cross-user caching if a shared cache is used.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_strict_action_env
|
||||
build --incompatible_strict_action_env
|
||||
|
||||
# Propagate tags from a target declaration to the actions' execution requirements.
|
||||
# Ensures that tags applied in your BUILD file, like `tags=["no-remote"]`
|
||||
# get propagated to actions created by the rule.
|
||||
# Without this option, you rely on rules authors to manually check the tags you passed
|
||||
# and apply relevant ones to the actions they create.
|
||||
# See https://github.com/bazelbuild/bazel/issues/8830 for details.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_allow_tags_propagation
|
||||
build --experimental_allow_tags_propagation
|
||||
fetch --experimental_allow_tags_propagation
|
||||
query --experimental_allow_tags_propagation
|
||||
|
||||
# Checking the ctime of input files of an action before uploading it to a remote cache. Prevents
|
||||
# concurrent local file modification from poisoning the build cache.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_guard_against_concurrent_changes
|
||||
build --experimental_guard_against_concurrent_changes
|
||||
|
||||
# Do not automatically create `__init__.py` files in the runfiles of Python targets. Fixes the wrong
|
||||
# default that comes from Google's internal monorepo by using `__init__.py` to delimit a Python
|
||||
# package. Precisely, when a `py_binary` or `py_test` target has `legacy_create_init` set to `auto (the
|
||||
# default), it is treated as false if and only if this flag is set. See
|
||||
# https://github.com/bazelbuild/bazel/issues/10076.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_default_to_explicit_init_py
|
||||
build --incompatible_default_to_explicit_init_py
|
||||
19
.aspect/bazelrc/debug.bazelrc
Normal file
19
.aspect/bazelrc/debug.bazelrc
Normal file
@ -0,0 +1,19 @@
|
||||
############################################################
|
||||
# Use `bazel test --config=debug` to enable these settings #
|
||||
############################################################
|
||||
|
||||
# Stream stdout/stderr output from each test in real-time.
|
||||
# Docs: https://bazel.build/docs/user-manual#test-output
|
||||
test:debug --test_output=streamed
|
||||
|
||||
# Run one test at a time.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--test_strategy
|
||||
test:debug --test_strategy=exclusive
|
||||
|
||||
# Prevent long running tests from timing out.
|
||||
# Docs: https://bazel.build/docs/user-manual#test-timeout
|
||||
test:debug --test_timeout=9999
|
||||
|
||||
# Always run tests even if they have cached results.
|
||||
# Docs: https://bazel.build/docs/user-manual#cache-test-results
|
||||
test:debug --nocache_test_results
|
||||
@ -1,14 +1,6 @@
|
||||
# Aspect recommended Bazel flags for JavaScript projects for all Bazel versions
|
||||
# Aspect's JavaScript rules: https://github.com/aspect-build/rules_js
|
||||
# Docs for Bazel flags: https://bazel.build/docs/user-manual & https://bazel.build/reference/command-line-reference
|
||||
# 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
|
||||
|
||||
####################################################################################################
|
||||
# Debugging
|
||||
# --
|
||||
# Use --config=debug with `bazel test` or `bazel run` to use these settings
|
||||
####################################################################################################
|
||||
|
||||
# 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
|
||||
@ -17,12 +9,6 @@
|
||||
# Docs: https://nodejs.org/en/docs/guides/debugging-getting-started/#command-line-options
|
||||
run:debug -- --node_options=--inspect-brk
|
||||
|
||||
####################################################################################################
|
||||
# Correctness
|
||||
# --
|
||||
# Flags that affect correctness
|
||||
####################################################################################################
|
||||
|
||||
# Enable runfiles on all platforms. Runfiles are on by default on Linux and MacOS but off on
|
||||
# Windows.
|
||||
#
|
||||
|
||||
54
.aspect/bazelrc/performance.bazelrc
Normal file
54
.aspect/bazelrc/performance.bazelrc
Normal file
@ -0,0 +1,54 @@
|
||||
# Merkle tree calculations will be memoized to improve the remote cache hit checking speed. The
|
||||
# memory foot print of the cache is controlled by `--experimental_remote_merkle_tree_cache_size`.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_remote_merkle_tree_cache
|
||||
build --experimental_remote_merkle_tree_cache
|
||||
query --experimental_remote_merkle_tree_cache
|
||||
|
||||
# The number of Merkle trees to memoize to improve the remote cache hit checking speed. Even though
|
||||
# the cache is automatically pruned according to Java's handling of soft references, out-of-memory
|
||||
# errors can occur if set too high. If set to 0 the cache size is unlimited. Optimal value varies
|
||||
# depending on project's size.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--experimental_remote_merkle_tree_cache_size
|
||||
build --experimental_remote_merkle_tree_cache_size=1000
|
||||
query --experimental_remote_merkle_tree_cache_size=1000
|
||||
|
||||
# Speed up all builds by not checking if output files have been modified. Lets you make changes to
|
||||
# the output tree without triggering a build for local debugging. For example, you can modify
|
||||
# [rules_js](https://github.com/aspect-build/rules_js) 3rd party npm packages in the output tree
|
||||
# when local debugging.
|
||||
# Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/pkgcache/PackageOptions.java#L185
|
||||
build --noexperimental_check_output_files
|
||||
fetch --noexperimental_check_output_files
|
||||
query --noexperimental_check_output_files
|
||||
|
||||
# Don't apply `--noremote_upload_local_results` and `--noremote_accept_cached` to the disk cache.
|
||||
# If you have both `--noremote_upload_local_results` and `--disk_cache`, then this fixes a bug where
|
||||
# Bazel doesn't write to the local disk cache as it treats as a remote cache.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_remote_results_ignore_disk
|
||||
build --incompatible_remote_results_ignore_disk
|
||||
|
||||
# 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.
|
||||
# No longer experimental in Bazel 6: https://github.com/bazelbuild/bazel/commit/c1a95501a5611878e5cc43a3cc531f2b9e47835b
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories
|
||||
build --experimental_reuse_sandbox_directories
|
||||
|
||||
# Do not build runfiles symlink forests for external repositories under
|
||||
# `.runfiles/wsname/external/repo` (in addition to `.runfiles/repo`). This reduces runfiles &
|
||||
# sandbox creation times & prevents accidentally depending on this feature which may flip to off by
|
||||
# default in the future. Note, some rules may fail under this flag, please file issues with the rule
|
||||
# author.
|
||||
# Docs: https://bazel.build/reference/command-line-reference#flag--legacy_external_runfiles
|
||||
build --nolegacy_external_runfiles
|
||||
run --nolegacy_external_runfiles
|
||||
test --nolegacy_external_runfiles
|
||||
|
||||
# Some actions are always IO-intensive but require little compute. It's wasteful to put the output
|
||||
# in the remote cache, it just saturates the network and fills the cache storage causing earlier
|
||||
# evictions. It's also not worth sending them for remote execution.
|
||||
# For actions like PackageTar it's usually faster to just re-run the work locally every time.
|
||||
# You'll have to look at an execution log to figure out what other action mnemonics you care about.
|
||||
# In some cases you may need to patch rulesets to add a mnemonic to actions that don't have one.
|
||||
# https://bazel.build/reference/command-line-reference#flag--modify_execution_info
|
||||
build --modify_execution_info=PackageTar=+no-remote
|
||||
12
.bazelrc
12
.bazelrc
@ -1,11 +1,11 @@
|
||||
# Import Aspect recommended Bazel settings for all projects
|
||||
import %workspace%/.aspect/bazelrc/common.bazelrc
|
||||
# Import Aspect bazelrc presets
|
||||
|
||||
# Import Aspect recommended Bazel 6 only settings for all projects
|
||||
import %workspace%/.aspect/bazelrc/common6.bazelrc
|
||||
|
||||
# Import Aspect recommended Bazel settings for JavaScript projects
|
||||
import %workspace%/.aspect/bazelrc/bazel6.bazelrc
|
||||
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
|
||||
|
||||
### YOUR PROJECT SPECIFIC SETTINGS GO HERE ###
|
||||
|
||||
|
||||
34
WORKSPACE
34
WORKSPACE
@ -13,11 +13,18 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
|
||||
|
||||
bazel_skylib_workspace()
|
||||
|
||||
http_archive(
|
||||
name = "aspect_bazel_lib",
|
||||
sha256 = "dce068f085e9eabfec6d795caaabdbbe4a73550810f3cae3035aff7162e42b3c",
|
||||
strip_prefix = "bazel-lib-1.26.2",
|
||||
url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.26.2/bazel-lib-v1.26.2.tar.gz",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "aspect_rules_js",
|
||||
sha256 = "ad666b12324bab8bc151772bb2eff9aadace7bfd4d624157c2ac3931860d1c95",
|
||||
strip_prefix = "rules_js-1.11.1",
|
||||
url = "https://github.com/aspect-build/rules_js/archive/refs/tags/v1.11.1.tar.gz",
|
||||
sha256 = "9fadde0ae6e0101755b8aedabf7d80b166491a8de297c60f6a5179cd0d0fea58",
|
||||
strip_prefix = "rules_js-1.20.0",
|
||||
url = "https://github.com/aspect-build/rules_js/releases/download/v1.20.0/rules_js-v1.20.0.tar.gz",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
@ -28,16 +35,16 @@ http_archive(
|
||||
|
||||
http_archive(
|
||||
name = "aspect_rules_ts",
|
||||
sha256 = "e81f37c4fe014fc83229e619360d51bfd6cb8ac405a7e8018b4a362efa79d000",
|
||||
strip_prefix = "rules_ts-1.0.4",
|
||||
url = "https://github.com/aspect-build/rules_ts/archive/refs/tags/v1.0.4.tar.gz",
|
||||
sha256 = "db77d904284d21121ae63dbaaadfd8c75ff6d21ad229f92038b415c1ad5019cc",
|
||||
strip_prefix = "rules_ts-1.3.0",
|
||||
url = "https://github.com/aspect-build/rules_ts/releases/download/v1.3.0/rules_ts-v1.3.0.tar.gz",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "aspect_rules_jest",
|
||||
sha256 = "f2be891d9b38473f08a336e5f6ca327bfdc90411b1798a1c476c6f6ceae54520",
|
||||
strip_prefix = "rules_jest-0.13.1",
|
||||
url = "https://github.com/aspect-build/rules_jest/archive/refs/tags/v0.13.1.tar.gz",
|
||||
sha256 = "fa103b278137738ef08fd23d3c8c9157897a7159af2aa22714bc71680da58583",
|
||||
strip_prefix = "rules_jest-0.16.1",
|
||||
url = "https://github.com/aspect-build/rules_jest/archive/refs/tags/v0.16.1.tar.gz",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
@ -104,9 +111,9 @@ load("@npm//:repositories.bzl", "npm_repositories")
|
||||
|
||||
npm_repositories()
|
||||
|
||||
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies", LATEST_TS_VERSION = "LATEST_VERSION")
|
||||
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies")
|
||||
|
||||
rules_ts_dependencies(ts_version = LATEST_TS_VERSION)
|
||||
rules_ts_dependencies(ts_version = "4.9.5")
|
||||
|
||||
# rules_jest setup ==============================
|
||||
load("@aspect_rules_jest//jest:dependencies.bzl", "rules_jest_dependencies")
|
||||
@ -115,7 +122,10 @@ rules_jest_dependencies()
|
||||
|
||||
load("@aspect_rules_jest//jest:repositories.bzl", "jest_repositories")
|
||||
|
||||
jest_repositories(name = "jest")
|
||||
jest_repositories(
|
||||
name = "jest",
|
||||
jest_version = "v28.1.0",
|
||||
)
|
||||
|
||||
load("@jest//:npm_repositories.bzl", jest_npm_repositories = "npm_repositories")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user