We've just released Bazel 0.14!
BUILD and bzl files
- Labels starting with more than two slashes are disallowed (e.g.
///foo
). - The
/
operator is deprecated in favor of//
(floor integer division). Try the--incompatible_disallow_slash_operator
flag to ensure your code is forward-compatible. - Args objects (
ctx.actions.args()
) have new methodsadd_all()
andadd_joined()
for building command lines using depsets. Theadd()
method has a new overload:args.add("--foo", val)
. - Added flag
--incompatible_disallow_old_style_args_add
to help migrate fromargs.add()
toargs.add_all()
orargs.add_joined()
where appropriate. - FileType is deprecated and will be removed soon. Try the
--incompatible_disallow_filetype
flag to ensure your code is forward-compatible. - Removed flag
--incompatible_disallow_toplevel_if_statement
. - Introduce
tools
parameter toctx.actions.run
andctx.actions.run_shell
. Tools are label-type attributes markedexecutable=True
, whose runfiles are available to the action. Currently tools are passed in using theinputs
parameter, but in the future it will be required to pass them throughtools
instead.
sh rules
- You can now access runfiles (data-dependencies) from shell scripts in
sh_*
rules in a platform-independent way. See top of //tools/bash/runfiles/runfiles.bash for usage information.
C++
-
optional_compiler_flag
field was removed fromCROSSTOOL
. Usefeatures
instead. - Fixed start/end lib expansion for linking used with
ld.gold
andlld
. There were many cases where archive files were still being used with toolchains that support start/end lib. - Introduce
fdo_profile
rule that allows architecture-sensitive specification of fdo profiles. This rule has the same function as--fdo_optimize
and will replace it in the future.
Java
- In
java_toolchain
, allowheader_compiler
to be an arbitrary executable. -
java_common.compile
now usesjava_toolchain.javacopts
by default; explicitly retrieving them using the experimentaljava_common.default_javac_opts
is unnecessary. - The JavaInfo provider created by
java_common.create_provider
now includes both direct and transitive arguments inJavaInfo.transitive_compile_time_jars
andJavaInfo.transitive_runtime_jars
. - Add
--incompatible_disallow_legacy_javainfo
flag to make an error the use of old-style JavaInfo provider construction methods (java_common.create_provider
andJavaInfo()
). - Add a new
JavaInfo
provider constructor. See design document.
Other changes
- Command canonicalize-flags no longer reorders the flags.
- Remove vestigial
deps
anddata
attributes fromproto_lang_toolchain
-
bazel run
now lets one run interactive binaries. TheBUILD_WORKSPACE_DIRECTORY
andBUILD_WORKING_DIRECTORY
environment variables indicate the working directory and the workspace root of the Bazel invocation. Tests are provided with an approximation of the official test environment. - Repository rules are no longer restricted to return
None
. This is the first step in the transition towards generating WORKSPACE.resolved files, where source-like repository rules are expected to return the information needed to be a reproducible versions of themselves (for more details see the design document). At the moment, the return value is simply ignored (and debug-printed), but lifting the restriction allows rules to transition already. - Bazel now supports running actions inside Docker containers. To use this feature, run
bazel build --spawn_strategy=docker --experimental_docker_image=myimage:latest
. - Remote execution works for Windows binaries with launchers.
- We replaced the
--experimental_local_disk_cache
and--experimental_local_disk_cache_path
flags into a single--disk_cache
flag. Additionally, Bazel now tries to create the disk cache directory if it doesn't exist. - Allow --workermaxinstances to take
MnemonicName=value
to specify max for each worker.
Community
- We shared plans around a Rules Curation process. The goal is to promote a set of high quality rules, reduce breakages and improve stability of these rules.
- Yugui wrote a prototype version of rules_ruby.
- There is a new Google codelab on Building Android Apps with Bazel.
- cabal2bazel, a tool for fetching Haskell Cabal packages from Hackage into Bazel, was recently open sourced.
- Luc Perkins has created Colossus, a project on GitHub showing how Bazel can be used in a multi-lingual, microservice-driven setting. It uses Kubernetes, Go, Java, Docker, and gRPC.
- Ed Schouten started new rules for Latex.