Bazel 0.17 is out. The language and the API have been renamed from Skylark to Starlark. See the announcement and the dedicated GitHub repository.
We are now using our own Homebrew Tap. See the blog post for details.
Over the last few weeks, we've been updating our roadmaps on the website.
Below are the main changes since 0.16.
Remote Execution API V2
Migrated to Remote Execution API v2. See Remote API repository, and RE API revisions document. Major API changes include:
- Execute / Watch have been combined and the separate Watcher API has been deprecated.
- Output files/directories and Platform have moved from Action to Command. Action is now referenced by Digest.
- Inline outputs have been deprecated.
- Action and Command are now uploaded together with ActionResult on local execution.
Query
- The new (experimental)
aquery
command allows the retrieval of analysis time information for the action graph.
Starlark
- If the same artifact is generated by two distinct but identical actions, and a downstream action has both those actions' outputs in its inputs, the artifact now appears twice in the downstream action's inputs. If this causes problems in Starlark actions, use the
uniquify=True
argument inArgs.add_all
. - A rule error is now thrown if a rule implementation function returns multiple providers of the same type. Use the
--incompatible_disallow_conflicting_providers
flag to make your code is forward-compatible.
Windows
- The
--experimental_shortened_obj_file_path
flag has been deprecated. Bazel now always generates a short object file path. For more details, see this doc. - When the
BAZEL_SH
environment variable is not set and Bazel searches forbash.exe
, Bazel no longer looks for git bash and no longer recommends installing it as a bash implementation. See issue #5751.
C++
- The
FULLY_STATIC
linking mode has been removed from C++ rules. - Python wrapper scripts for MSVC have been removed.
- Labels in C++ rules' linkopts attribute are no longer expanded unless they are wrapped. For example:
$(location //foo:bar)
.
Android
- Fixed compatibility with aar_import when using aapt2.
aapt2
is now supported for Android app builds without resource shrinking. To use it, pass the--android_aapt=aapt2
flag or defineandroid_binary.aapt_version = "aapt2"
in your BUILD file. - Added support for Android NDK r17. The default STL is now
libc++
. Support for targetingmips
,mips64
andARMv5
(armeabi
) has been removed. - For Android incremental dexing actions, Bazel now persists its DexBuilder process across individual actions, with built-in caching of dexing outputs. Our benchmarks show a 1.2x speedup for clean local builds.
Apple
- The standard
xcode_VERSION
feature now always uses exactly two components in the version, even if you specify--xcode_version
with more or fewer than two.
Java
- Support for
java_runtime_suite
has been removed. Usealias()
withselect()
instead. - JavaInfo outputs are now merged in
java_common.merge()
. - Code coverage is now collected for Java binaries invoked from
sh_test
. -
java_common.compile
now creates the native headers .jar file accessible viaJavaInfo.outputs.native_headers
. - The
--host_javabase
startup flag has been renamed to--server_javabase
to avoid confusion with the--host_javabase
build flag. - The
gen_jars
output group has been removed. - The Java
runfiles
library is now in@bazel_tools//tools/java/runfiles
. The old target (@bazel_tools//tools/runfiles:java-runfiles
) has been deprecated and will be removed in Bazel 0.19.0. - Bazel now ships with Java Development Kit version 10.
- The default
java_toolchain
no longer supports using JDK 8 as a--host_javabase
. To use JDK 8 as a--host_javabase
, also set--host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8 --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
.toolchain_hostjdk8
uses VanillaJavaBuilder, which does not support Error Prone, Strict Java Deps, or reduced classpaths, and disables header compilation.
External Repositories
- Loading
@bazel_tools//tools/build_defs/repo:git_repositories.bzl
has been disabled. Load@bazel_tools//tools/build_defs/repo:git.bzl
instead. - New options
--experimental_repository_hash_file
and--experimental_verify_repository_rules
allow the verification of repositories the directory generated against pre-recorded hashes. See documentation for those options.
Execution
- The new
--remote_cache_proxy
flag allows remote HTTP caching connections via Unix domain sockets. - Open TCP connection count for remote caching is now limited to 100 by default. You can specify a different limit using the
--remote_max_connections
flag. - The
--subcommands
flag now takes thepretty_print
value (--subcommands=pretty_print
), which prints the arguments of subcommands as a list for easier reading. - Bazel no longer defaults to non-sandboxed local execution when falling back from remote execution to local execution. Use the new
--remote_local_fallback_strategy=<strategy>
flag to specify the desired fallback strategy.
Miscellaneous
- The deprecated no-op flag
--show_package_location
has been removed. - Bazel now allows
@
in package names. For example,node_modules/@namespace_foo/lib_bar
(a common pattern for NPM) is now an allowed package name. - The
--defer_param_files
flag now defaults totrue
. As a result, Bazel now writes the parameter file during action execution instead of as a separate action. This is faster and requires less memory than using a separate action. When using remote execution, pass the--materialize_param_files
flag to inspect the file locally (for example, for debugging purposes). - Bazel now supports a
.bazelignore
file that tells Bazel directories to ignore. These directories still have to be well-founded and, in particular, must not contain symlink cycles.
Community
- David Stanke made a 30-minute talk at Cloud Next '18: Accelerate your Build and Test with Google Cloud Platform.
- Rules for C# have new maintainers and have been significantly updated.
- New rules for Purescript, Idris, Eta, and Emscripten have been added.
- The repository StartupOS contains examples showcasing Angular, protobuffers, and gRPC with Bazel.
- TensorFlow announced they will use Bazel for their Windows builds and drop official support for CMake.
- Ruud van Asseldonk wrote an article about Build system insights, using Bazel as an example.
- Torgeir "Tor" Helgevold explains how to build a scalable React dev environment using Bazel.
Did we miss anything? Fill the form to suggest content for a next blog post.
Thank you to our contributors!
This release contains contributions from many people at Google, as well as: Alex Beggs, Arielle Albon, Austin Schuh, Benjamin Peterson, Bin Lu, Clint Harrison, Dan Fabulich, David Ostrovsky, David Pursehouse, Ed Baunton, Ed Schouten, George Gensure, Gregor Jasny, Loo Rong Jie, Rishabh Chakrabarti, Robert Gay, Stephan Pleines, Taras Tsugrii, Vladimir Zaytsev, Wayou Liu, wylazy, and Yannic Bonenberger.
Thank you to everyone who contributed to this release!