Bazel Blog

Bazel 5.1

Bazel 5.1 is a minor LTS release. It is fully backward compatible with Bazel 5.0 and contains selected changes by the Bazel community and Google engineers.

General

  • Bazel now finds runfiles in directories that are themselves runfiles. (#14737)
  • Symlinks are no longer resolved for --sandbox_base. (#14748)
  • Flipped --experimental_worker_allow_json_protocol to true. (#14749)
  • Enabled native support for Windows on arm64. (#14794)
  • Added a new subpackages() built-in helper function. (#14780)
  • Fixed an issue where Bazel could erroneously report a test passes in coverage mode without actually running the test. (#14836)
  • Bazel now uses the new Java API ProcessHandle to get the PID. (#14842)

Apple / Xcode

  • Added support for the tvos_sim_arm64 toolchain. (#14779)
  • Fixed ctx.fragments.apple.single_arch_cpu returning incorrect cpu for tools when host cpu and exec cpu are different. (#14751)
  • Fixed the default CPU for macOS and iOS. (#14923)
  • Corrected cpu and os values of some Apple-related local_config_cc_toolchains targets. (#14995)
  • Fixed conflicting actions error when specifying --host_macos_minimum_os. (#15068)
  • osx_cc_wrapper now only expands existing response files. (#15090)

C++

  • Added an experimental version of cc_shared_library. (#14773)
  • Removed uses of --lstdc++ on Darwin (#14750) and BSD (#14860).
  • Added the default solib directory to the rpath for cc_imports with transitions. (#14757)
  • rpath entries are now normalized to guard against missing default solib dir. (#14929)
  • --experimental_cc_implementation_deps now propagates into exec configs. (#14753)

Configurability

  • alias() can now select() directly on constraint_value(). (#14754)
  • Added a helper method use_cpp_toolchain() to depend on the cc toolchain type. (#14795)
  • Label instances are now allowed as keys in select. (#14755)

Coverage

  • Bazel now no longer includes system headers on macOS in coverage reports (#14969).
  • Exposed CoverageOutputGenerator on a Fragment. (#14997)

External Dependencies

  • UrlRewriter can now load credentials from .netrc. (#14834)
  • Added an arch field to repository_os. (#14835)
  • Added support for WORKSPACE.bzlmod. (#14813)
  • Multiple use_extensions are now allowed on the same module extension. (#14945)
  • Added --experimental_repository_cache_urls_as_default_canonical_id to help detect broken repository URLs. (#14989)
  • Added Starlark dependencies to the package //external. (#14991)
  • Added support for decompressing zstd tar archives in repository rules. (#15087)

Java

  • Bazel now ignores a missing include directory in JDK distributions. (#14832)

Protocol Buffers

  • protocOpts() is now publicly accessible. (#14952)

Remote Execution

  • The remote module now only waits for background tasks spawned from remote execution. (#14752)
  • Postponed the block waiting in afterCommand to BlockWaitingModule. (#14833)
  • Bazel now handles early return of compressed blob uploads. (#14885)
  • Changed the default Merkle tree cache size to 1000. (#14984)
  • Actions are no longer considered successful and cached if outputs were not created. (#15071)
  • Fixed certain crashes by InterruptedException when dynamic execution is enabled. (#15091)

Starlark

  • Added new removeprefix/removesuffix methods to strings. (#14899)

Acknowledgments

This release contains contributions from many people at Google, as well as Andreas Herrmann, Ben Lee, Benjamin Peterson, Brentley Jones, Dan Fleming, Denis Kurylenko, Fabian Meumertzheim, Keith Smiley, Ken Micklas, Mostyn Bramley-Moore, Niyas Sait, Oscar Bonilla, Son Luong Ngoc, Thi Doãn, Yannic, Yuval K, Zhongpeng Lin.