|
| 1 | +# Inspired on from https://raw.githubusercontent.com/bazelbuild/rules_nodejs/master/common.bazelrc |
| 2 | +# Common Bazel settings for JavaScript/NodeJS workspaces |
| 3 | +# This rc file is automatically discovered when Bazel is run in this workspace, |
| 4 | +# see https://docs.bazel.build/versions/master/guide.html#bazelrc |
| 5 | +# |
| 6 | +# The full list of Bazel options: https://docs.bazel.build/versions/master/command-line-reference.html |
| 7 | + |
| 8 | +# Local Cache Settings |
| 9 | +## Avoid cache results from being corrupt when changing source during build |
| 10 | +common --experimental_guard_against_concurrent_changes |
| 11 | + |
| 12 | +## Cache action outputs on disk so they persist across output_base and bazel shutdown (eg. changing branches) |
| 13 | +build --disk_cache=~/.bazel-cache/disk-cache |
| 14 | + |
| 15 | +## Bazel repo cache settings |
| 16 | +build --repository_cache=~/.bazel-cache/repository-cache |
| 17 | + |
| 18 | +# Bazel will create symlinks from the workspace directory to output artifacts. |
| 19 | +# Build results will be placed in a directory called "bazel/bin" |
| 20 | +# This will still create a bazel-out symlink in |
| 21 | +# the project directory, which must be excluded from the |
| 22 | +# editor's search path. |
| 23 | +build --symlink_prefix=bazel/ |
| 24 | +# To disable the symlinks altogether (including bazel-out) we can use |
| 25 | +# build --symlink_prefix=/ |
| 26 | +# however this makes it harder to find outputs. |
| 27 | + |
| 28 | +# Prevents the creation of bazel-out dir |
| 29 | +build --experimental_no_product_name_out_symlink |
| 30 | + |
| 31 | +# Make direct file system calls to create symlink trees |
| 32 | +build --experimental_inprocess_symlink_creation |
| 33 | + |
| 34 | +# Incompatible flags to run with |
| 35 | +build --incompatible_no_implicit_file_export |
| 36 | +build --incompatible_restrict_string_escapes |
| 37 | + |
| 38 | +# Log configs |
| 39 | +## different from default |
| 40 | +common --color=yes |
| 41 | +build --show_task_finish |
| 42 | +build --noshow_progress |
| 43 | +build --noshow_loading_progress |
| 44 | +build --show_result=0 |
| 45 | + |
| 46 | +# Specifies desired output mode for running tests. |
| 47 | +# Valid values are |
| 48 | +# 'summary' to output only test status summary |
| 49 | +# 'errors' to also print test logs for failed tests |
| 50 | +# 'all' to print logs for all tests |
| 51 | +# 'streamed' to output logs for all tests in real time |
| 52 | +# (this will force tests to be executed locally one at a time regardless of --test_strategy value). |
| 53 | +test --test_output=errors |
| 54 | + |
| 55 | +# Support for debugging NodeJS tests |
| 56 | +# Add the Bazel option `--config=debug` to enable this |
| 57 | +# --test_output=streamed |
| 58 | +# Stream stdout/stderr output from each test in real-time. |
| 59 | +# See https://docs.bazel.build/versions/master/user-manual.html#flag--test_output for more details. |
| 60 | +# --test_strategy=exclusive |
| 61 | +# Run one test at a time. |
| 62 | +# --test_timeout=9999 |
| 63 | +# Prevent long running tests from timing out |
| 64 | +# See https://docs.bazel.build/versions/master/user-manual.html#flag--test_timeout for more details. |
| 65 | +# --nocache_test_results |
| 66 | +# Always run tests |
| 67 | +# --node_options=--inspect-brk |
| 68 | +# Pass the --inspect-brk option to all tests which enables the node inspector agent. |
| 69 | +# See https://nodejs.org/de/docs/guides/debugging-getting-started/#command-line-options for more details. |
| 70 | +# --define=VERBOSE_LOGS=1 |
| 71 | +# Rules will output verbose logs if the VERBOSE_LOGS environment variable is set. `VERBOSE_LOGS` will be passed to |
| 72 | +# `nodejs_binary` and `nodejs_test` via the default value of the `default_env_vars` attribute of those rules. |
| 73 | +# --compilation_mode=dbg |
| 74 | +# Rules may change their build outputs if the compilation mode is set to dbg. For example, |
| 75 | +# mininfiers such as terser may make their output more human readable when this is set. `COMPILATION_MODE` will be passed to |
| 76 | +# `nodejs_binary` and `nodejs_test` via the default value of the `default_env_vars` attribute of those rules. |
| 77 | +# See https://docs.bazel.build/versions/master/user-manual.html#flag--compilation_mode for more details. |
| 78 | +test:debug --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results --define=VERBOSE_LOGS=1 |
| 79 | +# Use bazel run with `--config=debug` to turn on the NodeJS inspector agent. |
| 80 | +# The node process will break before user code starts and wait for the debugger to connect. |
| 81 | +run:debug --define=VERBOSE_LOGS=1 -- --node_options=--inspect-brk |
| 82 | +# The following option will change the build output of certain rules such as terser and may not be desirable in all cases |
| 83 | +# It will also output both the repo cache and action cache to a folder inside the repo |
| 84 | +build:debug --compilation_mode=dbg --show_result=1 --disk_cache=bazel/disk-cache --repository_cache=bazel/repository-cache |
| 85 | + |
| 86 | +# Turn off legacy external runfiles |
| 87 | +# This prevents accidentally depending on this feature, which Bazel will remove. |
| 88 | +build --nolegacy_external_runfiles |
| 89 | +run --nolegacy_external_runfiles |
| 90 | +test --nolegacy_external_runfiles |
| 91 | + |
| 92 | +# Turn on --incompatible_strict_action_env which was on by default |
| 93 | +# in Bazel 0.21.0 but turned off again in 0.22.0. Follow |
| 94 | +# https://github.com/bazelbuild/bazel/issues/7026 for more details. |
| 95 | +# This flag is needed to so that the bazel cache is not invalidated |
| 96 | +# when running bazel via `yarn bazel`. |
| 97 | +# See https://github.com/angular/angular/issues/27514. |
| 98 | +build --incompatible_strict_action_env |
| 99 | +run --incompatible_strict_action_env |
| 100 | +test --incompatible_strict_action_env |
| 101 | + |
| 102 | +# Do not build runfile trees by default. If an execution strategy relies on runfile |
| 103 | +# symlink tree, the tree is created on-demand. See: https://github.com/bazelbuild/bazel/issues/6627 |
| 104 | +# and https://github.com/bazelbuild/bazel/commit/03246077f948f2790a83520e7dccc2625650e6df |
| 105 | +build --nobuild_runfile_links |
| 106 | + |
| 107 | +# When running `bazel coverage` --instrument_test_targets needs to be set in order to |
| 108 | +# collect coverage information from test targets |
| 109 | +coverage --instrument_test_targets |
| 110 | + |
| 111 | +# Settings for CI |
| 112 | +# Bazel flags for CI are in /src/dev/ci_setup/.bazelrc-ci |
| 113 | + |
| 114 | +# Load any settings specific to the current user. |
| 115 | +# .bazelrc.user should appear in .gitignore so that settings are not shared with team members |
| 116 | +# This needs to be last statement in this |
| 117 | +# config, as the user configuration should be able to overwrite flags from this file. |
| 118 | +# See https://docs.bazel.build/versions/master/best-practices.html#bazelrc |
| 119 | +# (Note that we use .bazelrc.user so the file appears next to .bazelrc in directory listing, |
| 120 | +# rather than user.bazelrc as suggested in the Bazel docs) |
| 121 | +try-import %workspace%/.bazelrc.user |
0 commit comments