Bazel Blog

Bazel 0.23

Bazel 0.23.0 has arrived with an exciting mix of new features, important bug fixes, and updated documentation.

This version of Bazel has been regression-tested against 51 open-source projects, including Gerrit, Protocol Buffers, TensorFlow and the full suite of rules hosted in bazelbuild's GitHub organization. This makes it our most comprehensively tested release yet. Want to get your open-source project on Bazel's CI to ensure that we catch any regressions or have suggestions what we should test against? File a GitHub issue.

Incompatible changes

Before updating to Bazel 0.23, first check if your codebase is compatible either by running bazelisk --migrate or by building your code with Bazel 0.22 and the following flags:

For more information about the changes, please click on the links and read the GitHub issues. Comment there if you need help.

If you use external repositories, you might first have to update the dependencies in your WORKSPACE file.

Starlark

  • The --incompatible_disallow_struct_provider_syntax flag has been added. This flag removes the ability for rule implementation functions to return a struct. Such functions should return a list of providers instead. See the documentation about Migrating from Legacy Providers.
  • Some old flags have been removed: --incompatible_range_type, --incompatible_disallow_slash_operator, --incompatible_disallow_conflicting_providers.

Android

  • For android_local_test, you can now use the aapt_version attribute or the --android_aapt flag to pick the aapt version.

Apple / iOS

  • The objc_framework rule has been removed. Please refer to apple_dynamic_framework_import and apple_static_framework_import rules available in rules_apple.
  • The objc_bundle_library rule has been removed. Please migrate to rules_apple's apple_resource_bundle.
  • Added --host_swiftcopt for custom flags to pass to swiftc when building tools written in Swift in the host configuration.
  • Changed the default apple_platform_type value from iOS to macOS. You no longer need to pass --apple_platform_type=macos when building targets on macOS that previously required it.

C++

Java

Python

  • Python rules now accept and return a PyInfo provider in addition to the legacy "py" struct provider, which is being deprecated. You can preview the deprecation by enabling --incompatibledisallowlegacypyprovider
  • The default_python_version attribute and --force_python flags are being renamed. Use python_version and --python_version respectively instead. You can preview the removal of the deprecated names with --incompatible_remove_old_python_version_api.
  • The --python_version flag will soon no longer override the declared version of a py_binary or py_test target. This allows Python 3 binaries to have data dependencies on Python 2 binaries and vice versa. You can preview this new behavior with --incompatible_allow_python_version_transitions.

aquery

  • Documentation for the aquery command is now available.
  • Chaining of the same function type (inputs, outputs, mnemonic) in aquery is now allowed.
  • The content of parameter files can now be displayed in aquery output using the --include_param_files flag.
  • aquery text output now highlights if an artifact is a TreeArtifact.

Caching & Execution

  • Locally-executed spawns tagged no-cache no longer upload their outputs to the remote cache.
  • Bazel now supports reading cache hits from a repository cache, even if it doesn't have write access to the cache.
  • Fixed a longstanding bug in the HTTP remote cache where the value passed to --remote_timeout would be interpreted as milliseconds instead of seconds.
  • The incompatible flag --incompatible_strict_action_env has been flipped to "false" again, as we discovered breakages for local execution users. We'll need some more time to figure out the best way to make this work for local and remote execution (#7026).
  • The flag value --test_sharding_strategy=experimental_heuristic has been removed.

Other changes

  • Bazel binary is 20MB smaller by using a minimized embedded JDK.
  • The embedded JDK version is upgraded to 11.0.2.
  • Incompatible flag --incompatible_auto_configure_host_platform has been added. When set, the default value of --host_platform and --platforms will not be dependent on the configuration. This means that setting --cpu or --host_cpu will not affect the target or host platform.
  • Introduces --local_ram_resources and --local_cpu_resources, which will take the place of --local_resources.
  • In --keep_going mode, Bazel now correctly returns a non-zero exit code when encountering a package loading error during target pattern parsing of patterns like //foo:all and //foo/....
  • For tests that do not generate a test.xml, Bazel now uses a separate action to generate one; this results in minor differences in the generated test.xml, and makes the test.xml generation more reliable overall.

Community

Contributors

This release contains contributions from many people at Google, as well as Benjamin Peterson, Ed Schouten, erenon, George Gensure, Igal Tabachnik, Ittai Zeidman, Jannis Andrija Schnitzer, John Millikin, Keith Smiley, Kelly Campbell, Max Vorobev, nicolov, and Robin Nabel.