1-
2- # We rely on all symbols being included when linking for our implementation of
3- # the "factory" design pattern.
4- build --incompatible_remove_legacy_whole_archive=False
1+ ################## Base Bazel Configs ##################
2+ common --enable_bzlmod
3+ common --lockfile_mode=update
4+ common --noincompatible_disallow_empty_glob # Allow globs to be empty without failing
5+ common --incompatible_disallow_struct_provider_syntax=false
56
67# We want bazel to output the results of our gtests
78test --test_output=all
89
9- # Use Our Custom Toolchain
10- build --crosstool_top=//cc_toolchain:toolchain
11-
12- # Add warnings to Thunderbots code only
13- build --per_file_copt=//proto/.*,//proto/message_translation/.*,//proto/primitive/.*,//software/.*,//shared/.*@-Wall,-Wextra,-Wconversion,-Wno-unused-parameter,-Wno-deprecated,-Werror,-Wno-deprecated-declarations
10+ ################## Bazel Debug Configs ##################
1411
15- # Warn variable length arrays only when compiling cpp
16- build --per_file_copt=.*\.cpp@-Wvla
17-
18- # Automatically set the CPU environment based on the `--cpu` flag as per our
19- # defined CPU environments
20- build --auto_cpu_environment_group=//cc_toolchain:cpus
12+ # Enable the following commands to debug Bazel. Note that the additional overhead from these commands will
13+ # cause CI to fail
14+ # common --verbose_failures
15+ # common --sandbox_debug
2116
22- # Use a local directory as a remote cache. This shares artifacts when switching
23- # between git branches or workspaces for the same project.
24- # See https://docs.bazel.build/versions/master/remote-caching.html#disk-cache
25- build --disk_cache=~/.cache/thunderbots_bazel_disk_cache
17+ ################ Machine Configurations ################
2618
2719# The XDR_RUNTIME_DIR and DISPLAY environment variables must be passed to the tests
2820# so that our GUIs can be enabled for simulated tests. This is needed for Qt
@@ -34,6 +26,54 @@ build --test_env=DISPLAY
3426build --action_env=PYTHON_BIN_PATH=/opt/tbotspython/bin/python3.12
3527build --action_env=PYTHON_LIB_PATH=/opt/tbotspython/lib/python3.12
3628
37- # Enable the new cc_toolchain resolution strategy
38- # #TODO(#3382): Delete when we upgrade to Bazel 7.0
39- build --incompatible_enable_cc_toolchain_resolution
29+ # Automatically set the CPU environment based on the `--cpu` flag as per our
30+ # defined CPU environments
31+ build --auto_cpu_environment_group=//toolchains/cc:cpus
32+
33+ # Use Our Custom Toolchain
34+ build --crosstool_top=//toolchains/cc:toolchain
35+ common --features=external_include_paths
36+
37+ ################# Build Optimizations #################
38+
39+ # Use a local directory as a remote cache. This shares artifacts when switching
40+ # between git branches or workspaces for the same project.
41+ # See https://docs.bazel.build/versions/master/remote-caching.html#disk-cache
42+ build --disk_cache=~/.cache/thunderbots_bazel_disk_cache
43+
44+ build --experimental_remote_merkle_tree_cache # partial repo caching optimization
45+ build --incompatible_enable_proto_toolchain_resolution # protoc caching
46+
47+ # Ensure that we don't accidentally build gRPC
48+ common --per_file_copt=external/.*grpc.*@--GRPC_WAS_NOT_SUPPOSED_TO_BE_BUILT
49+ common --host_per_file_copt=external/.*grpc.*@--GRPC_WAS_NOT_SUPPOSED_TO_BE_BUILT
50+
51+ ################# Build Configurations #################
52+ # Lock C++ version
53+ build --cxxopt="-std=c++2a"
54+ # Warn variable length arrays only when compiling cpp
55+ build --per_file_copt=.*\.cpp@-Wvla
56+
57+ # Enable runfiles symlink tree
58+ build --enable_runfiles
59+
60+ # Allow usage of platform specific .bazelrc configs (e.g. build:linux, common:windows, etc)
61+ common --enable_platform_specific_config
62+
63+ # We rely on all symbols being included when linking for our implementation of
64+ # the "factory" design pattern.
65+ build --incompatible_remove_legacy_whole_archive=False
66+
67+ # Escalate Warnings to fail Compile for Thunderbots code
68+ build --features=external_include_paths
69+ build --per_file_copt=proto/.*,proto/message_translation/.*,proto/primitive/.*,software/.*,shared/.*,-external/.*@-Wall,-Wextra,-Wno-unused-parameter,-Wno-deprecated,-Werror,-Wno-deprecated-declarations
70+ # TODO: #3492
71+ # build --per_file_copt=software/.*,shared/.*,-external/.*@-Wconversion
72+
73+ build --per_file_copt=.*\.pb\.(h|cc|cpp)$@-w
74+ build --per_file_copt=./external/.*,./bazel-out/.*@-w
75+
76+ ############## External Deps Compatibility ##############
77+ build --noincompatible_disallow_ctx_resolve_tools
78+ build --check_direct_dependencies=off
79+
0 commit comments