We've just released Bazel 0.12!
If you use Bazel on Windows, please tell us what you think! We've set up a survey that will help us prioritize work.
Notable changes
- Android NDK r15 and r16 support is available. This includes compatibility with Unified Headers.
- In r15, the minimum API level target is 14. If the
android_ndk_repository.api_level
attribute is set less than 14, 14 will be used instead. - In r16,
libc++
is out of beta and is the preferred STL. Pass the flag--android_crosstool_top=@androidndk//:toolchain-libcpp
to use thelibc++
STL.
- In r15, the minimum API level target is 14. If the
- Experimental
android_instrumentation_test
support has landed. Learn more about how you can run Android instrumentation tests in an hermetic and reproducible way on the documentation page.
Tools
- We are working on a code formatter for bzl files. It's still a work in progress, but you can already give it a try. See the discussion and Buildifier repository.
- Visual Studio: Tyler Mandry wrote a Visual Studio project generator for C++ rules.
- Bazel migrated its continuous integration system to Buildkite (www.buildkite.com). This greatly improved the team's productivity and the reliability of our testing. Bazel contributors can see their test results in the new Bazel Build Results UI. Buildkite CI pipelines currently are only visible to logged in users, which is a shortcoming that the Buildkite team is working on. Please see the announcement e-mail for all details.
Community update
- Mathieu Boespflug announced Haskell rules that are used at Tweag and other companies.
- Alex Eagle tweeted that Angular 6.0.0-rc.1 was built and published by Bazel.
- Greg Magolan wrote an article on production code splitting with Bazel
- Tyler Mandry also wrote a blogpost: A high-level build tool for your polyglot codebase
Other changes
- --config expansion order is changed
- The new
--direct_run
flag onbazel run
lets one run interactive binaries. Tests are then run in an approximation of the official test environment. TheBUILD_{WORKSPACE,WORKING}_DIRECTORY
environment variables are available to the binary to inform it about the location of the workspace and the working directory Bazel was run from. The old waybazel run
is worked is slated to be removed soon. - Add a --build_event_publishallactions flag to allow all actions to be published via the BEP. Note that this may increase the size of the BEP a lot.
- flaky_test_attempts supports the
regex@attempts
syntax, likeruns_per_test
. - Query / Dump
- The new bazel dump option --action_graph allows to dump the action graph in proto format as seen by Bazel's analysis phase. Jin wrote a blogpost how to use the dump to inspect the build: https://jin.crypt.sg/articles/bazel-action-graph.html
- The bazel query option
--proto:output_rule_attrs
allows to filter for given attributes to reduce the size of the proto output.
- BUILD / .bzl files
- Removed flags
--incompatible_checked_arithmetic
,--incompatible_dict_literal_has_no_duplicates
,--incompatible_disallow_keyword_only_args
,--incompatible_load_argument_is_label
, and--incompatible_comprehension_variables_do_not_leak
(see the Backward Compatibility policy). - When calling a rule, dict-valued attributes are no longer lexicographically sorted. The rule now preserves the iteration order (from the BUILD or bzl file where it was created).
- Calling the
print
function on a target now shows the provider keys of the target, as debug information.
- Removed flags
- Apple / iOS
-
apple_binary
rules can now generate dSYM outputs with the--apple_generate_dsym
flag.
-
- Protocol buffers
- Android
- Updated default
android_cpu
value fromarmeabi
toarmeabi-v7a
. This only affects Android builds that set--crosstool_top
to the Android NDK crosstool and that do not use--fatapkcpu
. - Corrected the include paths of
llvm-libc++
headers in NDK r13+. This fixes missing link time files when compiling againstlibc++
.
- Updated default
- C++ Rules
-
CcToolchain
: Introducedaction_config
forc++-link-nodeps-dynamic-library
. Now we can specify different flags for shared libraries created bycc_binary
andcc_library
rules. -
BAZEL_LINKOPTS
is now consulted when autoconfiguring c++ toolchain. It can be used to switch from-lstdc++
to-lc++
. Colon is the flag separator. - Introduced
--experimental_drop_fully_static_linking_mode
. With this flag linkopts be scanned for "-static" to enable fully static linking mode. Future default. Please use features instead. - Removed
cc_inc_library
, please usecc_library
instead.cc_library
is strictly more powerful and can emulate all use cases ofcc_inc_library
. You might find includes,include_prefix
, andstrip_include_prefix
attributes useful for migration. -
cc_binary
andcc_test
now enablestatic_linking_mode
ordynamic_linking_mode
CROSSTOOL features depending on the linking mode. We will eventually remove linkingmodeflags message from the CROSSTOOL, and use these features only. Since these features are enabled, you can migrate right now. - Added
--ltobackendopt
and--per_file_ltobackendopt
for passing options to ThinLTO LTO backend compile actions only. See docs in the command line reference.
-
- Repository Rules
-
repository_cache
is no longer experimental and enabled by default. - The native
http_archive
rule has been deprecated. Use the Skylark version available viaload("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
instead. - The native
git_repository
rule has been deprecated. Use the Skylark version available viaload("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
instead.
-
Did we miss anything? Fill the form to suggest content for a next blog post.
Discuss on Hacker News.