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_protocolto 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
ProcessHandleto get the PID. (#14842)
Apple / Xcode
- Added support for the
tvos_sim_arm64toolchain. (#14779) - Fixed
ctx.fragments.apple.single_arch_cpureturning incorrect cpu for tools when host cpu and exec cpu are different. (#14751) - Fixed the default CPU for macOS and iOS. (#14923)
- Corrected
cpuandosvalues of some Apple-relatedlocal_config_cc_toolchainstargets. (#14995) - Fixed conflicting actions error when specifying
--host_macos_minimum_os. (#15068) osx_cc_wrappernow 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
solibdirectory to therpathforcc_imports with transitions. (#14757) rpathentries are now normalized to guard against missing defaultsolibdir. (#14929)--experimental_cc_implementation_depsnow propagates into exec configs. (#14753)
Configurability
alias()can nowselect()directly onconstraint_value(). (#14754)- Added a helper method
use_cpp_toolchain()to depend on the cc toolchain type. (#14795) Labelinstances are now allowed as keys inselect. (#14755)
Coverage
- Bazel now no longer includes system headers on macOS in coverage reports (#14969).
- Exposed
CoverageOutputGeneratoron a Fragment. (#14997)
External Dependencies
UrlRewritercan now load credentials from.netrc. (#14834)- Added an
archfield torepository_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_idto 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
includedirectory 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
afterCommandtoBlockWaitingModule. (#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/removesuffixmethods 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.