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_operatorflag 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_addto help migrate fromargs.add()toargs.add_all()orargs.add_joined()where appropriate. - FileType is deprecated and will be removed soon. Try the
--incompatible_disallow_filetypeflag to ensure your code is forward-compatible. - Removed flag
--incompatible_disallow_toplevel_if_statement. - Introduce
toolsparameter toctx.actions.runandctx.actions.run_shell. Tools are label-type attributes markedexecutable=True, whose runfiles are available to the action. Currently tools are passed in using theinputsparameter, but in the future it will be required to pass them throughtoolsinstead.
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_flagfield was removed fromCROSSTOOL. Usefeaturesinstead. - Fixed start/end lib expansion for linking used with
ld.goldandlld. There were many cases where archive files were still being used with toolchains that support start/end lib. - Introduce
fdo_profilerule that allows architecture-sensitive specification of fdo profiles. This rule has the same function as--fdo_optimizeand will replace it in the future.
Java
- In
java_toolchain, allowheader_compilerto be an arbitrary executable. -
java_common.compilenow usesjava_toolchain.javacoptsby default; explicitly retrieving them using the experimentaljava_common.default_javac_optsis unnecessary. - The JavaInfo provider created by
java_common.create_providernow includes both direct and transitive arguments inJavaInfo.transitive_compile_time_jarsandJavaInfo.transitive_runtime_jars. - Add
--incompatible_disallow_legacy_javainfoflag to make an error the use of old-style JavaInfo provider construction methods (java_common.create_providerandJavaInfo()). - Add a new
JavaInfoprovider constructor. See design document.
Other changes
- Command canonicalize-flags no longer reorders the flags.
- Remove vestigial
depsanddataattributes fromproto_lang_toolchain -
bazel runnow lets one run interactive binaries. TheBUILD_WORKSPACE_DIRECTORYandBUILD_WORKING_DIRECTORYenvironment 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_cacheand--experimental_local_disk_cache_pathflags into a single--disk_cacheflag. Additionally, Bazel now tries to create the disk cache directory if it doesn't exist. - Allow --workermaxinstances to take
MnemonicName=valueto 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.