|
| 1 | +# Enable debugging tests with --config=debug |
| 2 | +test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results --strategy=TestRunner=standalone |
| 3 | + |
| 4 | +# Do not attempt to de-flake locally. |
| 5 | +# On CI we might set this to `3` to run with deflaking. |
| 6 | +test --flaky_test_attempts=1 |
| 7 | + |
| 8 | +# Required by `rules_ts`. |
| 9 | +common --@aspect_rules_ts//ts:skipLibCheck=always |
| 10 | +common --@aspect_rules_ts//ts:default_to_tsc_transpiler |
| 11 | + |
| 12 | +# Needed as otherwise `env` of TS actions would be ignored. |
| 13 | +common --incompatible_merge_fixed_and_default_shell_env |
| 14 | + |
| 15 | +# Frozen lockfile |
| 16 | +common --lockfile_mode=error |
| 17 | + |
| 18 | +############################### |
| 19 | +# Filesystem interactions # |
| 20 | +############################### |
| 21 | + |
| 22 | +# Create symlinks in the project: |
| 23 | +# - dist/bin for outputs |
| 24 | +# - dist/testlogs, dist/genfiles |
| 25 | +# - bazel-out |
| 26 | +# NB: bazel-out should be excluded from the editor configuration. |
| 27 | +# The checked-in /.vscode/settings.json does this for VSCode. |
| 28 | +# Other editors may require manual config to ignore this directory. |
| 29 | +# In the past, we say a problem where VSCode traversed a massive tree, opening file handles and |
| 30 | +# eventually a surprising failure with auto-discovery of the C++ toolchain in |
| 31 | +# MacOS High Sierra. |
| 32 | +# See https://github.com/bazelbuild/bazel/issues/4603 |
| 33 | +build --symlink_prefix=dist/ |
| 34 | + |
| 35 | +# Turn off legacy external runfiles |
| 36 | +build --nolegacy_external_runfiles |
| 37 | +run --nolegacy_external_runfiles |
| 38 | +test --nolegacy_external_runfiles |
| 39 | + |
| 40 | +# Turn on --incompatible_strict_action_env which was on by default |
| 41 | +# in Bazel 0.21.0 but turned off again in 0.22.0. Follow |
| 42 | +# https://github.com/bazelbuild/bazel/issues/7026 for more details. |
| 43 | +# This flag is needed to so that the bazel cache is not invalidated |
| 44 | +# when running bazel via `pnpm bazel`. |
| 45 | +# See https://github.com/angular/angular/issues/27514. |
| 46 | +build --incompatible_strict_action_env |
| 47 | +run --incompatible_strict_action_env |
| 48 | +test --incompatible_strict_action_env |
| 49 | + |
| 50 | +# Do not build runfile trees by default. If an execution strategy relies on runfile |
| 51 | +# symlink teee, the tree is created on-demand. See: https://github.com/bazelbuild/bazel/issues/6627 |
| 52 | +# and https://github.com/bazelbuild/bazel/commit/03246077f948f2790a83520e7dccc2625650e6df |
| 53 | +build --nobuild_runfile_links |
| 54 | + |
| 55 | +build --enable_runfiles |
| 56 | + |
| 57 | +############################### |
| 58 | +# Release support # |
| 59 | +# Turn on these settings with # |
| 60 | +# --config=release # |
| 61 | +############################### |
| 62 | + |
| 63 | +# Releases should always be stamped with version control info |
| 64 | +# This command assumes node on the path and is a workaround for |
| 65 | +# https://github.com/bazelbuild/bazel/issues/4802 |
| 66 | +build:release --workspace_status_command="pnpm --silent ng-dev release build-env-stamp --mode=release" |
| 67 | +build:release --stamp |
| 68 | + |
| 69 | +# Snapshots should also be stamped with version control information. |
| 70 | +build:snapshot-build --workspace_status_command="pnpm --silent ng-dev release build-env-stamp --mode=snapshot" |
| 71 | +build:snapshot-build --stamp |
| 72 | +# @angular/language-server package depends directly on other Angular framework packages. |
| 73 | +# This flag ensures that the language server uses the snapshot-built framework packages from the repository. |
| 74 | +build:snapshot-build --//:enable_language_server_snapshot_repo_deps |
| 75 | + |
| 76 | +# Angular DevTools for Firefox releases *cannot* be stamped and `--config snapshot-build-firefox` is a no-op. |
| 77 | +# This is because Mozilla requires add-on source code to be uploaded and then they manually reproduce the build. |
| 78 | +# If we stamp the build based on Git information such as the current commit, then reproducing the build would require |
| 79 | +# uploading the entire `.git` directory. We already must upload the entire monorepo, and uploading `.git` as well |
| 80 | +# exceeds the max source file size. To address this, we just *don't* stamp Firefox builds of Angular DevTools. |
| 81 | +build:snapshot-build-firefox --nostamp |
| 82 | + |
| 83 | +############################### |
| 84 | +# Output # |
| 85 | +############################### |
| 86 | + |
| 87 | +# A more useful default output mode for bazel query |
| 88 | +# Prints eg. "ng_module rule //foo:bar" rather than just "//foo:bar" |
| 89 | +query --output=label_kind |
| 90 | + |
| 91 | +# By default, failing tests don't print any output, it goes to the log file |
| 92 | +test --test_output=errors |
| 93 | + |
| 94 | +################################## |
| 95 | +# Remote Build Execution support # |
| 96 | +# Turn on these settings with # |
| 97 | +# --config=remote # |
| 98 | +################################## |
| 99 | + |
| 100 | +# The following --define=EXECUTOR=remote will be able to be removed |
| 101 | +# once https://github.com/bazelbuild/bazel/issues/7254 is fixed |
| 102 | +build:remote --define=EXECUTOR=remote |
| 103 | + |
| 104 | +# Set a higher timeout value, just in case. |
| 105 | +build:remote --remote_timeout=600 |
| 106 | + |
| 107 | +# Bazel detects maximum number of jobs based on host resources. |
| 108 | +# Since we run remotely, we can increase this number significantly. |
| 109 | +common:remote --jobs=200 |
| 110 | + |
| 111 | +build:remote --google_default_credentials |
| 112 | + |
| 113 | +# Force remote exeuctions to consider the entire run as linux |
| 114 | +build:remote --cpu=k8 |
| 115 | +build:remote --host_cpu=k8 |
| 116 | + |
| 117 | +# Toolchain and platform related flags |
| 118 | +build:remote --extra_execution_platforms=@devinfra//bazel/remote-execution:platform_with_network |
| 119 | +build:remote --host_platform=@devinfra//bazel/remote-execution:platform_with_network |
| 120 | +build:remote --platforms=@devinfra//bazel/remote-execution:platform_with_network |
| 121 | + |
| 122 | +# Remote instance and caching |
| 123 | +build:remote --remote_instance_name=projects/internal-200822/instances/primary_instance |
| 124 | +build:remote --bes_instance_name=internal-200822 |
| 125 | +build:remote --remote_cache=remotebuildexecution.googleapis.com |
| 126 | +build:remote --remote_executor=remotebuildexecution.googleapis.com |
| 127 | +build:remote --remote_upload_local_results=false |
| 128 | + |
| 129 | +build:remote --remote_grpc_log=/tmp/rbe-grpc.log |
| 130 | + |
| 131 | +# See: https://docs.google.com/document/d/1NgDPsCIwprDdqC1zj0qQrh5KGK2hQTSTux1DAvi4rSc/edit?tab=t.0. |
| 132 | +build:remote --experimental_remote_execution_keepalive |
| 133 | + |
| 134 | +# Use HTTP remote cache |
| 135 | +build:remote-cache --remote_cache=https://storage.googleapis.com/angular-team-cache |
| 136 | +build:remote-cache --remote_accept_cached=true |
| 137 | +build:remote-cache --remote_upload_local_results=false |
| 138 | +build:remote-cache --google_default_credentials |
| 139 | + |
| 140 | +# Additional flags added when running a "trusted build" with additional access |
| 141 | +build:trusted-build --remote_upload_local_results=true |
| 142 | + |
| 143 | +# Ensure that tags like "no-remote-exec" get propagated to actions created by rules, |
| 144 | +# even if the rule implementation does not explicitly pass them to the execution requirements. |
| 145 | +# https://bazel.build/reference/command-line-reference#flag--experimental_allow_tags_propagation |
| 146 | +common --experimental_allow_tags_propagation |
| 147 | + |
| 148 | +# Disable network access in the sandbox by default. To enable network access |
| 149 | +# for a particular target, use: |
| 150 | +# |
| 151 | +# load("@devinfra//bazel/remote-execution:index.bzl", "ENABLE_NETWORK") |
| 152 | +# my_target( |
| 153 | +# ..., |
| 154 | +# exec_properties = ENABLE_NETWORK, # Enables network in remote exec |
| 155 | +# tags = ["requires-network"] # Enables network in sandbox |
| 156 | +# ) |
| 157 | +build --nosandbox_default_allow_network |
| 158 | + |
| 159 | +################################## |
| 160 | +# Saucelabs tests settings # |
| 161 | +# Turn on these settings with # |
| 162 | +# --config=saucelabs # |
| 163 | +################################## |
| 164 | + |
| 165 | +# For saucelabs tests we don't want to enable flaky test attempts. Karma has its own integrated |
| 166 | +# retry mechanism and we do not want to retry unnecessarily if Karma already tried multiple times. |
| 167 | +test:saucelabs --flaky_test_attempts=1 |
| 168 | + |
| 169 | +################ |
| 170 | +# Flag Aliases # |
| 171 | +################ |
| 172 | + |
| 173 | +# --ng_perf will ask the Ivy compiler to produce performance results for each build. |
| 174 | +build --flag_alias=ng_perf=//packages/compiler-cli:ng_perf |
| 175 | + |
| 176 | +#################################################### |
| 177 | +# User bazel configuration |
| 178 | +# NOTE: This needs to be the *last* entry in the config. |
| 179 | +#################################################### |
| 180 | + |
| 181 | +# Load any settings which are specific to the current user. Needs to be *last* statement |
| 182 | +# in this config, as the user configuration should be able to overwrite flags from this file. |
| 183 | +try-import %workspace%/.bazelrc.user |
0 commit comments