blob: 9ff6c552137618ae7a0a2977caba55ea3aa6c265 [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
Philipp Schraderebb658f2022-09-17 17:31:09 -070025build:k8_legacy_python --platforms=//tools/platforms:linux_x86_legacy_python --host_platform=//tools/platforms:linux_x86_legacy_python
Philipp Schraderdada1072020-11-24 11:34:46 -080026build:roborio --platforms=//tools/platforms:linux_roborio
Philipp Schrader33b5e802022-02-06 22:17:41 -080027build:roborio --platform_suffix=-roborio
Philipp Schraderf1bbf342022-02-05 14:30:15 -080028build:arm64 --platforms=//tools/platforms:linux_arm64
Philipp Schrader33b5e802022-02-06 22:17:41 -080029build:arm64 --platform_suffix=-arm64
Philipp Schraderdada1072020-11-24 11:34:46 -080030build:cortex-m4f --platforms=//tools/platforms:cortex_m4f
Philipp Schrader33b5e802022-02-06 22:17:41 -080031build:cortex-m4f --platform_suffix=-cortex-m4f
Austin Schuh0a96ea32022-01-01 22:29:30 -080032build:rp2040 --platforms=//tools/platforms:rp2040
Philipp Schrader33b5e802022-02-06 22:17:41 -080033build:rp2040 --platform_suffix=-rp2040
James Kuszmaul5a728562023-12-28 21:45:01 -080034build:cortex-m4f-imu --platforms=//tools/platforms:cortex-m4f-imu
35build:cortex-m4f-imu --platform_suffix=-cortex-m4f-imu
Austin Schuhc4788d12021-01-23 17:23:37 -080036
Brian Silverman63889f92015-11-27 01:33:56 -050037build:asan --copt -fsanitize=address
38build:asan --linkopt -fsanitize=address --linkopt -ldl
39build:asan --platform_suffix=-asan
40build:asan --test_env ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.6
41build: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 -050042build:asan --copt -fsanitize-blacklist=tools/cpp/asan-blacklist
Brian Silverman7dc6adb2017-02-19 17:04:36 -080043build:asan --define have_asan=true
Brian Silverman63889f92015-11-27 01:33:56 -050044
45build:tsan --copt -fsanitize=thread --copt -DAOS_SANITIZER_thread
46build:tsan --linkopt -fsanitize=thread
47build:tsan --platform_suffix=-tsan
48build: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 -080049build:tsan --define have_tsan=true
Brian Silverman63889f92015-11-27 01:33:56 -050050
51build:isan --copt -fsanitize=integer
52build:isan --linkopt -fsanitize=integer
53build:isan --platform_suffix=-isan
54build:isan --test_env LLVM_SYMBOLIZER=/usr/bin/llvm-symbolizer-3.6
Brian Silverman7dc6adb2017-02-19 17:04:36 -080055build:isan --define have_isan=true
Brian Silverman63889f92015-11-27 01:33:56 -050056
Brian Silvermana4a4ea62015-11-27 10:27:53 -050057build:ubsan --copt -fsanitize=undefined --copt -fno-sanitize-recover
58# Bad alignment is just slow on x86 and traps on ARM, so we'll find
59# it other ways, and some x86 code does it on purpose.
60build:ubsan --copt -fno-sanitize=alignment
Brian Silverman63889f92015-11-27 01:33:56 -050061build:ubsan --linkopt -fsanitize=undefined
Brian Silvermanb466eef2015-11-28 20:33:44 -050062# TOOD(Brian): Remove this once Clang adds it itself like it should.
63build: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 -050064build:ubsan --platform_suffix=-ubsan
Brian Silvermanb466eef2015-11-28 20:33:44 -050065build:ubsan --test_env UBSAN_OPTIONS=external_symbolizer_path=/usr/bin/llvm-symbolizer-3.6:color=always:print_stacktrace=1
66build:ubsan --copt -fsanitize-blacklist=tools/cpp/ubsan-blacklist
Brian Silverman7dc6adb2017-02-19 17:04:36 -080067build:ubsan --define have_ubsan=true
Brian Silverman63889f92015-11-27 01:33:56 -050068
Brian Silvermana4a4ea62015-11-27 10:27:53 -050069build:msan --copt -fsanitize=memory --copt -fsanitize-memory-track-origins
Brian Silvermanb466eef2015-11-28 20:33:44 -050070build:msan --linkopt -fsanitize=memory --linkopt -fsanitize-memory-track-origins
Brian Silverman63889f92015-11-27 01:33:56 -050071build:msan --platform_suffix=-msan
72build:msan --test_env MSAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.6
Brian Silverman7dc6adb2017-02-19 17:04:36 -080073build:msan --define have_msan=true
Brian Silverman63889f92015-11-27 01:33:56 -050074
James Kuszmaul2af1ba82019-02-09 22:16:53 -080075# Sometime, we want to be able to have eigen assertions run so that we can
76# catch potential issues (e.g., accessing invalid indices).
77build:eigen --copt -UNDEBUG
78
Brian Silverman12b3fc52015-10-11 19:38:33 -040079# Show paths to a few more than just 1 target.
Austin Schuh00bc0932016-02-14 21:05:34 -080080build --show_result 5
Brian Silverman12b3fc52015-10-11 19:38:33 -040081# Dump the output of the failing test to stdout.
Eric Schmiedebergef44b8a2022-02-28 17:30:38 -070082# Keep the default test timeouts except make 'eternal'=4500 secs
Austin Schuh493ee9f2023-01-04 16:52:15 -080083test --test_output=errors --test_timeout=-1,-1,-1,5500
Brian Silvermanb200c172017-01-02 17:35:35 -080084
Philipp Schrader6efe5732022-02-12 15:11:13 -080085build --sandbox_base=/dev/shm/
Austin Schuh9d92e6b2017-10-17 01:19:38 -070086
87build --sandbox_fake_hostname=true
88build --sandbox_fake_username=true
89
Austin Schuh9d92e6b2017-10-17 01:19:38 -070090startup --host_jvm_args=-Dbazel.DigestFunction=SHA1
91
92common --watchfs
Austin Schuhe18baff2018-10-20 17:40:42 -070093
94# Switch to SHA256 for compatibility with distributed caching.
95startup --host_jvm_args=-Dbazel.DigestFunction=SHA256
96
Austin Schuhf148eb92023-11-05 12:37:07 -080097build --spawn_strategy=sandboxed
Philipp Schrader6efe5732022-02-12 15:11:13 -080098build --sandbox_default_allow_network=false
Austin Schuhe18baff2018-10-20 17:40:42 -070099
Austin Schuhf148eb92023-11-05 12:37:07 -0800100build --strategy=TsProject=sandboxed
101build --strategy=CopyFile=standalone
102build --strategy=CopyDirectory=standalone
Austin Schuh89a95052019-04-14 14:51:14 -0700103
Austin Schuhe18baff2018-10-20 17:40:42 -0700104# Use our hermetic JDK.
105# Note that this doesn't quite work fully, but it should. See
106# https://github.com/bazelbuild/bazel/issues/6341 for ongoing discussion with
107# upstream about this.
Tyler Chatowfba57822022-03-22 19:38:41 -0700108build --java_runtime_version=openjdk_11 --tool_java_runtime_version=openjdk_11
Philipp Schraderd64e1302020-12-12 18:53:00 -0800109
110# Prevent falling back to the host JDK.
111startup --noautodetect_server_javabase
Philipp Schrader7365d322022-03-06 16:40:08 -0800112
113# Give each build action and test its own /tmp.
114build --sandbox_tmpfs_path=/tmp
Philipp Schrader175a93c2023-02-19 13:13:40 -0800115
116# Prevent cypress from using its own binary. We want to use the hermetic one.
117build --action_env=CYPRESS_INSTALL_BINARY=0
Philipp Schrader4502b252023-08-23 20:15:39 -0700118
Adam Snaider13d48d92023-08-03 12:20:15 -0700119# From our one and only phil.schrader: https://groups.google.com/g/bazel-discuss/c/5cbRuLuTwNg :)
120# Enable -Werror and warnings for our code
121# TODO: It would be nice to enable Wcast-align and Wcast-qual.
122build --per_file_copt=-third_party/.*,-external/.*@-Werror,-Wextra,-Wpointer-arith,-Wstrict-aliasing,-Wwrite-strings,-Wtype-limits,-Wsign-compare,-Wformat=2
123# NOTE: Explicitly disable -Werror because the `-external/.*` filter does not work
124build --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
125
Philipp Schrader4502b252023-08-23 20:15:39 -0700126# Load a local file that users can use to customize bazel invocations. This
127# should stay the last line in this file so users can override things when they
128# want.
129try-import %workspace%/.bazelrc.user
Adam Snaider13d48d92023-08-03 12:20:15 -0700130