-
Notifications
You must be signed in to change notification settings - Fork 5.6k
/
.bazelrc
341 lines (290 loc) · 14.5 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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# Reference docs: https://bazel.build/run/bazelrc
# coverity need to use the local command without remote execution auto
# enabled.
info --config=local
# Don't use legacy toolchain resolution.
build --incompatible_enable_cc_toolchain_resolution
# This makes builds more hermetic by preventing environment variables from leaking into the execution of rules
build --incompatible_strict_action_env=true
# allows us to use python rules. This is needed because of the bug:
# https://github.com/bazelbuild/bazel/issues/4327
build --experimental_inprocess_symlink_creation
# cc_library transitively propagates link opts. The build uses cc_shared_library to avoid this when linking
# dynamically.
build --experimental_cc_shared_library
# Reuse sandboxes to save sandbox execution and deletion times.
build --experimental_reuse_sandbox_directories
build:macos --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1
# while in hybrid build state, using local unsandboxed linking should be faster. When most of our link
# targets have been converted (i.e. unittest binaries) and we can BWOB, remote linking should be faster
# in those cases:
build --strategy=CppLink=local
build --strategy=CppArchive=local
build --strategy=SolibSymlink=local
build --strategy=StripDebuginfo=local
build --strategy=ExtractDebuginfo=local
build --strategy=TestRunner=local
build --modify_execution_info=^(TestRunner|CppLink|CppArchive|SolibSymlink|ExtractDebuginfo|StripDebuginfo)$=+no-remote-cache
# Aliases for config flags
build --flag_alias=linkstatic=//bazel/config:linkstatic
build --flag_alias=compiler_type=//bazel/config:compiler_type
build --flag_alias=linker=//bazel/config:linker
build --flag_alias=use_gdbserver=//bazel/config:use_gdbserver
build --flag_alias=libunwind=//bazel/config:libunwind
build --flag_alias=spider_monkey_dbg=//bazel/config:spider_monkey_dbg
build --flag_alias=allocator=//bazel/config:allocator
build --flag_alias=use_lldbserver=//bazel/config:use_lldbserver
build --flag_alias=opt=//bazel/config:opt
build --flag_alias=dbg=//bazel/config:dbg
build --flag_alias=debug_symbols=//bazel/config:debug_symbols
build --flag_alias=thin_lto=//bazel/config:thin_lto
build --flag_alias=separate_debug=//bazel/config:separate_debug
build --flag_alias=use_wait_for_debugger=//bazel/config:use_wait_for_debugger
build --flag_alias=use_ocsp_stapling=//bazel/config:use_ocsp_stapling
build --flag_alias=use_disable_ref_track=//bazel/config:use_disable_ref_track
build --flag_alias=use_wiredtiger=//bazel/config:use_wiredtiger
build --flag_alias=use_glibcxx_debug=//bazel/config:use_glibcxx_debug
build --flag_alias=use_tracing_profiler=//bazel/config:use_tracing_profiler
build --flag_alias=build_grpc=//bazel/config:build_grpc
build --flag_alias=build_otel=//bazel/config:build_otel
build --flag_alias=use_libcxx=//bazel/config:use_libcxx
build --flag_alias=detect_odr_violations=//bazel/config:detect_odr_violations
build --flag_alias=shared_archive=//bazel/config:shared_archive
build --flag_alias=skip_archive=//bazel/config:skip_archive
build --flag_alias=streams_release_build=//bazel/config:streams_release_build
build --flag_alias=release=//bazel/config:release
build --flag_alias=build_enterprise=//bazel/config:build_enterprise
build --flag_alias=visibility_support=//bazel/config:visibility_support
build --flag_alias=disable_warnings_as_errors=//bazel/config:disable_warnings_as_errors
build --flag_alias=gcov=//bazel/config:gcov
build --flag_alias=pgo_profile=//bazel/config:pgo_profile
build --flag_alias=server_js=//bazel/config:server_js
build --flag_alias=ssl=//bazel/config:ssl
build --flag_alias=js_engine=//bazel/config:js_engine
build --flag_alias=use_sasl_client=//bazel/config:use_sasl_client
build --flag_alias=enterprise_feature_all=//bazel/config:enterprise_feature_all
build --flag_alias=link_timeout=//bazel/config:link_timeout
build --flag_alias=dwarf_version=//bazel/config:dwarf_version
build --flag_alias=http_client=//bazel/config:http_client
build --flag_alias=developer_dir=//bazel/config:developer_dir
build --flag_alias=asan=//bazel/config:asan
build --flag_alias=fsan=//bazel/config:fsan
build --flag_alias=msan=//bazel/config:msan
build --flag_alias=lsan=//bazel/config:lsan
build --flag_alias=tsan=//bazel/config:tsan
build --flag_alias=ubsan=//bazel/config:ubsan
build --flag_alias=dbg_level=//bazel/config:dbg_level
#############################################################################################################################
# BUILD 'PROFILES' - this is the area to set up configurations of flags to be used by developers.
# --enable_platform_specific_config=true is passed to every profile so more hardware specific
# configurations can override the defaults in these profiles. These represent the only supported flag configurations,
# and should be the only thing passed on the command line in most scenarios
# Every profile should explicitly specify every option used by every other profile, with the exception of the
# profile modifiers
# The base profiles are fast, opt and debug - these reflect the output directories artifacts will get placed into
# and match the bazel compilation modes
# Should a profile modify another profile, it should be named {original_profile}_{modifier_name} - example fast_static
# Current Profiles:
# fastbuild
# dbg
# dbg_san
# dbg_tsan
# opt
# The 'default' build profile - should match all the settings of a profile, currently fastbuild
build -c fastbuild
build --//bazel/config:opt=off
build --//bazel/config:dbg=True
build --//bazel/config:dbg_level=1
build --//bazel/config:debug_symbols=True
build --//bazel/config:separate_debug=False
build --//bazel/config:compiler_type=clang
build --//bazel/config:linkstatic=True
build --//bazel/config:build_enterprise=True
build --//bazel/config:release=False
build --//bazel/config:skip_archive=True
build --enable_platform_specific_config=true
# Profile for building fast with minimal debuggability - the build is fast ##################################################
build:fastbuild -c fastbuild
build:fastbuild --//bazel/config:opt=off
build:fastbuild --//bazel/config:dbg=True
build:fastbuild --//bazel/config:dbg_level=1
build:fastbuild --//bazel/config:debug_symbols=True
build:fastbuild --//bazel/config:separate_debug=False
build:fastbuild --//bazel/config:compiler_type=clang
build:fastbuild --//bazel/config:linkstatic=True
build:fastbuild --//bazel/config:build_enterprise=True
build:fastbuild --//bazel/config:release=False
build:fastbuild --//bazel/config:skip_archive=True
build:fastbuild --enable_platform_specific_config=true
# Profile for building highly debuggable code - the build is slow, the code is slow, the binaries are large #################
build:dbg -c dbg
build:dbg --//bazel/config:opt=debug
build:dbg --//bazel/config:dbg=True
build:dbg --//bazel/config:dbg_level=2
build:dbg --//bazel/config:debug_symbols=True
build:dbg --//bazel/config:separate_debug=False
build:dbg --//bazel/config:compiler_type=clang
build:dbg --//bazel/config:linkstatic=True
build:dbg --//bazel/config:build_enterprise=True
build:dbg --//bazel/config:release=False
build:dbg --//bazel/config:skip_archive=True
build:dbg --enable_platform_specific_config=true
# Build with address and undefined sanitizers
build:dbg_aubsan --config=dbg
build:dbg_aubsan --//bazel/config:linkstatic=False
build:dbg_aubsan --//bazel/config:allocator=system
build:dbg_aubsan --//bazel/config:asan=True
build:dbg_aubsan --//bazel/config:ubsan=True
build:dbg_aubsan --//bazel/config:skip_archive=False
build:dbg_aubsan --enable_platform_specific_config=true
# Build with thread sanitizers
build:dbg_tsan --config=dbg
build:dbg_tsan --//bazel/config:linkstatic=False
build:dbg_tsan --//bazel/config:allocator=system
build:dbg_tsan --//bazel/config:tsan=True
build:dbg_tsan --//bazel/config:libunwind=off
build:dbg_tsan --//bazel/config:skip_archive=False
build:dbg_tsan --enable_platform_specific_config=true
# Profile for building optimized code - the build is slow, the code is fast #################################################
build:opt -c opt
build:opt --//bazel/config:opt=on
build:opt --//bazel/config:dbg=False
build:opt --//bazel/config:dbg_level=2
build:opt --//bazel/config:debug_symbols=True
build:opt --//bazel/config:separate_debug=False
build:opt --//bazel/config:compiler_type=gcc
build:opt --//bazel/config:linkstatic=True
build:opt --//bazel/config:build_enterprise=True
build:opt --//bazel/config:release=False
build:opt --//bazel/config:skip_archive=True
build:opt --enable_platform_specific_config=true
# TODO: Build the code as we would release it
# build:opt_release --config=opt
# build:opt_release --//bazel/config:separate_debug=True
# build:opt_release --//bazel/config:build_enterprise=True
# build:opt_release --//bazel/config:release=True
# TODO: Open Source community build flags
# build:community
#############################################################################################################################
--config=remote_link
build:remote_link --strategy=CppLink=remote
build:remote_link --strategy=CppArchive=remote
build:remote_link --strategy=SolibSymlink=remote
build:remote_link --strategy=ExtractDebugInfo=remote
build:remote_link --strategy=StripDebugInfo=remote
build:remote_link --features=-thin_archive
# Don't detect the native toolchain on linux, only use the hermetic toolchains.
# Opt out of this by passing --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=0 on the command line.
build:linux --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
# Disable the default compiler flags to avoid certain flags that conflict with flags we setup.
build:windows --features=-smaller_binary
build:windows --features=-frame_pointer
build:windows --features=-opt
build:windows --features=-dbg
build:windows --features=-fastbuild
build:windows --features=-dynamic_link_msvcrt
# Dynamic linking on Windows (DLL generation) is currently not supported.
build:windows --//bazel/config:linkstatic=True
# The only Windows compiler we support is MSVC.
build:windows --//bazel/config:compiler_type=msvc
# Windows and MacOS do not use the custom toolchain config, so the compiler flags need to be set here.
build:macos --cxxopt=-std=c++20
build:windows --cxxopt=/std:c++20
# Set the windows version to win10 by default
# TODO(SERVER-87654): We may want to add support for other Windows versions in the future.
build:windows --cxxopt=-D_WIN32_WINNT=0x0A00
build:windows --cxxopt=-DBOOST_USE_WINAPI_VERSION=0x0A00
build:windows --cxxopt=-DNTDDI_VERSION=0x0A000000
# TODO(SERVER-93585): Remove this and fix s2 to work with Bazel's default which
# sets COMPILER_MSVC on windows.
build:windows --cxxopt=-UCOMPILER_MSVC
# Remote execution and caching is the default, but only mongodb employees will be able to access
# the engflow cluster. External builders should use the --config=local option
# Enable remote build execution:
build:linux --remote_executor=grpcs://sodalite.cluster.engflow.com
build:linux --jobs=200
# Enable remote cache (also necessary for remote build execution):
build --remote_cache=grpcs://sodalite.cluster.engflow.com
build --bes_backend=grpcs://sodalite.cluster.engflow.com
build --bes_results_url=https://sodalite.cluster.engflow.com/invocation/
build --remote_cache_compression=true
build --grpc_keepalive_time=30s
build --nolegacy_important_outputs
build --bes_keywords=repo:mongo
common --remote_upload_local_results=False
# Settings specific for clang-tidy
--config=clang-tidy
build:clang-tidy --config=dbg
build:clang-tidy --build_tag_filters=-third_party,-mongo-tidy-tests
build:clang-tidy --//bazel/config:compiler_type=clang
build:clang-tidy --aspects @bazel_clang_tidy//clang_tidy:clang_tidy.bzl%clang_tidy_aspect
build:clang-tidy --output_groups=report
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_config=//:clang_tidy_config
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_executable=//:clang_tidy
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_additional_deps=//:toolchain_files
build:clang-tidy --@bazel_clang_tidy//:clang_tidy_plugin_deps=//src/mongo/tools/mongo_tidy_checks:mongo_tidy_checks
# clang-tidy config using the v4 toolchain
--config=clang-tidy-v4
build:clang-tidy-v4 --config=clang-tidy
build:clang-tidy --//bazel/config:mongo_toolchain_version=v4
# clang-tidy config using the v5 toolchain
--config=clang-tidy-v5
build:clang-tidy-v5 --config=clang-tidy
build:clang-tidy-v5 --//bazel/config:mongo_toolchain_version=v5
# if you don't have access to the remote execution cluster above, use the local config
# described below.
# pass local config to SCons like:
# > buildscripts/scons.py BAZEL_FLAGS=--config=local <others args>
# or if invoking bazel directly pass "--config=local" on the bazel command line
--config=local
build:local --remote_executor=
build:local --remote_cache=
build:local --bes_backend=
build:local --bes_results_url=
build:local --tls_client_certificate=
build:local --tls_client_key=
build:local --remote_cache_compression=false
build:local --grpc_keepalive_time=0s
build:local --legacy_important_outputs
build:local --jobs=auto
# Disable remote execution but keep remote cache enabled
--config=no-remote-exec
common:no-remote-exec --remote_executor=
common:no-remote-exec --jobs=auto
# Disable remote execution and caching for public releases
--config=public-release
build:public-release --remote_executor=
build:public-release --remote_cache=
build:public-release --bes_backend=
build:public-release --bes_results_url=
build:public-release --tls_client_certificate=
build:public-release --tls_client_key=
build:public-release --remote_cache_compression=false
build:public-release --grpc_keepalive_time=0s
build:public-release --legacy_important_outputs
--config=fission
build:fission --fission=yes
build:fission --remote_download_all
# Avoid failing builds when BES metadata fails to upload.
common --bes_upload_mode=fully_async
# Enable Build without the Bytes
common --remote_download_outputs=toplevel
common --enable_bzlmod=false
# Default Mongo Version if a version is not specified.
build --define=MONGO_VERSION=8.1.0-alpha
# Default distmod if not specified.
build --define=MONGO_DISTMOD=""
# Default if .git directory is not present
build --define=GIT_COMMIT_HASH="nogitversion"
# try to import the bazelrc files if available
try-import %workspace%/.bazelrc.local
# TODO(WT-12780): delete this once wiredtiger switches to /.bazelrc.evergreen.
try-import %workspace%/.bazelrc.evergreen_engflow_creds
# Evergreen settings, ex. in evergreen this will set the key/cert options for access to the cluster
try-import %workspace%/.bazelrc.evergreen
# Import settings for selecting the right xcode version on mac
try-import %workspace%/.bazelrc.xcode
# local default dev settings
try-import %workspace%/.bazelrc.workstation
# local git version info
try-import %workspace%/.bazelrc.gitinfo