Bazel 6.3: A Major Release with New Features and Improvements

Posted on in programming

cover image for article

Bazel 6.3 was released on July 28, 2023. It includes a number of new features and improvements, making it a major release for the popular build tool.

Here are some of the highlights of Bazel 6.3:

  • Bzlmod lockfile support: Bazel now supports a lockfile for Bzlmod, which can be used to track the dependencies of your project. This can help to ensure that your builds are reproducible and that you don't accidentally introduce breaking changes.
  • Module extensions can now return a metadata object: Module extensions can now return a metadata object that contains information about the module, such as its version and its dependencies. This information can be used by Bazel to improve the performance of builds.
  • Module dependencies can now specify a max_compatibility_level: Module dependencies can now specify a max_compatibility_level, which allows you to control how much of a change you are willing to accept from a dependency. This can help to prevent breaking changes from affecting your project.
  • The native object has gained several new methods: The native object has gained several new methods that can be used to work with Bzlmod builds. These methods can be used to get information about the module system, such as the current module path and the list of loaded modules.
  • Overrides in non-root modules no longer cause an error: Overrides in non-root modules no longer cause an error. This means that you can now override rules in other modules without having to worry about breaking the build.
  • Bazel no longer appears to hang at the "Info: Invocation ID" message while fetching external dependencies: Bazel no longer appears to hang at the "Info: Invocation ID" message while fetching external dependencies. This can improve the performance of builds that depend on external dependencies.

In addition to these new features, Bazel 6.3 also includes a number of bug fixes and performance improvements. Overall, it is a significant release that makes Bazel a more powerful and versatile build tool.

Here are some additional details about the new features and improvements in Bazel 6.3:

  • Bzlmod lockfile support: The Bzlmod lockfile is a file that contains a list of the modules that are required to build your project. This file can be used to ensure that your builds are reproducible and that you don't accidentally introduce breaking changes.
  • Module extensions can now return a metadata object: Module extensions are functions that can be used to add custom functionality to modules. In Bazel 6. 3, module extensions can now return a metadata object that contains information about the module, such as its version and its dependencies. This information can be used by Bazel to improve the performance of builds.
  • Module dependencies can now specify a max_compatibility_level: Module dependencies can now specify a max_compatibility_level, which allows you to control how much of a change you are willing to accept from a dependency. This can help to prevent breaking changes from affecting your project.
  • The native object has gained several new methods: The native object is a powerful tool that can be used to interact with the Bazel build system. In Bazel 6.3, the native object has gained several new methods that can be used to work with Bzlmod builds. These methods can be used to get information about the module system, such as the current module path and the list of loaded modules.
  • Overrides in non-root modules no longer cause an error: In previous versions of Bazel, overrides in non-root modules would cause an error. This was because Bazel didn't have a way to track the dependencies of non-root modules. In Bazel 6.3, this problem has been fixed, so you can now override rules in non-root modules without having to worry about breaking the build.
  • Bazel no longer appears to hang at the "Info: Invocation ID" message while fetching external dependencies: In previous versions of Bazel, Bazel would sometimes appear to hang at the "Info: Invocation ID" message while fetching external dependencies. This was because Bazel was waiting for the remote server to respond. In Bazel 6.3, this problem has been fixed, so Bazel will no longer appear to hang while fetching external dependencies.

I hope this blog post has given you a good overview of the new features and improvements in Bazel 6.3. If you are using Bazel, I recommend upgrading to 6.3. It is a major release that includes a number of important features and improvements.

Thank you for reading!

My Bookshelf

Reading Now

Other Stuff