Bazel Blog

Bazel 4.2

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

Starlark

  • required_providers is now exposed to Starlark Defined Aspects (as part of work towards #11736).

Configurability

  • The "unknown key" error for .bazelrc with Starlark flags has been fixed. (#11301)
  • The cquery command now inherits from bazel test, not bazel build. (#13428)
  • The test exec group now inherits properties from the default exec group. (#13459)
  • The config_setting visibility enforcement has been enabled with the --incompatible_enforce_config_setting_visibility flag. (#12932)
  • The exit code is used to signal when errors are reported on invalid aquery --output (#13660).
  • label_flag and label_setting now do not depend on the default value. (#11291)

Apple

  • The basic Unix toolchain now works on Apple Silicon without Xcode installed. (#13514)
  • macOS loadable bundles no longer strip all symbols. (#11869)
  • DEFAULT_MACOS_CPU has been updated to match the host. (#12671)

CC

  • Bazel can now be built on Linux systems which use a minimal C standard library. (#12460)

Android

  • aar_import now exports proguard specs. (#3778)
  • Android rules now use version 0.23.0 of Bazel Android tools.
  • The minimum version of the Android SDK build tools is now 30.0.0.
  • .aar files can now be extracted. (#13092)
  • tools/android no longer depends on the presence of Python 2. (#10127)

Java

  • The Java Allocation Instrumenter library was updated to fix issues with JDK11+. (#13726)
  • Java now has coverage for external files. (#13376)

Python

  • stub_shebang has been added to py_runtime. (#8685)

Windows

  • The threshold for long path shortening is now MAX_PATH - 4. (#12310)
  • Symlink creation on older Windows versions has been fixed. (#13169)
  • Windows developer mode symlinks have been fixed. (#13169)

Actions and Execution

  • Empty virtual actions no longer crash. (#12816)
  • A race condition that occurred when reporting action progresses is now fixed. (#13713)
  • DynamicSpawnStrategy crashes have been fixed. (#13149)
  • Interrupted status messages are not suppressed during pool closure. (#13512)

Workers

  • A bug in WorkRequestHandler that caused hanging workers has been fixed.
  • Workers now restart on flags that affect their creation/behaviour.
  • The default worker JSON protocol handler not allowing unknown fields, and a crash bug have been fixed. (#13240)
  • Workers can now finish lost races without delaying dynamic execution.

Remote execution

  • Bug fixes
    • Remote strategy is not registered if remote execution is not available. (#13340, #13487)
    • The progress bar shows "Scheduling" state while the action is actually hitting the remote cache and downloading outputs. (#13531)
    • Bazel may have crashed with "Too many open files" when writing to local disk cache. (#13435)
    • The XML generation spawn is executed even if test.xml is already generated when built with --remote_download_minimal. (#12554)
  • Improvements
    • The remoteCacheable key has been added to the execution log.
    • An --experimental_capture_corrupted_outputs flag has been added.
    • The progress bar now displays download progress when remote execution is enabled.
    • The remote cache no longer uploads empty output.

This release contains contributions from many people at Google, as well as Benjamin Peterson, bromano, Christopher Sauer, Daniel Wagner-Hall, George Gensure, Johannes Abt, Keith Smiley, Kevin Hogeland, Ryan Beasley, ThomasCJY, Trustin Lee, Ulf Adams, Vertexwahn, and Yuval Kaplan.