-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path.bazelrc
More file actions
259 lines (213 loc) · 11.7 KB
/
Copy path.bazelrc
File metadata and controls
259 lines (213 loc) · 11.7 KB
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
# Use platforms to build our code.
build --incompatible_enable_cc_toolchain_resolution
common --enable_platform_specific_config
# Rewrite all URLs to be on realtimeroboticsgroup.org
common --downloader_config=tools/dependency_rewrite
# Default to py3 since that's all we support
build --python_version=PY3
build --incompatible_default_to_explicit_init_py
build --@rules_python//python/config_settings:bootstrap_impl=script
build --@rules_python//python/config_settings:venvs_use_declare_symlink=no
# For now we only support building on x86 Linux so we can hard-code the host
# platform.
build:linux --host_platform=//tools/platforms:linux_x86
# macOS ARM64 (Apple Silicon) platform configuration
build:macos --host_platform=//tools/platforms:darwin_arm64
# Always include debug information in the non-.stripped binaries.
build --strip=never
build --noincompatible_disable_nocopts
# Use the malloc we want.
build --custom_malloc=//tools/cpp:malloc
# Shortcuts for selecting the target platform.
build:k8 --platforms=//tools/platforms:linux_x86
build:k8_no_gpu --platforms=//tools/platforms:linux_x86_no_gpu
build:roborio --platforms=//tools/platforms:linux_roborio
build:roborio --platform_suffix=-roborio
build:arm64 --platforms=//tools/platforms:linux_arm64
build:arm64 --platform_suffix=-arm64
build:cortex-m4f --platforms=//tools/platforms:cortex_m4f
build:cortex-m4f --platform_suffix=-cortex-m4f
build:rp2040 --platforms=//tools/platforms:rp2040
build:rp2040 --platform_suffix=-rp2040
build:cortex-m4f-imu --platforms=//tools/platforms:cortex-m4f-imu
build:cortex-m4f-imu --platform_suffix=-cortex-m4f-imu
build:asan --run_under=//tools:sanitizer_wrapper
build:asan --features=asan
build:asan --linkopt -ldl
build:asan --platform_suffix=-asan
build:asan --test_env ASAN_OPTIONS=detect_leaks=1:check_initialization_order=1:strict_init_order=1:detect_stack_use_after_return=1:detect_odr_violation=2:allow_user_segv_handler=1
build:asan --copt -fsanitize-blacklist=tools/cpp/asan-blacklist
build:tsan --run_under=//tools:sanitizer_wrapper
build:tsan --features=tsan
build:tsan --copt -DAOS_SANITIZER_thread
build:tsan --platform_suffix=-tsan
build:isan --run_under=//tools:sanitizer_wrapper
build:isan --copt -fsanitize=integer
build:isan --linkopt -fsanitize=integer
build:isan --platform_suffix=-isan
build:ubsan --run_under=//tools:sanitizer_wrapper
build:ubsan --features=ubsan
# Bad alignment is just slow on x86 and traps on ARM, so we'll find
# it other ways, and some x86 code does it on purpose.
build:ubsan --copt -fno-sanitize=alignment
build:ubsan --platform_suffix=-ubsan
build:ubsan --copt -fsanitize-blacklist=tools/cpp/ubsan-blacklist
# MemorySanitizer is enabled through the toolchain's `msan` feature rather than
# raw --copt/--linkopt flags. The feature swaps in the instrumented libc++ that
# msan requires and, because Bazel resets --features to --host_features in the
# exec configuration, build tools (flatc, protoc, ...) stay uninstrumented.
build:msan --run_under=//tools:sanitizer_wrapper
build:msan --features=msan
build:msan --platform_suffix=-msan
# Sometime, we want to be able to have eigen assertions run so that we can
# catch potential issues (e.g., accessing invalid indices).
build:eigen --copt -UNDEBUG
# Show paths to a few more than just 1 target.
build --show_result 5
# Dump the output of the failing test to stdout.
# Keep the default test timeouts except make 'eternal'=4500 secs
test --test_output=errors --test_timeout=-1,-1,-1,5500
build:linux --sandbox_base=/dev/shm/
build --sandbox_fake_hostname=true
build --sandbox_fake_username=true
startup --host_jvm_args=-Dbazel.DigestFunction=SHA1
common --watchfs
# Switch to SHA256 for compatibility with distributed caching.
startup --host_jvm_args=-Dbazel.DigestFunction=SHA256
build:linux --spawn_strategy=sandboxed
build:macos --spawn_strategy=sandboxed
build:linux --sandbox_default_allow_network=false
build:macos --sandbox_default_allow_network=false
build:linux --incompatible_exclusive_test_sandboxed
build:macos --incompatible_exclusive_test_sandboxed
# Windows platform overrides
build:windows --spawn_strategy=standalone
build:windows --sandbox_default_allow_network=true
build:windows --enable_runfiles
build:linux --strategy=TsProject=remote,sandboxed
build:macos --strategy=TsProject=remote,sandboxed
build:windows --strategy=TsProject=remote,local
build --strategy=CopyFile=remote,standalone
build --strategy=CopyDirectory=remote,standalone
build --strategy=CopyToDirectory=remote,standalone
build:linux --strategy=NpmLifecycleHook=remote,sandboxed,standalone
build:macos --strategy=NpmLifecycleHook=remote,sandboxed,standalone
build:windows --strategy=NpmLifecycleHook=remote,standalone,local
# Some tests (like gazelle_test) require standalone local execution to access the
# workspace directories, or need standalone fallback on CI environments where
# the linux-sandbox execution strategy is not supported.
build:linux --strategy=TestRunner=remote,sandboxed,standalone
build:macos --strategy=TestRunner=remote,sandboxed,standalone
# Honor the setting of `skipLibCheck` in the tsconfig.json file.
# https://www.typescriptlang.org/tsconfig#skipLibCheck
build --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
fetch --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
query --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
# Use "tsc" as the transpiler when ts_project has no `transpiler` set.
# For now this is an acceptable default, but it would be nice to switch to swc in the future.
# https://docs.aspect.build/rulesets/aspect_rules_ts/docs/transpiler/
build --@aspect_rules_ts//ts:default_to_tsc_transpiler
fetch --@aspect_rules_ts//ts:default_to_tsc_transpiler
query --@aspect_rules_ts//ts:default_to_tsc_transpiler
# Use our hermetic JDK.
# Note that this doesn't quite work fully, but it should. See
# https://github.com/bazelbuild/bazel/issues/6341 for ongoing discussion with
# upstream about this.
build --java_runtime_version=openjdk_11 --tool_java_runtime_version=openjdk_11
# Prevent falling back to the host JDK.
startup --noautodetect_server_javabase
common --experimental_repo_remote_exec
# Give each build action and test its own /tmp.
build --sandbox_tmpfs_path=/tmp
# Prevent cypress from using its own binary. We want to use the hermetic one.
build --action_env=CYPRESS_INSTALL_BINARY=0
# Allow spaces in runfiles filenames.
build --experimental_inprocess_symlink_creation
common --enable_bzlmod=true
# Consult our local registry before bcr. Every module under registry/ is
# private to AOS and not published on bcr, so probing bcr first only records
# useless "<bcr url>: not found" negatives in MODULE.bazel.lock. Those
# negatives are only written when Bazel actually re-probes bcr (fresh CI
# server / cold cache), so they churn in and out between local and CI runs.
# Both registries live in the platform config so the local one is always
# applied before bcr (--enable_platform_specific_config applies the
# :linux/:macos block after plain `common` options, which would otherwise
# put bcr first).
common:linux --registry=file://%workspace%/registry
common:linux --registry=https://bcr.bazel.build
common:macos --registry=file://%workspace%/registry
common:macos --registry=https://bcr.bazel.build
# Windows hosts get both registry paths injected by tools/bazel.bat at runtime.
# TODO(austin): Finish this migration... Remove workspace support when users are done.
common --noenable_workspace --noincompatible_disallow_empty_glob --incompatible_disallow_struct_provider_syntax=false
# Disable warnings about using directories in Bazel.
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1
build --incompatible_strict_action_env --experimental_inmemory_dotd_files --experimental_inmemory_jdeps_files --experimental_remote_merkle_tree_cache --incompatible_allow_tags_propagation
# Builds on the buildbarn cluster running in the datacenter. This will only
# work inside the datacenter.
build:remote --remote_executor=grpcs://engflow.spacecookies.dev --bes_backend=grpcs://engflow.spacecookies.dev --bes_results_url=https://engflow.spacecookies.dev/invocation/
build:remote --jobs=100
build:remote --remote_timeout=1500
build:remote --spawn_strategy=remote,linux-sandbox
build:remote --grpc_keepalive_time=30s
build:remote --verbose_failures
# How to use IWYU - Include What You Use
# Start by deleting any *.iwyu.txt files that you might have from a previous run:
# find -L bazel-bin/ -name "*.iwyu.txt" | xargs rm
# Build desired target(s)
# bazel build --config=iwyu //my:target
# run script to fix includes
# find -L bazel-bin/ -name "*.iwyu.txt" | xargs cat | \
# bazel run @bazel_iwyu//:fix_includes -- --nosafe_headers
# run clang-format to get includes in the right order
# bazel run //tools/lint:clang_format
# build targets, or ideally everything, to make sure that it still builds.
#
# If you are unhappy with the result, you have the following options:
# Use pragmas or mappings.
# https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md
# https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUMappings.md
# Our mapping files are in tools/iwyu.
build:iwyu --aspects @bazel_iwyu//bazel/iwyu:iwyu.bzl%iwyu_aspect
build:iwyu --@bazel_iwyu//:iwyu_mappings=//tools/iwyu:mappings
build:iwyu --output_groups=report
build:iwyu --@bazel_iwyu//:iwyu_opts=--no_fwd_decls,--cxx17ns,--verbose=3
build:iwyu --strategy=iwyu=sandboxed,standalone
common --experimental_remote_merkle_tree_cache
common --@rules_cuda//cuda:compiler=clang
# rules_cuda implicitly adds `@rules_cuda//cuda:runtime` (default
# `@cuda//:cuda_runtime`) as a dep of every `cuda_library`. The default
# target is generated from rules_cuda's auto-detected host CUDA toolkit,
# which on machines that have CUDA installed system-wide pulls in x86_64
# libs and breaks arm64 cross-compiles. Point it at our platform-aware
# `//third_party:cudart` instead.
common --@rules_cuda//cuda:runtime=//third_party:cudart
# CUDA target architectures, matched to the GPUs we deploy to:
# - x86_64 dev/test: RTX 20-series (sm_75) and 30-series (sm_86).
# - arm64 (Jetson Orin): sm_87.
build --@rules_cuda//cuda:archs=sm_75;sm_86
build:arm64 --@rules_cuda//cuda:archs=sm_87
# Clang 21 only marks CUDA up to 12.5 as fully supported; the Orin sysroot
# ships 12.6, so silence the "partially supported" warning to match what the
# old toolchains_llvm "cuda" feature did.
build --@rules_cuda//cuda:copts=-Wno-unknown-cuda-version
# Config for running in CI (e.g., Buildkite).
# We want developers to have liberal access to packages during local development,
# but CI is restricted to prebuilt packages resolved exclusively from our mirror.
#
# These environment variables are passed to Bzlmod repository rules and read
# by rules_python's `pip.parse` extension to configure pip's index URL and trusted hosts.
# - AOS_RUNNING_IN_CI: Informs repository rules we are running on a CI server.
# - AOS_PIP_INDEX_URL & AOS_PIP_EXTRA_INDEX_URL: Configures pip to resolve packages
# exclusively from the internal mirror instead of public PyPI.
# - AOS_PIP_TRUSTED_HOST: Bypasses SSL cert issues on CI runner hosts by making the mirror
# trusted. Note: this remains unset locally to prevent bypassing SSL checks for developers.
common:running_in_ci --repo_env=AOS_RUNNING_IN_CI=1
common:running_in_ci --repo_env=AOS_PIP_INDEX_URL=https://realtimeroboticsgroup.org/build-dependencies/wheelhouse/simple
common:running_in_ci --repo_env=AOS_PIP_EXTRA_INDEX_URL=https://realtimeroboticsgroup.org/build-dependencies/wheelhouse/simple
common:running_in_ci --repo_env=AOS_PIP_TRUSTED_HOST=--trusted-host=realtimeroboticsgroup.org
import %workspace%/.bazelrc_autodetection
# Load a local file that users can use to customize bazel invocations. This
# should stay the last line in this file so users can override things when they
# want.
try-import %workspace%/.bazelrc.user