Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/actions/environment-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ runs:
shell: bash
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like protobuf now depends on rules_android, which needs the Android SDK

sudo rm -rf /opt/ghc

- name: Run setup_software.sh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ jobs:
# //software/gameplay_tests/... \
run: |
cd src
bazel test //software/gameplay_tests:requirements_test
bazel test //software/gameplay_tests:requirements.test
bazel test --copt=-O3 --flaky_test_attempts=3 --show_timestamps \
--test_arg="--ci_mode" \
-- //software:unix_full_system \
-//software/gameplay_tests:requirements_test \
-//software/gameplay_tests:requirements.test \
//software/ai/hl/... \
//software/ai/navigator/...

Expand Down
6 changes: 4 additions & 2 deletions src/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ common --features=external_include_paths
# See https://docs.bazel.build/versions/master/remote-caching.html#disk-cache
build --disk_cache=~/.cache/thunderbots_bazel_disk_cache

build --experimental_remote_merkle_tree_cache # partial repo caching optimization

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that this option is no longer supported

common --incompatible_enable_proto_toolchain_resolution # protoc caching
common --@protobuf//bazel/toolchains:prefer_prebuilt_protoc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that the prebuilt binaries will actually work in the nanopb pipeline for compiling the onboard protobufs. This will need to be tested with a real robot to verify, but for some context, this feature is simply the now upstream variant of the alex eagle toolchains protobuf repo. During the Bazel 8 migration, I had attempted to use this optimization (622a89a), but to no avail.

Here is the thread I inquired upon the issue with, but to no response aspect-archives/toolchains_protoc#21

I can't quite recall what exactly didn't work, so it is probably a good idea to test on-robot.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I've got the nanopb pipeline using prebuilt protoc now. bazel cquery deps(//proto:tbots_nanopb_proto) shows the prebuilt binary (@@protobuf++protoc+prebuilt_protoc.linux_x86_64//:bin/protoc) in the build graph instead of @protobuf//:protoc which builds from source.

common --incompatible_default_to_explicit_init_py

# Ensure that we don't accidentally build gRPC
common --per_file_copt=external/.*grpc.*@--GRPC_WAS_NOT_SUPPOSED_TO_BE_BUILT
Expand All @@ -54,6 +55,7 @@ common --host_per_file_copt=external/.*grpc.*@--GRPC_WAS_NOT_SUPPOSED_TO_BE_BUIL
################# Build Configurations #################
# Lock C++ version
build --cxxopt="-std=c++2a"

# Warn variable length arrays only when compiling cpp
build --per_file_copt=.*\.cpp@-Wvla

Expand All @@ -69,7 +71,7 @@ build --incompatible_remove_legacy_whole_archive=False

# Escalate Warnings to fail Compile for Thunderbots code
build --features=external_include_paths
build:linux --per_file_copt=proto/.*,proto/message_translation/.*,proto/primitive/.*,software/.*,shared/.*,-external/.*@-Wall,-Wextra,-Wno-unused-parameter,-Wno-deprecated,-Werror,-Wno-deprecated-declarations
build:linux --per_file_copt=proto/.*,proto/message_translation/.*,proto/primitive/.*,software/.*,shared/.*,-external/.*@-Wall,-Wextra,-Wno-unused-parameter,-Wno-deprecated,-Wno-sign-compare,-Werror,-Wno-deprecated-declarations,-Wno-unused-result,-Wno-missing-field-initializers
# TODO: #3492
# build --per_file_copt=software/.*,shared/.*,-external/.*@-Wconversion

Expand Down
2 changes: 1 addition & 1 deletion src/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.2.1
9.1.1
1 change: 0 additions & 1 deletion src/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
load("@rules_python//python:defs.bzl", "py_runtime", "py_runtime_pair")

