blob: be75aa1c30b12d49752f2ba727904a301f367261 [file] [log] [blame]
Philipp Schraderdada1072020-11-24 11:34:46 -08001# Use platforms to build our code.
2build --incompatible_enable_cc_toolchain_resolution
3
Austin Schuhc26a2902022-01-14 16:34:25 -08004# Rewrite all URLs to be on software.frc971.org
5common --experimental_downloader_config=tools/dependency_rewrite
6
Austin Schuh085eab92020-11-26 13:54:51 -08007# Default to py3 since that's all we support
8build --python_version=PY3
Philipp Schraderebb658f2022-09-17 17:31:09 -07009build --incompatible_default_to_explicit_init_py
Austin Schuh085eab92020-11-26 13:54:51 -080010
Philipp Schraderdada1072020-11-24 11:34:46 -080011# For now we only support building on x86 Linux so we can hard-code the host
12# platform.
13build --host_platform=//tools/platforms:linux_x86
Brian Silvermanfbe4fd52015-10-26 10:40:55 -040014
Brian Silverman5bc54342015-11-26 22:57:46 -050015# Always include debug information in the non-.stripped binaries.
16build --strip=never
17
Austin Schuhda9d0602019-09-15 17:29:38 -070018build --noincompatible_disable_nocopts
Austin Schuhda9d0602019-09-15 17:29:38 -070019
Brian Silverman516ceb22015-11-27 01:29:05 -050020# Use the malloc we want.
21build --custom_malloc=//tools/cpp:malloc
22
Philipp Schraderdada1072020-11-24 11:34:46 -080023# Shortcuts for selecting the target platform.
24build:k8 --platforms=//tools/platforms:linux_x86
25build:roborio --platforms=//tools/platforms:linux_roborio
Philipp Schrader33b5e802022-02-06 22:17:41 -080026build:roborio --platform_suffix=-roborio
Philipp Schraderf1bbf342022-02-05 14:30:15 -080027build:arm64 --platforms=//tools/platforms:linux_arm64
Philipp Schrader33b5e802022-02-06 22:17:41 -080028build:arm64 --platform_suffix=-arm64
Philipp Schraderdada1072020-11-24 11:34:46 -080029build:cortex-m4f --platforms=//tools/platforms:cortex_m4f
Philipp Schrader33b5e802022-02-06 22:17:41 -080030build:cortex-m4f --platform_suffix=-cortex-m4f
Austin Schuh0a96ea32022-01-01 22:29:30 -080031build:rp2040 --platforms=//tools/platforms:rp2040
Philipp Schrader33b5e802022-02-06 22:17:41 -080032build:rp2040 --platform_suffix=-rp2040
James Kuszmaul5a728562023-12-28 21:45:01 -080033build:cortex-m4f-imu --platforms=//tools/platforms:cortex-m4f-imu
34build:cortex-m4f-imu --platform_suffix=-cortex-m4f-imu
Austin Schuhc4788d12021-01-23 17:23:37 -080035
Brian Silverman63889f92015-11-27 01:33:56 -050036build:asan --copt -fsanitize=address
37build:asan --linkopt -fsanitize=address --linkopt -ldl
38build:asan --platform_suffix=-asan
39build:asan --test_env ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.6
40build: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
Brian Silvermanb466eef2015-11-28 20:33:44 -050041build:asan --copt -fsanitize-blacklist=tools/cpp/asan-blacklist
Brian Silverman7dc6adb2017-02-19 17:04:36 -080042build:asan --define have_asan=true
Brian Silverman63889f92015-11-27 01:33:56 -050043
44build:tsan --copt -fsanitize=thread --copt -DAOS_SANITIZER_thread
45build:tsan --linkopt -fsanitize=thread
46build:tsan --platform_suffix=-tsan
47build:tsan --test_env TSAN_OPTIONS=external_symbolizer_path=/usr/bin/llvm-symbolizer-3.6:detect_deadlocks=1:second_deadlock_stack=1
Brian Silverman7dc6adb2017-02-19 17:04:36 -080048build:tsan --define have_tsan=true
Brian Silverman63889f92015-11-27 01:33:56 -050049
50build:isan --copt -fsanitize=integer
51build:isan --linkopt -fsanitize=integer
52build:isan --platform_suffix=-isan
53build:isan --test_env LLVM_SYMBOLIZER=/usr/bin/llvm-symbolizer-3.6
Brian Silverman7dc6adb2017-02-19 17:04:36 -080054build:isan --define have_isan=true
Brian Silverman63889f92015-11-27 01:33:56 -050055
Brian Silvermana4a4ea62015-11-27 10:27:53 -050056build:ubsan --copt -fsanitize=undefined --copt -fno-sanitize-recover
57# Bad alignment is just slow on x86 and traps on ARM, so we'll find
58# it other ways, and some x86 code does it on purpose.
59build:ubsan --copt -fno-sanitize=alignment
Brian Silverman63889f92015-11-27 01:33:56 -050060build:ubsan --linkopt -fsanitize=undefined
Brian Silvermanb466eef2015-11-28 20:33:44 -050061# TOOD(Brian): Remove this once Clang adds it itself like it should.
62build:ubsan --linkopt /usr/lib/llvm-3.6/lib/clang/3.6.2/lib/linux/libclang_rt.ubsan_cxx-x86_64.a
Brian Silverman63889f92015-11-27 01:33:56 -050063build:ubsan --platform_suffix=-ubsan
Brian Silvermanb466eef2015-11-28 20:33:44 -050064build:ubsan --test_env UBSAN_OPTIONS=external_symbolizer_path=/usr/bin/llvm-symbolizer-3.6:color=always:print_stacktrace=1
65build:ubsan --copt -fsanitize-blacklist=tools/cpp/ubsan-blacklist
Brian Silverman7dc6adb2017-02-19 17:04:36 -080066build:ubsan --define have_ubsan=true
Brian Silverman63889f92015-11-27 01:33:56 -050067
Brian Silvermana4a4ea62015-11-27 10:27:53 -050068build:msan --copt -fsanitize=memory --copt -fsanitize-memory-track-origins
Brian Silvermanb466eef2015-11-28 20:33:44 -050069build:msan --linkopt -fsanitize=memory --linkopt -fsanitize-memory-track-origins
Brian Silverman63889f92015-11-27 01:33:56 -050070build:msan --platform_suffix=-msan
71build:msan --test_env MSAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.6
Brian Silverman7dc6adb2017-02-19 17:04:36 -080072build:msan --define have_msan=true
Brian Silverman63889f92015-11-27 01:33:56 -050073
James Kuszmaul2af1ba82019-02-09 22:16:53 -080074# Sometime, we want to be able to have eigen assertions run so that we can
75# catch potential issues (e.g., accessing invalid indices).
76build:eigen --copt -UNDEBUG
77
Brian Silverman12b3fc52015-10-11 19:38:33 -040078# Show paths to a few more than just 1 target.
Austin Schuh00bc0932016-02-14 21:05:34 -080079build --show_result 5
Brian Silverman12b3fc52015-10-11 19:38:33 -040080# Dump the output of the failing test to stdout.
Eric Schmiedebergef44b8a2022-02-28 17:30:38 -070081# Keep the default test timeouts except make 'eternal'=4500 secs
Austin Schuh493ee9f2023-01-04 16:52:15 -080082test --test_output=errors --test_timeout=-1,-1,-1,5500
Brian Silvermanb200c172017-01-02 17:35:35 -080083
Philipp Schrader6efe5732022-02-12 15:11:13 -080084build --sandbox_base=/dev/shm/
Austin Schuh9d92e6b2017-10-17 01:19:38 -070085
86build --sandbox_fake_hostname=true
87build --sandbox_fake_username=true
88
Austin Schuh9d92e6b2017-10-17 01:19:38 -070089startup --host_jvm_args=-Dbazel.DigestFunction=SHA1
90
91common --watchfs
Austin Schuhe18baff2018-10-20 17:40:42 -070092
93# Switch to SHA256 for compatibility with distributed caching.
94startup --host_jvm_args=-Dbazel.DigestFunction=SHA256
95
Austin Schuhf148eb92023-11-05 12:37:07 -080096build --spawn_strategy=sandboxed
Philipp Schrader6efe5732022-02-12 15:11:13 -080097build --sandbox_default_allow_network=false
Philipp Schrader94a14dc2024-02-25 20:13:11 -080098build --incompatible_exclusive_test_sandboxed
Austin Schuhe18baff2018-10-20 17:40:42 -070099
Austin Schuh39533602024-04-13 17:51:43 -0700100build --strategy=TsProject=remote,sandboxed
101build --strategy=CopyFile=remote,standalone
102build --strategy=CopyDirectory=remote,standalone
103build --strategy=CopyToDirectory=remote,standalone
104build --strategy=NpmLifecycleHook=remote,sandboxed,standalone
Austin Schuh89a95052019-04-14 14:51:14 -0700105
Philipp Schraderba072d92024-02-21 17:00:37 -0800106# Honor the setting of `skipLibCheck` in the tsconfig.json file.
107# https://www.typescriptlang.org/tsconfig#skipLibCheck
108build --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
109fetch --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
110query --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
111
112# Use "tsc" as the transpiler when ts_project has no `transpiler` set.
113# For now this is an acceptable default, but it would be nice to switch to swc in the future.
114# https://docs.aspect.build/rulesets/aspect_rules_ts/docs/transpiler/
115build --@aspect_rules_ts//ts:default_to_tsc_transpiler
116fetch --@aspect_rules_ts//ts:default_to_tsc_transpiler
117query --@aspect_rules_ts//ts:default_to_tsc_transpiler
118
Austin Schuhe18baff2018-10-20 17:40:42 -0700119# Use our hermetic JDK.
120# Note that this doesn't quite work fully, but it should. See
121# https://github.com/bazelbuild/bazel/issues/6341 for ongoing discussion with
122# upstream about this.
Tyler Chatowfba57822022-03-22 19:38:41 -0700123build --java_runtime_version=openjdk_11 --tool_java_runtime_version=openjdk_11
Philipp Schraderd64e1302020-12-12 18:53:00 -0800124
125# Prevent falling back to the host JDK.
126startup --noautodetect_server_javabase
Philipp Schrader7365d322022-03-06 16:40:08 -0800127
Austin Schuh39533602024-04-13 17:51:43 -0700128common --experimental_repo_remote_exec
129
Philipp Schrader7365d322022-03-06 16:40:08 -0800130# Give each build action and test its own /tmp.
131build --sandbox_tmpfs_path=/tmp
Philipp Schrader175a93c2023-02-19 13:13:40 -0800132
133# Prevent cypress from using its own binary. We want to use the hermetic one.
134build --action_env=CYPRESS_INSTALL_BINARY=0
Philipp Schrader4502b252023-08-23 20:15:39 -0700135
Adam Snaider13d48d92023-08-03 12:20:15 -0700136# From our one and only phil.schrader: https://groups.google.com/g/bazel-discuss/c/5cbRuLuTwNg :)
137# Enable -Werror and warnings for our code
138# TODO: It would be nice to enable Wcast-align and Wcast-qual.
139build --per_file_copt=-third_party/.*,-external/.*@-Werror,-Wextra,-Wpointer-arith,-Wstrict-aliasing,-Wwrite-strings,-Wtype-limits,-Wsign-compare,-Wformat=2
140# NOTE: Explicitly disable -Werror because the `-external/.*` filter does not work
141build --per_file_copt=third_party/.*,external/.*@-Wno-sign-compare,-Wno-cast-align,-Wno-error,-Wno-unused-parameter,-Wno-cast-qual,-Wno-format-nonliteral,-Wno-tautological-type-limit-compare,-Wno-missing-field-initializers,-Wno-unused-function,-Wno-cast-function-type,-Wno-comment,-Wno-typedef-redefinition,-Wno-tautological-unsigned-enum-zero-compare,-Wno-extra,-Wno-type-limits,-Wno-attributes,-Wno-deprecated
142
Austin Schuh8f99c822024-05-05 22:43:40 -0700143# bzlmod breaks our code base right now, deal with this later.
144common --enable_bzlmod=false
145
146# Disable warnings about using directories in Bazel.
147startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1
148
Austin Schuh39533602024-04-13 17:51:43 -0700149build --incompatible_strict_action_env --experimental_inmemory_dotd_files --experimental_inmemory_jdeps_files --experimental_remote_merkle_tree_cache --incompatible_allow_tags_propagation
150
151# Builds on the buildbarn cluster running in the datacenter. This will only
152# work inside the datacenter.
153build:remote --remote_executor=grpc://data-fast:8980
154build:remote --remote_timeout=1500
155build:remote --spawn_strategy=remote,linux-sandbox
156build:remote --grpc_keepalive_time=30s
157build:remote --remote_instance_name=fuse
158build:remote --verbose_failures
159
Philipp Schrader4502b252023-08-23 20:15:39 -0700160# Load a local file that users can use to customize bazel invocations. This
161# should stay the last line in this file so users can override things when they
162# want.
163try-import %workspace%/.bazelrc.user