Bazel Blog

Bazel 2.1

has just been released.

Bazel 2.1 is intended to be backward-compatible with Bazel 2.0. However it contains a single incompatible change that was deemed a bug fix and thus eligible for inclusion. We haven’t found any code broken by this change, but if it causes any burden to you.

Incompatible change

  • The following attributes of CcToolchainProvider, which formerly were accessible both as fields x.f and as methods x.f(), are now only fields: ld_executable, objcopy_executable, compiler_executable, preprocessor_executable, nm_executable, objdump_executable, ar_executable, strip_executable.

Starlark

  • x.f() is now equivalent to y=x.f; y(). That is, x.f should return the same attribute value regardless of whether it is accessed as a field or called like a method. Any arguments to the call are evaluated after the x.f operation.
  • Keyword-only arguments are now allowed: python def foo(a, *, k): pass def foo(a, *b, k): pass foo(5, k = 6) # k can be specified only by keyword
  • A new boolean field ctx.target_platform_has_constraint is added to allow rules to check the target platform's constraints.

bazelignore

  • Similar to the .bazelignore in the main repository, a .bazelignore file in external repository now causes the specified directories to be ignored by Bazel. Bazel doesn't try to identify any packages under the directories, but the files can still be referenced in other BUILD files.
  • .bazelignore files now support line comments, e.g. # this is a comment.

Android

  • Experimental support for d8 merger is now available for use using --define=android_dexmerger_tool=d8_dexmerger.
  • RoleManager#addRoleHolderAsUser now supports desugaring.

Other changes

  • Total critical path runtime will not be longer than total execution runtime.
  • A new BuildEventProtocol message is added for listing the convenience symlinks that get created in the workspace (such as bazel-out). Enable it with the --experimental_convenience_symlinks_bep_event flag.
  • cquery 'somepath(...)' returns more reliable results when the dependency has a different configuration than the parent. To get a result for somepath(//foo, //bar) when //bar isn't in the top-level configuration, run your query with --universe_scope=//foo. See cquery docs for details.

Community updates

  • P.J. McNerney wrote a new book: .
  • Oreilly published a report: by Benjamin Muschko.
  • rules_nodejs made its .
  • Judah Jacobson published , a tool that lets you interactively develop Haskell code. It uses Bazel to compile your code's dependencies, and then loads your modules into an interpreter.
  • The Bazel Community Experts page has been updated.
  • BazelCon 2019: The video recordings have been posted. VMWare open-source team shared their , and about it. thundergolfer shared about BazelCon talks.

This release contains contributions from many people at Google, as well as Adam Liddell, Alessandro Patti, Andreas Herrmann, Bor Kae Hwang, Brian Silverman, Emran BatmanGhelich, George Gensure, Jeff Palm, Jonathan Beverly, Mark Nevill, Patrick Niklaus, Peter, Ryan Beasley, Shin Yamamoto, and Yen-Chi Chen.