Skip to content

Andrewyx/Upgrade Bazel 8 - #3459

Merged
Andrewyx merged 91 commits into
UBC-Thunderbots:masterfrom
Andrewyx:Andrewyx/Upgrade_bazel_8
Sep 16, 2025
Merged

Andrewyx/Upgrade Bazel 8#3459
Andrewyx merged 91 commits into
UBC-Thunderbots:masterfrom
Andrewyx:Andrewyx/Upgrade_bazel_8

Conversation

@Andrewyx

@Andrewyx Andrewyx commented May 23, 2025

Copy link
Copy Markdown
Contributor

Please fill out the following before requesting review on this PR

Description

This PR contains the initial migration work for moving our code base from Bazel 5.4.0 -> Bazel 8.

Prominent components which have been changed involve the following:

  • Ports WORKSPACE to MODULE system
  • Upgrades nanopb to 0.4.9.1 via the Bazel Central Registry (BCR)
  • Upgrades protobuf to 6.31.1 via BCR
  • Upgrades platformio_rules to most recent version
  • Redesigns nanopb.bzl rule

Refactor/Chores Made:

  • New starlark directory for custom rules or macros
  • Toolchains moved to toolchains dir
  • Cleans up & adds optimizations in .bazelrc to speed up compile times
  • Reworks external bazel module usage to optimize build caching -> 35% compile speed improvement

Infrastructure Changes:

  • setup_software.sh uses Bazelisk to manage bazel versions now automatically
  • setup_software.sh pulls protoc, the proto compiler, via python now from the grpcio-tools pip package
  • setup_software.sh now also sets up python dev headers for aarch64 hosts (for the sack of bazel hermeticity)

Unblocks:

Testing Done

Resolved Issues

Resolves #2592, #3382, #3483

Length Justification and Key Files to Review

Review Checklist

It is the reviewers responsibility to also make sure every item here has been covered

  • Function & Class comments: All function definitions (usually in the .h file) should have a javadoc style comment at the start of them. For examples, see the functions defined in thunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.
  • Remove all commented out code
  • Remove extra print statements: for example, those just used for testing
  • Resolve all TODO's: All TODO (or similar) statements should either be completed or associated with a github issue

Notes:

https://groups.google.com/g/bazel-discuss/c/3Q_GEqNZrC0
https://bazel.build/extending/toolchains
https://blog.bazel.build/2017/02/27/protocol-buffers.html#implicit-dependencies-and-proto-toolchains

Comment thread src/.bazelrc Outdated
Comment thread src/.bazelrc Outdated
Comment thread src/.bazelrc Outdated
Comment thread src/MODULE.bazel
Comment thread src/MODULE.bazel Outdated
Comment thread src/MODULE.bazel Outdated
Comment thread src/MODULE.bazel Outdated
Comment thread src/MODULE.bazel
Comment thread src/software/embedded/services/motor.cpp Outdated
Comment thread src/toolchains/python/BUILD Outdated
Comment thread src/toolchains/cc/wrapper/k8_jetson_nano_cross_compile_ar

@itsarune itsarune left a comment

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.

Nice work! Left some more comments

@williamckha williamckha linked an issue Aug 30, 2025 that may be closed by this pull request
1 task
@Andrewyx Andrewyx mentioned this pull request Sep 16, 2025
2 tasks

@williamckha williamckha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@itsarune I talked with Andrew and the remaining issues can be worked on after merging this PR in. The commented out copts for treating warnings as errors are especially tricky to fix right now, since Bazel does not have good support for suppressing warnings from external header-only libraries (this poorly documented external_include_paths feature is supposed to do the trick, but we can't figure out how to mark external dependencies). I'm not sure why we aren't getting these warnings from external deps on master, maybe because we upgraded them?

Ideally I would like to get this PR merged by this weekend since we will be onboarding new members.

@Lmh-java Lmh-java left a comment

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.

Let's goooo 🔥

@Andrewyx
Andrewyx merged commit 961e621 into UBC-Thunderbots:master Sep 16, 2025
6 of 7 checks passed
@Andrewyx Andrewyx mentioned this pull request Sep 18, 2025
4 tasks
@nycrat nycrat mentioned this pull request Dec 8, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bazel 7 Upgrade Checklist Upgrade nanopb to 4.5.0 (Or Latest)

5 participants