Bazel 0.24.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 over 50 open-source projects. 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? Reach out to bazel-dev@googlegroups.com and we can set you up!
Incompatible changes
The following incompatible flags are now enabled by default, and will be removed in a near-term release. Before updating to Bazel 0.24, you may first check if your codebase is compatible either by running bazelisk --migrate or by building your code with Bazel
0.23 and the following flags:
--incompatible_disable_runtimes_filegroups--incompatible_linkopts_in_user_link_flags--incompatible_dont_emit_static_libgcc--incompatible_disallow_filetype--incompatible_disallow_dict_plus--incompatible_disallow_old_style_args_add--incompatible_java_coverage
The following new incompatible flags have been added in this release. Projects are expected to begin migration:
--incompatible_list_based_execution_strategy_selection: Migration to a new style of specifying execution strategy selection and fallback behavior.--incompatible_windows_style_arg_escaping: Enables correct subprocess argument escaping on Windows. (No-op on other platforms.)--incompatible_windows_escape_jvm_flags: Enables correctjava_binary.jvm_flagsandjava_test.jvm_flagstokenization and escaping on Windows. (No-op on other platforms.)--incompatible_disable_objc_library_resources: Disables resource attributes inobjc_library. Please migrate these attributes todatainstead.--incompatible_disallow_native_in_build_file: Enable migration while removing the use of thenativemodule in BUILD files.--incompatible_use_toolchain_providers_in_java_common: Causejava_commonAPIs to requireJavaToolchainInfoandJavaRuntimeInfoproviders instead of configured targets.--incompatible_py3_is_default: Makes targets build for Python 3 unless otherwise specified.--incompatible_py2_outputs_are_suffixed: Makes Python 3 targets’ outputs appear under thebazel-bindirectory, and Python 2 targets’ outputs appear elsewhere.
Starlark
- The
actions.args()object is now chainable. Its methods now return the object itself. - Rules can now safely declare attributes named "licenses".
C++
- The
is_using_fissioncrosstool variable is now exposed in all compile actions when fission is active (it used to be exposed only for linking actions). --incompatible_disable_legacy_crosstool_fieldswill be flipped on the next release. It removes legacy fields from CROSSTOOL files. This flag was around for a few releases, and in 0.24 all the known corner cases have been fixed.--incompatible_disable_crosstool_filewill be flipped on the next release. It disables loading data from CROSSTOOL files, and only uses Starlark to configure C++ toolchains.--incompatible_remove_cpu_and_compiler_attributes_from_cc_toolchainwill be flipped on the next release. These attributes are unused, but cpu attribute was mandatory. This change removes them.--incompatible_dont_enable_host_nonhost_crosstool_featureswill be flipped on the next release. With it flipped, "host" and "nonhost" crosstool features are never automatically enabled by Bazel.
Android
- Added support for the "navigation" resource directory to Android resource processing in Bazel. This is used by the Navigation Architecture Component.
- Fixed issue where exceptions and stacktraces were silently swallowed in the Android resource processing pipeline. See #7442.
Apple
- Added bitcode support for Apple platforms
- Added support for differentiating between Xcode betas
Python
- Two new incompatible flags have been added to enable switching the default Python version to PY3: one to make targets build for PY3 when not otherwise indicated, and one to help ensure that the outputs of these targets are reachable from the
bazel-bindirectory. It is recommended to enable both flags together. (But note that until #4815 is fixed, a workaround is needed to make Python targets launch with the correct version of the interpreter.) - It is now possible to write Starlark rules that depend on or imitate
py_runtime, by using the newPyRuntimeInfoprovider. - The
py_runtimerule’sfilesattribute is no longer mandatory. It also gains apython_versionattribute for specifying whether it represents a Python 2 or 3 interpreter. This new attribute will become mandatory once Python rules are updated to use the toolchain mechanism.
Other changes
- We significantly reduced Bazel’s binary size, it’s now ~95MB on all platforms. We plan to reduce it even further in future releases.
- The
//tools/cmd_line_differscript has been renamed to//tools/aquery_differ. The script can now compare, in addition to command lines, inputs of actions given two aquery results. - aquery can now query against the current state of Skyframe with
--skyframe_state. - When using the flag
--incompatible_list_based_execution_strategy_selection, Bazel now uses remote execution by default if you specify--remote_executor. Otherwise, it falls back to either persistent workers, sandboxed local execution, or and at last unsandboxed local execution, assuming the action/platform support those. The flags--spawn_strategyand--strategycontinue to work as before; this only sets new defaults for the case where you don't specify these flags.
Community Updates
- Ray Milkey (Member of Technical Staff, Open Networking Foundation) gave a talk to ONF Connect about Using Bazel to Improve Build Stability.
- Li Haoyi and Ahir Reddy wrote about Speedy Scala Builds with Bazel at Databricks.
- Natan Silnitsky (Wix Engineering) wrote a second blog post on Migrating to Bazel from Maven or Gradle.
- Torgeir Helgevold (Narwhal Technologies, Inc) wrote about how to Dockerize Apps with Jenkins and Bazel.
Contributors
This release contains contributions from many people at Google, as well as Andrew Suffield, Brandon Lico, Chris Eason, Clint Harrison, Ed Schouten, Garrett Hopper, George Gensure, John Millikin, Keith Smiley, Ryan Beasley, Shmuel H, Travis Cline, and Vladimir Chebotarev.