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.
Before updating to Bazel 0.23, first check if your codebase is compatible either
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.
--incompatible_disallow_struct_provider_syntaxflag 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:
android_local_test, you can now use the
aapt_versionattribute or the
--android_aaptflag to pick the aapt version.
Apple / iOS
objc_frameworkrule has been removed. Please refer to
apple_static_framework_importrules available in
objc_bundle_libraryrule has been removed. Please migrate to
--host_swiftcoptfor custom flags to pass to swiftc when building tools written in Swift in the host configuration.
- Changed the default
apple_platform_typevalue from iOS to macOS. You no longer need to pass
--apple_platform_type=macoswhen building targets on macOS that previously required it.
- Introduced the
--host_compilerflag to allow setting a compiler for host compilation when
- 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.
cc_common.create_cc_toolchain_config_infois now stable and available for production use. See updated
cc_toolchain tutorialand the reference
- Bazel now verifies that
JAVA_HOMEpoints to a valid JDK. Otherwise, it falls back to auto-detection by looking up the path of javac.
--incompatible_use_jdk11_as_host_javabaseflag has been added. This flag forces Bazel to use JDK 11 as its default
--incompatible_generate_javacommon_source_jarflag has been added. This flag forces
java_common.compileto always generate a source .jar file.
--incompatible_use_toolchain_providers_in_java_commonflag has been added. This flag forces Bazel to pass JavaToolchainInfo and JavaRuntimeInfo providers to
java_commonAPIs instead of configured targets.
- An optional
output_source_jarparameter has been added to
- 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
--force_pythonflags are being renamed. Use
--python_versionrespectively instead. You can preview the removal of the deprecated names with
--python_versionflag will soon no longer override the declared version of a
py_testtarget. This allows Python 3 binaries to have data dependencies on Python 2 binaries and vice versa. You can preview this new behavior with
- Documentation for the
aquerycommand is now available.
- Chaining of the same
function type (inputs, outputs, mnemonic) in
aqueryis now allowed.
- The content of parameter files can now be displayed in
aqueryoutput using the
aquerytext output now highlights if an artifact is a TreeArtifact.
Caching & Execution
- Locally-executed spawns tagged
no-cacheno 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_timeoutwould be interpreted as milliseconds instead of seconds.
- The incompatible flag
--incompatible_strict_action_envhas 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_heuristichas been removed.
- 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_platformhas been added. When set, the default value of
--platformswill not be dependent on the configuration. This means that setting
--host_cpuwill not affect the target or host platform.
--local_cpu_resources, which will take the place of
--keep_goingmode, Bazel now correctly returns a non-zero exit code when encountering a package loading error during target pattern parsing of patterns like
- 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.xmlgeneration more reliable overall.
- Square published
bazel_maven_repository, a Bazel ruleset creating a more idiomatic Bazel representation of a maven repo using a pinned list of artifacts.
- Travis Cline created
rules_homebrew, to manage brew packages.
- Wix engineer Natan Silnitsky wrote about their experience: Migrating to Bazel from Maven or Gradle? 5 crucial questions you should ask yourself.
- Rahul Malik, iOS Platform Tech Lead, wrote about developing fast & reliable iOS builds at Pinterest (Part one).
- Christian Gruber wrote a blog post: Bazely thinking and the tale of the content-addressable cache.
- Rosen Vladimirov published an article about Building NativeScript Apps with Google's Bazel.
- Bazelisk, a wrapper for Bazel, has
been improved. It can be used to try your code with a specific version of
Bazel, or to ensure your code is forward compatible (see the
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.