Bazel Blog

Bazel 4.1

Bazel 4.1 is a minor release as part of Bazel’s first LTS release. It is fully backward compatible with Bazel 4.0 and contains selected changes by the Bazel community and Google engineers.

Apple / Xcode

  • Added support for Apple Silicon. Bazel can now be built natively for Apple Silicon and runs ~2x faster on that platform than the emulated x86_64 version. (#11628, #12900, #12653)
  • Added sanitizer support (asan, tsan and ubsan) to Apple platforms. (#4984, #6932, #12772)
  • Reverted the -fdebug-compilation-dir flag to restore compatibility with Xcode 11.3. (#12905)
  • Improved cquery to allow filtering out incompatible targets. This now makes it possible to express queries like "all targets that are compatible with a certain platform". (#12917)

C++

  • Added support for .S files in C++ Starlark's cc_common.compile. (#13155)

cquery

  • Removed a non-actionable "Targets were missing from graph" warning printed by cquery related to toolchains. (#11993)

Coverage

  • Fixed bazel coverage with C++ to work with Remote Execution. (#13193, #13232)

External dependencies

  • Added SHA-1 to subresource integrity format for download() checksums. (#12777)
  • Fixed --repo_env to avoid triggering unnecessary fetches. (#13126)
  • Fixed --repo_env=VAR to prevent a crash when not specifying a value. (#12886)
  • Added --experimental_repository_disable_download that prevents Bazel from downloading external repositories. This can ensure fully offline builds by overriding all repositories with local_repository / new_local_repository rules or populating a --distdir cache.
  • Fixed an issue where invalid URL rewriter configs would cause Bazel to silently crash. The error is now correctly reported. (#12989)
  • Added support for the all_blocked_message directive in the URL rewriter config. It can be used to print a user-friendly custom error message specific to a project or organization. (#12997)
  • Added support for rewriting the protocol of URLs via the URL rewriter. (#13114)

Java

  • Fixed MANIFEST section handling in ijar. (#12730)
  • Updated Turbine to fix a StackOverflowError in error-prone. (#12926)

Platforms

  • Updated the embedded @platforms repository to bazelbuild/platforms release 0.0.2.. (#11826)
  • Added the @platforms//:incompatible target, which guarantees a target won't build under certain configurations. (#12690)
  • Improved exec groups so that they can inherit from the rule or other exec groups. (#13119)
  • Added support and documentation for execution constraints per exec group. (#13110, #13167)

Persistent Workers

  • Multiplex persistent workers can now use the JSON protocol. Please check the blog post for more information.
  • The worker strategy will no longer support the deprecated automatic fallback to non-sandboxed non-worker execution. Instead, the order of strategies to be tried should be configured via the --strategy= flag. The old behavior is still supported and enabled by default in Bazel 4.x LTS, but a warning message will now be printed. (Context)
  • Various protocol-level, crash, bug and performance fixes.

Remote Execution

  • Updated gRPC to 1.33.1 to fix a corruption issue when downloading CAS blobs. (#12927)
  • Improved error message for failed uploads by printing the digest of the failed blob. (#12507)
  • Made error messages for failed executions much more user-friendly by presenting the information embedded in ExecuteResponses in an easily readable format. (#12564)
  • Fixed the "Must not call uploadBlobs after shutdown" crash when using gRPC Remote Caching and BES. (#12575)
  • Changed Bazel's behavior to no longer set all files as "executable" when using remote execution. Instead, the executable bit is now correctly passed through from the input file. (#12818)
  • Improved the logging of WriteRequests to include offset and finish_write information. Add logging for QueryWriteStatus calls which occur on progressive writes to determine an offset to begin a write call on a retry. (#12928)
  • Fixed an issue where builds using remote execution could hang when the server uses gRPC's GOAWAY feature to implement load shedding. (#12920)
  • Improved performance and interoperability with backends that implement the Remote Execution 2.2 API by setting the platform on the Action message and not just the Command. (#13134)
  • Fixed an issue where dynamic execution could cause CancellationExceptions. (#12972)
  • Improved error messages for BulkTransferExceptions to be much more informative and user-friendly by including the actual reason of the failure. (#13061)
  • Added the --remote_bytestream_uri_prefix flag that allows overriding the hostname and instance name in bytestream:// URIs. (#13085)
  • Improved overall performance and reliability of remote execution by rewriting certain parts with RxJava3.

User Interface

  • Changed the flag --repo_env so that it can now be specified in the common section of a .bazelrc file. (#12689)
  • Added support for multiple --bazelrc flags on the command line. (#12740)
  • Improved shell autocompletion for bazel run. (#11292, #12957)

In addition this release contains a couple of other small interoperability, crash, bug and performance fixes.

This release contains contributions from many people at Google, as well as Alex Eagle, Cristian Hancila, Daniel Wagner-Hall, Denys Kurylenko, Ed Schouten, Finn Ball, George Gensure, Keith Smiley, Lauri Peltonen, Philipp Schrader, Ryan Beasley, Thi Doan, Ulf Adams, Vaidas Pilkauskas, Yannic Bonenberger, Yuval Kaplan, Yi Cheng.