Bazel Blog

Bazel 0.16

The Bazel team is happy to announce a new version of Bazel, Bazel 0.16!

We've updated our design process. All design documents are now published on a separate GitHub repository. They are explicitly approved via GitHub pull requests, so that you can easily track new proposals and status changes.

Here are the main changes of Bazel 0.16:

General changes

  • Bazel now allows @ in package names. For example, node_modules/@namespace_foo/lib_bar (which is a common pattern for NPM) is now an allowed package name.
  • The --distdir option is no longer experimental. This option allows to specify additional directories to look for files before trying to fetch them from the network. Files from any of the distdirs are only used if a checksum for the file is specified, and both the filename and the checksum match.
  • --noexpand_configs_in_place is now deprecated, after a transition period to inplace-expansion, see https://blog.bazel.build/2018/01/19/config-parsing-order.html for details
  • We now ship a Bazel execution log parser tool. When Bazel runs, it can optionally generate an execution log containing detailed information about every run action: the inputs, outputs, command line, execution strategy, etc. This information can be useful in debugging issues such as "Why do my builds fail remotely but not locally?" or "Why am I not getting as many cache hits as I expected?" Instructions on how to build/use the tool are on GitHub.
  • We have removed support for --discard_actions_after_execution, a feature for discarding actions during the execution phase. This saves a tiny amount of memory, but comes at a complexity cost. This feature has been removed because it does not provide a good tradeoff.
  • We have added the --materialize_param_files flag to write parameter files even when actions are executed remotely.
  • --[no]allow_undefined_configs no longer exists, passing undefined configs will result in an error.
  • We have added the attribute repo_mapping for repository rules that enables dependencies to be shadowed. Use --experimental_enable_repo_mapping to try it out. More details here
  • The embedded JDK has been upgraded to JDK 9, and is now used as both the default startup --host_javabase and build --host_javabase.

Android

  • The $(ANDROID_CPU) Make variable is no longer available. Use $(TARGET_CPU) after an Android configuration transition instead.
  • android_local_test now takes advantage of Robolectric's binary resource processing, allowing for faster tests.
  • The mobile-install --skylark_incremental_res flag is no longer available. Use the --skylark flag instead.
  • We have added new rules for importing Android dependencies: aar_import_external and aar_maven_import_external.
    • aar_import_external enables specifying external AAR dependencies using a list of HTTP URLs for the artifact.
    • aar_maven_import_external enables specifying external AAR dependencies using the artifact coordinate and a list of server URLs.
    • To use these rules, add the following load statement: load("@bazel_tools//tools/build_defs/repo:android.bzl", "aar_import_external", "aar_maven_import_external")
  • We have added documentation for using the Android NDK.

C++

  • We have removed the --glibc option. Toolchain selection now relies solely on --cpu and --compiler options.
  • We have fully removed support for LIPO.

Java

  • Java code coverage collection works well without passing --jobs=1. Previously bazel would crash when invoking code coverage collection for Java code using multiple workers.
  • The BAZEL_JAVAC_OPTS environment variable now allows arguments. For example, you can pass -J-Xmx2g, the javac compiler during bootstrap build. This can be helpful if your system chooses a max heap size that is too small for the Java compiler during the bootstrap build.

Skylark

  • Structs (using struct()) can no longer have to_json and to_proto fields overridden.

Windows

  • Windows default system .bazelrc is now read from the user's ProgramData, if present.
  • The default value of --experimental_shortened_obj_file_path is now true. Bazel now generates short object file paths by default.

Community

Thank you to our contributors!

This release contains contributions from many people at Google, as well as: Andy G. Scott, Arielle Albon, Benjamin Peterson, David Ostrovsky, Dmitry Petrashko, flamecoals, Greg Steuck, Jeremy Nimmer, John Millikin, justhecuke, Loo Rong Jie, Mostyn Bramley-Moore Naresh, Nikhita Raghunath, Oscar Bonilla, Taras Tsugrii, and Yannic Bonenberger.

Thank you to everyone who contributed to this release!

Bazel Conference 2018

We'll be organizing the 2018 Bazel User Conference in NYC, on October 9-10. If you would like to join us, please register: https://goo.gl/forms/1ySgfiKXzntp6Knj2. Check out last year's session recordings on the BazelCon website.