blob: fcd1269812f3947f44c523731b53fcdc5f23de97 [file] [log] [blame] [edit]
# Use platforms to build our code.
build --incompatible_enable_cc_toolchain_resolution
# Rewrite all URLs to be on software.frc971.org
common --experimental_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
# For now we only support building on x86 Linux so we can hard-code the host
# platform.
build --host_platform=//tools/platforms:linux_x86
# 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: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 --copt -fsanitize=address
build:asan --linkopt -fsanitize=address --linkopt -ldl
build:asan --platform_suffix=-asan
build:asan --test_env ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.6
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:asan --define have_asan=true
build:tsan --copt -fsanitize=thread --copt -DAOS_SANITIZER_thread
build:tsan --linkopt -fsanitize=thread
build:tsan --platform_suffix=-tsan
build:tsan --test_env TSAN_OPTIONS=external_symbolizer_path=/usr/bin/llvm-symbolizer-3.6:detect_deadlocks=1:second_deadlock_stack=1
build:tsan --define have_tsan=true
build:isan --copt -fsanitize=integer
build:isan --linkopt -fsanitize=integer
build:isan --platform_suffix=-isan
build:isan --test_env LLVM_SYMBOLIZER=/usr/bin/llvm-symbolizer-3.6
build:isan --define have_isan=true
build:ubsan --copt -fsanitize=undefined --copt -fno-sanitize-recover
# 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 --linkopt -fsanitize=undefined
# TOOD(Brian): Remove this once Clang adds it itself like it should.
build:ubsan --linkopt /usr/lib/llvm-3.6/lib/clang/3.6.2/lib/linux/libclang_rt.ubsan_cxx-x86_64.a
build:ubsan --platform_suffix=-ubsan
build:ubsan --test_env UBSAN_OPTIONS=external_symbolizer_path=/usr/bin/llvm-symbolizer-3.6:color=always:print_stacktrace=1
build:ubsan --copt -fsanitize-blacklist=tools/cpp/ubsan-blacklist
build:ubsan --define have_ubsan=true
build:msan --copt -fsanitize=memory --copt -fsanitize-memory-track-origins
build:msan --linkopt -fsanitize=memory --linkopt -fsanitize-memory-track-origins
build:msan --platform_suffix=-msan
build:msan --test_env MSAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.6
build:msan --define have_msan=true
# 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 --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 --spawn_strategy=sandboxed
build --sandbox_default_allow_network=false
build --incompatible_exclusive_test_sandboxed
build --strategy=TsProject=remote,sandboxed
build --strategy=CopyFile=remote,standalone
build --strategy=CopyDirectory=remote,standalone
build --strategy=CopyToDirectory=remote,standalone
build --strategy=NpmLifecycleHook=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
# From our one and only phil.schrader: https://groups.google.com/g/bazel-discuss/c/5cbRuLuTwNg :)
# Enable -Werror and warnings for our code
# TODO: It would be nice to enable Wcast-align and Wcast-qual.
build --per_file_copt=-third_party/.*,-external/.*@-Werror,-Wextra,-Wpointer-arith,-Wstrict-aliasing,-Wwrite-strings,-Wtype-limits,-Wsign-compare,-Wformat=2
# NOTE: Explicitly disable -Werror because the `-external/.*` filter does not work
build --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
# bzlmod breaks our code base right now, deal with this later.
common --enable_bzlmod=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=grpc://data-fast:8980
build:remote --remote_timeout=1500
build:remote --spawn_strategy=remote,linux-sandbox
build:remote --grpc_keepalive_time=30s
build:remote --remote_instance_name=fuse
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 -I % sh -c 'external/iwyu_prebuilt_pkg/bin/fix_includes.py --nosafe_headers < $1' sh %
# 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 @com_github_storypku_bazel_iwyu//bazel/iwyu:iwyu.bzl%iwyu_aspect
build:iwyu --@com_github_storypku_bazel_iwyu//:iwyu_mappings=//tools/iwyu:mappings
build:iwyu --output_groups=report
build:iwyu --@com_github_storypku_bazel_iwyu//:iwyu_opts=--no_fwd_decls,--cxx17ns,--verbose=3
build:iwyu --strategy=iwyu=sandboxed,standalone
# 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