# Generates compile_commands.json
refresh_compile_commands(
Expand Down
73 changes: 60 additions & 13 deletions src/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ module(
##############################################################
# Import Dependencies available in the Bazel Central Registry
##############################################################
bazel_dep(name = "googletest", version = "1.15.2")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "pybind11_bazel", version = "2.13.6")
bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "googletest", version = "1.16.0.bcr.2")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "pybind11_bazel", version = "3.0.1")
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "rules_cc", version = "0.2.19")
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "rules_pkg", version = "1.1.0")
bazel_dep(name = "rules_foreign_cc", version = "0.14.0")
bazel_dep(name = "rules_python", version = "1.4.1")
bazel_dep(name = "eigen", version = "3.4.0.bcr.3")
bazel_dep(name = "zlib", version = "1.3.1.bcr.6")
bazel_dep(name = "nanopb", version = "0.4.9.1.bcr.2")
bazel_dep(name = "protobuf", version = "31.1")
bazel_dep(name = "rules_python", version = "2.2.0")
bazel_dep(name = "eigen", version = "5.0.1.bcr.2")
bazel_dep(name = "zlib", version = "1.3.1.bcr.7")
bazel_dep(name = "nanopb", version = "0.4.9.1.bcr.3")
bazel_dep(name = "protobuf", version = "35.1")
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "yaml-cpp", version = "0.8.0")
bazel_dep(name = "buildifier_prebuilt", version = "8.0.3")
Expand Down Expand Up @@ -47,6 +49,10 @@ pip.parse(
python_interpreter = "/opt/tbotspython/bin/python",
python_version = "3.12",
requirements_lock = "//software/embedded/ansible:requirements_lock.txt",
target_platforms = [
"linux_x86_64",
"linux_aarch64",
],
)
use_repo(pip, "ansible_deps")
pip.parse(
Expand All @@ -61,6 +67,10 @@ pip.parse(
python_interpreter = "/opt/tbotspython/bin/python",
python_version = "3.12",
requirements_lock = "//software/embedded/robot_diagnostics_cli:requirements_lock.txt",
target_platforms = [
"linux_x86_64",
"linux_aarch64",
],
)
use_repo(pip, "robot_diagnostics_cli_deps")
pip.parse(
Expand Down Expand Up @@ -125,10 +135,9 @@ http_archive(
bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost")
archive_override(
module_name = "rules_boost",
# Made with: shasum -a 256 rules_boost-2a003f812e9a13b970e4100d96856b09ee13a582.tar.gz
sha256 = "f3125bbcb4adb5863980562d6092f2c07571cc9b2d4510e3b7f829fd43b44607",
strip_prefix = "rules_boost-2a003f812e9a13b970e4100d96856b09ee13a582",
url = "https://github.com/nelhage/rules_boost/archive/2a003f812e9a13b970e4100d96856b09ee13a582.tar.gz",
sha256 = "722178ab4687ebf48c66229a0fe774759bd836257bcede2ed972b0e32ce92c33",
strip_prefix = "rules_boost-2811ec9f1e42f784439a7bbecf68b1c8b5f8b0ae",
url = "https://github.com/nelhage/rules_boost/archive/2811ec9f1e42f784439a7bbecf68b1c8b5f8b0ae.tar.gz",
)

non_module_boost_repositories = use_extension("@com_github_nelhage_rules_boost//:boost/repositories.bzl", "non_module_dependencies")
Expand All @@ -141,6 +150,11 @@ use_repo(
bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
archive_override(
module_name = "hedron_compile_commands",
patches = [
"//starlark/patches/hedron_compile_commands:add_rules_python_dep.patch",
"//starlark/patches/hedron_compile_commands:fix_py_binary.patch",
"//starlark/patches/hedron_compile_commands:fix_cc_binary.patch",
],
sha256 = "ba3feefdf57b6d4c749e3c4abfa86f3673e7db364cb13acfc3496dce6ea801a3",
strip_prefix = "bazel-compile-commands-extractor-f5fbd4cee671d8d908f37c83abaf70fba5928fc7",
url = "https://github.com/mikael-s-persson/bazel-compile-commands-extractor/archive/f5fbd4cee671d8d908f37c83abaf70fba5928fc7.tar.gz",
Expand All @@ -149,6 +163,7 @@ archive_override(
bazel_dep(name = "platformio_rules", repo_name = "platformio_rules")
archive_override(
module_name = "platformio_rules",
patches = ["//starlark/patches/platformio_rules:add_py_binary_load.patch"],
sha256 = "a80357230e27b8b57b8deffaa82684d3ee88b2284e4a767a9d8a692e9034e125",
strip_prefix = "platformio_rules-3cd18c7c7bb2482fe3cbb58898245dd675421234",
url = "https://github.com/mum4k/platformio_rules/archive/3cd18c7c7bb2482fe3cbb58898245dd675421234.tar.gz",
Expand Down Expand Up @@ -314,3 +329,35 @@ new_local_repository(
##############################################
# Workarounds and Fixes Below (hacks)
##############################################

# Bazel 9 compatibility: register rules_cc compatibility proxy for
# transitive dependencies that haven't been updated.
cc_compat = use_extension("@rules_cc//cc:extensions.bzl", "compatibility_proxy")
use_repo(cc_compat, "cc_compatibility_proxy")

# googletest 1.16.0.bcr.2 needs compat proxy registration for Bazel 9.
single_version_override(
module_name = "googletest",
patches = ["//starlark/patches/googletest:add_compat_proxy.patch"],
version = "1.16.0.bcr.2",
)

# pybind11_protobuf needs Bazel 9 compat and protobuf 35 API fixes.
single_version_override(
module_name = "pybind11_protobuf",
patches = [
"//starlark/patches/pybind11_protobuf:add_compat_proxy.patch",
"//starlark/patches/pybind11_protobuf:protobuf35_compat.patch",
],
)

# nanopb's protoc-gen-nanopb plugin picks up the system python-protobuf
# instead of the Bazel-managed one. The patch reorders sys.path so the
# Bazel-managed protobuf is found first.
single_version_override(
module_name = "nanopb",
patches = [
"//starlark/patches/nanopb:bazel_protobuf_path.patch",
],
version = "0.4.9.1.bcr.3",
)
Loading
Loading