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.

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 .

rule has been removed. Please refer to and rules available in . The objc_bundle_library rule has been removed. Please migrate to rules_apple 's apple_resource_bundle .

rule has been removed. Please migrate to 's . Added --host_swiftcopt for custom flags to pass to swiftc when building tools written in Swift in the host configuration.

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++

Introduced the --host_compiler flag to allow setting a compiler for host compilation when --host_crosstool_top is specified.

flag to allow setting a compiler for host compilation when is specified. Toolchain resolution for cc rules has been enabled via the incompatible flag --incompatible_enable_cc_toolchain_resolution . The legacy flag, --enabledtoolchaintypes, has been deprecated and will be removed.

. The legacy flag, --enabledtoolchaintypes, has been deprecated and will be removed. cc_common.create_cc_toolchain_config_info is now stable and available for production use. See updated cc_toolchain tutorial and the reference

Java

Bazel now verifies that JAVA_HOME points to a valid JDK. Otherwise, it falls back to auto-detection by looking up the path of javac.

points to a valid JDK. Otherwise, it falls back to auto-detection by looking up the path of javac. The --incompatible_use_jdk11_as_host_javabase flag has been added. This flag forces Bazel to use JDK 11 as its default --host_javabase .

flag has been added. This flag forces Bazel to use JDK 11 as its default . The --incompatible_generate_javacommon_source_jar flag has been added. This flag forces java_common.compile to always generate a source .jar file.

flag has been added. This flag forces to always generate a source .jar file. The --incompatible_use_toolchain_providers_in_java_common flag has been added. This flag forces Bazel to pass JavaToolchainInfo and JavaRuntimeInfo providers to java_common APIs instead of configured targets.

flag has been added. This flag forces Bazel to pass JavaToolchainInfo and JavaRuntimeInfo providers to APIs instead of configured targets. An optional output_source_jar parameter has been added to java_common.compile .

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 .

attribute and flags are being renamed. Use and respectively instead. You can preview the removal of the deprecated names with . 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.

command is now available. Chaining of the same function type (inputs, outputs, mnemonic) in aquery is now allowed.

is now allowed. The content of parameter files can now be displayed in aquery output using the --include_param_files flag.

output using the 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.

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.

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).

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.

has been added. When set, the default value of and will not be dependent on the configuration. This means that setting or will not affect the target or host platform. Introduces --local_ram_resources and --local_cpu_resources , which will take the place of --local_resources .

and , which will take the place of . 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/... .

mode, Bazel now correctly returns a non-zero exit code when encountering a package loading error during target pattern parsing of patterns like and . 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.