-
Notifications
You must be signed in to change notification settings - Fork 95
/
.bazelrc
326 lines (274 loc) · 14.8 KB
/
.bazelrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
common --noenable_bzlmod
common --lockfile_mode=update
common --enable_platform_specific_config=true
# Avoid genquery failing on unconfigured cycles
# https://github.com/bazelbuild/bazel/issues/14169
common --experimental_skip_ttvs_for_genquery
# Build with --config=local to send build logs to your local server
common:local --bes_results_url=http://localhost:8080/invocation/
common:local --bes_backend=grpc://localhost:1985
common:local --remote_cache=grpc://localhost:1985
common:local --remote_upload_local_results
common:local --extra_execution_platforms=//platforms:local_config_platform
# Build with --config=dev to send build logs to the dev server
common:dev --bes_results_url=https://buildbuddy.buildbuddy.dev/invocation/
common:dev --bes_backend=grpcs://buildbuddy.buildbuddy.dev
# Build with --config=cache-dev to send build logs to the dev server with cache
common:cache-dev --bes_results_url=https://buildbuddy.buildbuddy.dev/invocation/
common:cache-dev --bes_backend=grpcs://buildbuddy.buildbuddy.dev
common:cache-dev --remote_cache=grpcs://buildbuddy.buildbuddy.dev
common:cache-dev --remote_upload_local_results
common:cache-dev --remote_cache_compression
common:cache-dev --experimental_remote_cache_compression_threshold=100
# Build with --config=cache to send build logs to the production server with cache
common:cache --bes_results_url=https://buildbuddy.buildbuddy.io/invocation/
common:cache --bes_backend=grpcs://buildbuddy.buildbuddy.io
common:cache --remote_cache=grpcs://buildbuddy.buildbuddy.io
common:cache --remote_upload_local_results
common:cache --remote_cache_compression
common:cache --experimental_remote_cache_compression_threshold=100
# Flags shared across remote configs
common:remote-shared --remote_upload_local_results
common:remote-shared --remote_timeout=600
common:remote-shared --remote_download_minimal
common:remote-shared --jobs=100
common:remote-shared --verbose_failures
common:target-linux-x86 --platforms=@buildbuddy_toolchain//:platform_linux_x86_64
common:target-linux-x86 --extra_execution_platforms=@buildbuddy_toolchain//:platform_linux_x86_64
common:target-linux-arm64 --platforms=@buildbuddy_toolchain//:platform_linux_arm64
common:target-linux-arm64 --extra_execution_platforms=@buildbuddy_toolchain//:platform_linux_arm64
# Build with --config=remote to use BuildBuddy RBE.
common:remote --config=remote-shared
common:remote --config=target-linux-x86
common:remote --config=cache
common:remote --remote_executor=grpcs://buildbuddy.buildbuddy.io
# Specify arch to do cross-platform builds on remote until the go toolchain can
# accomodate multiple execution platforms
common:remote-linux-arm64 --config=remote-shared
common:remote-linux-arm64 --config=target-linux-arm64
common:remote-linux-arm64 --config=cache
common:remote-linux-arm64 --remote_executor=grpcs://buildbuddy.buildbuddy.io
# Build with --config=remote-dev to use BuildBuddy RBE.
common:remote-dev --config=remote-shared
common:remote-dev --config=target-linux-x86
common:remote-dev --config=cache-dev
common:remote-dev --remote_executor=grpcs://buildbuddy.buildbuddy.dev
# Specify arch to do cross-platform builds on remote-dev
common:remote-dev-linux-arm64 --config=remote-shared
common:remote-dev-linux-arm64 --config=target-linux-arm64
common:remote-dev-linux-arm64 --config=cache-dev
common:remote-dev-linux-arm64 --remote_executor=grpcs://buildbuddy.buildbuddy.dev
# Build with --config=probers to use BuildBuddy RBE in the probers org.
common:probers --config=remote-shared
common:probers --config=target-linux-x86
common:probers --bes_results_url=https://buildbuddy-probers-us-west1.buildbuddy.io/invocation/
common:probers --bes_backend=grpcs://buildbuddy-probers-us-west1.buildbuddy.io
common:probers --remote_cache=grpcs://buildbuddy-probers-us-west1.buildbuddy.io
common:probers --remote_executor=grpcs://buildbuddy-probers-us-west1.buildbuddy.io
common:probers --remote_upload_local_results
common:probers --remote_cache_compression
common:probers --experimental_remote_cache_compression_threshold=100
# Build with --config=probers-dev to use BuildBuddy RBE in the probers org.
common:probers-dev --config=remote-shared
common:probers-dev --config=target-linux-x86
common:probers-dev --bes_results_url=https://buildbuddy-probers.buildbuddy.dev/invocation/
common:probers-dev --bes_backend=grpcs://buildbuddy-probers.buildbuddy.dev
common:probers-dev --remote_cache=grpcs://buildbuddy-probers.buildbuddy.dev
common:probers-dev --remote_executor=grpcs://buildbuddy-probers.buildbuddy.dev
common:probers-dev --remote_upload_local_results
common:probers-dev --remote_cache_compression
common:probers-dev --experimental_remote_cache_compression_threshold=100
# Write build outputs in a platform-specific directory,
# avoid outputs being wiped and rewritten when switching between platforms.
common --experimental_platform_in_output_dir
# Configuration used for GitHub actions-based CI
common:ci --config=remote
common:ci --build_metadata=ROLE=CI
common:ci --build_metadata=VISIBILITY=PUBLIC
common:ci --remote_instance_name=buildbuddy-io/buildbuddy/ci
common:ci --repository_cache=/home/runner/repo-cache/
common:ci --flaky_test_attempts=2
common:ci --color=yes
common:ci --disk_cache=
# common:ci --@io_bazel_rules_go//go/config:race
# Configuration used for untrusted GitHub actions-based CI
common:untrusted-ci --config=remote
common:untrusted-ci --remote_instance_name=buildbuddy-io/buildbuddy/untrusted-ci
common:untrusted-ci --repository_cache=/home/runner/repo-cache/untrusted/
common:untrusted-ci --disk_cache=
common:untrusted-ci --flaky_test_attempts=2
common:untrusted-ci --remote_executor=grpcs://remote.buildbuddy.io
common:untrusted-ci --bes_results_url=https://app.buildbuddy.io/invocation/
common:untrusted-ci --bes_backend=grpcs://remote.buildbuddy.io
common:untrusted-ci --remote_cache=grpcs://remote.buildbuddy.io
# Disabled RBE for Windows
common:untrusted-ci-windows --remote_instance_name=buildbuddy-io/buildbuddy/untrusted-ci-windows
common:untrusted-ci-windows --repository_cache=D:/repo-cache/untrusted
common:untrusted-ci-windows --disk_cache=
common:untrusted-ci-windows --flaky_test_attempts=2
common:untrusted-ci-windows --bes_results_url=https://app.buildbuddy.io/invocation/
common:untrusted-ci-windows --bes_backend=grpcs://remote.buildbuddy.io
common:untrusted-ci-windows --remote_cache=grpcs://remote.buildbuddy.io
common:untrusted-ci-windows --remote_cache_compression
common:untrusted-ci-windows --experimental_remote_cache_compression_threshold=100
common:untrusted-ci-windows --remote_upload_local_results
# Configuration used for all BuildBuddy workflows
common:workflows --remote_cache_compression
common:workflows --experimental_remote_cache_compression_threshold=100
common:workflows --build_metadata=ROLE=CI
common:workflows --build_metadata=VISIBILITY=PUBLIC
common:workflows --remote_instance_name=buildbuddy-io/buildbuddy/workflows
common:workflows --color=yes
common:workflows --disk_cache=
common:workflows --flaky_test_attempts=2
# Use BuildBuddy endpoints from the ci_runner-generated bazelrc.
# These will point to local, dev, or prod, depending on which app created the workflow action.
common:workflows --config=buildbuddy_bes_backend
common:workflows --config=buildbuddy_bes_results_url
common:workflows --config=buildbuddy_remote_cache
common:workflows --config=buildbuddy_experimental_remote_downloader
common:race --@io_bazel_rules_go//go/config:race
common:performance --compilation_mode=opt
# Configuration used to deflake tests
common:deflake --config=remote
common:deflake --runs_per_test=100
common:deflake --test_output=errors
common:deflake --notest_keep_going
# Configuration used to deflake Go tests
common:deflake-go --config=race
common:deflake-go --config=deflake
common:deflake-go --test_arg=-test.failfast
# Configuration used for Linux workflows
common:linux-workflows --config=remote-shared
common:linux-workflows --config=target-linux-x86
common:linux-workflows --config=workflows
common:linux-workflows --config=buildbuddy_remote_executor
common:linux-workflows --build_metadata=TAGS=linux-workflow
# Configuration used for Mac workflows
# TODO(bduffany): Enable RBE for Mac workflows, and reconcile this with other configs
common:mac-workflows --config=cache
common:mac-workflows --config=workflows
common:mac-workflows --build_metadata=TAGS=mac-workflow
# Configuration used for all builds of artifacts released to GitHub
common:release-shared -c opt
common:release-shared --stamp
common:release-shared --define release=true
common:release-shared --strip=always
# Configuration used for Linux releases
common:release --config=release-shared
common:release --config=remote
common:release --remote_instance_name=buildbuddy-io/buildbuddy/release
common:release --remote_download_toplevel
# Configuration used for release-mac workflow
common:release-mac --config=release-shared
# Configuration used for release-m1 workflow
common:release-m1 --config=release-shared
# Configuration used for release-windows workflow
common:release-windows --config=release-shared
common:release-windows --config=cache
common:release-windows --remote_instance_name=buildbuddy-io/buildbuddy/release-windows
# Configuration used for Buildbuddy auto-release probers
common:auto-release --config=probers
common:auto-release --remote_instance_name=buildbuddy-io/buildbuddy/auto-release
common:auto-release -c opt
common:auto-release --@io_bazel_rules_go//go/config:pgoprofile=enterprise/tools/pgo:prod.pprof
# Build fully static binaries linked against musl on Linux.
common:static --platforms=//platforms:linux_x86_64_musl
common:static-arm64 --platforms=//platforms:linux_arm64_musl
# By default, build logs get sent to the production server
common --bes_results_url=https://app.buildbuddy.io/invocation/
common --bes_backend=grpcs://remote.buildbuddy.io
# Recommended if connecting to a remote (upload speed constrained) BuildBuddy instance
common --noremote_upload_local_results # Uploads logs & artifacts without writing to cache
# Populate workspace info like commit sha and repo name to your invocation.
common:linux --workspace_status_command=$(pwd)/workspace_status.sh
common:macos --workspace_status_command=$(pwd)/workspace_status.sh
common:windows --workspace_status_command="bash workspace_status.sh"
# Misc remote cache/BES optimizations
common --experimental_remote_cache_async
common --remote_build_event_upload=minimal
common --nolegacy_important_outputs
# Use a static PATH variable to prevent unnecessary rebuilds of dependencies like protobuf.
common --incompatible_strict_action_env
common:macos --action_env=DEVELOPER_DIR
common:macos --host_action_env=DEVELOPER_DIR
# rules_nodejs needs runfiles to be explicitly enabled.
common:linux --enable_runfiles
common:macos --enable_runfiles
# Use syscall to create symlink in-process.
# Need to work around M1 Mac browser test issue https://github.com/bazelbuild/rules_webtesting/issues/438
common --experimental_inprocess_symlink_creation
# Add `-test.v` to all Go tests so that each test func is reported as a separate test case
# in the XML output. This allows our webUI to display the run time of each test case
# separately and let us know which tests is slow.
common --test_env=GO_TEST_WRAP_TESTV=1
# In rules_go v0.50.0, nogo static analysis was moved from GoCompilePkg to a couple of
# actions: RunNogo and ValidateNogo. Among these, ValidateNogo is a validation action*.
# When the validation runs on top of the go_test binary, it will prevent the test
# execution (TestRunner) until the validation is success.
#
# This flag will run the validation action as an aspect, which will not block the test
# execution.
#
# *: https://bazel.build/extending/rules#validation_actions
common --experimental_use_validation_aspect=true
# Workaround for Bazel 7:
# rules_docker (archived) defines a transition that helps ensure building containers with binary would use the same platform for both.
# Reference: https://github.com/bazelbuild/rules_docker/pull/1963
#
# However, the platform and transition made use of `label_setting` instead of `constraint_value`.
# This used to work in Bazel 6, but Bazel 7 introduced a new mandatory provider `ConstraintValueInfo` for all constraints_value targets.
# Since `label_setting` does not return this provider, it is no longer possible to use `label_setting` in Bazel 7.
#
# Disabling this is safe because today, we are building these constainers on Linux host, executing Linux actions and targeting Linux machines.
# This assumption might not hold in the future, but we can revisit this when that happens.
common --@io_bazel_rules_docker//transitions:enable=false
# Don't run Docker and Firecracker tests by default, because they cannot be run on all environments
# Firecracker tests can only be run on Linux machines with bare execution, and we want to avoid a hard dependency
# on Docker for development
test --test_tag_filters=-docker,-bare
build --build_tag_filters=-secrets
# Use C++17 standard for all C++ compilation
common:linux --host_cxxopt=-std=c++17
common:linux --cxxopt=-std=c++17
common:macos --host_cxxopt=-std=c++17
common:macos --cxxopt=-std=c++17
common:windows --host_cxxopt=/std:c++17
common:windows --cxxopt=/std:c++17
# Ensure that we don't use the apple_support cc_toolchain
common:macos --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1
# Ensure that our executors can run on macOS 11.0+
common:macos --macos_minimum_os=12.0
common:macos --host_macos_minimum_os=12.0
# Run Webdriver tests with --config=webdriver-debug to debug webdriver tests locally.
# See server/testutil/webtester/webtester.go for more details.
common:webdriver-debug --test_arg=-webdriver_headless=false
common:webdriver-debug --test_arg=-webdriver_end_of_test_delay=3s
# Forward X server display for local webdriver tests.
common:webdriver-debug --test_env=DISPLAY
# When debugging, only run one webdriver test at a time (it's overwhelming
# otherwise).
common:webdriver-debug --local_test_jobs=1
# Currently only works for go tests
# Coverage outputs could be viewed with `genhtml`:
# $ genhtml -o cover bazel-out/_coverage/_coverage_report.dat
# $ open cover/index.html
common --combined_report=lcov
# Use BLAKE3 digest function.
startup --digest_function=BLAKE3
# Bazel doesn't track the contents of source directories by default, which can result
# in non-hermeticity.
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1
# Include target names in timing profile so it's clickable.
common --experimental_profile_include_target_label
# Include primary output name in timing profile.
common --experimental_profile_include_primary_output
# Don't merge timing profile actions.
common --noslim_profile
# Include compact execution log
# TODO(sluongng): make Bazel writes this to output_base automatically
common --execution_log_compact_file=bazel_compact_exec_log.binpb.zst
# Try importing a user specific .bazelrc
# You can create your own by copying and editing the template-user.bazelrc template:
# cp template-user.bazelrc user.bazelrc
try-import %workspace%/user.bazelrc