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_levelattribute 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-libcppto use thelibc++STL.
- In r15, the minimum API level target is 14. If the
- Experimental
android_instrumentation_testsupport 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_runflag onbazel runlets one run interactive binaries. Tests are then run in an approximation of the official test environment. TheBUILD_{WORKSPACE,WORKING}_DIRECTORYenvironment 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 runis worked is slated to be removed soon. - Add a –build_event_publish_all_actions 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@attemptssyntax, 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](https://github.com/bazelbuild/bazel/blob/c9bdc1fab5b218d5049edbbb09facff2aeac96b3/src/main/java/com/google/devtools/build/lib/query2/CommonQueryOptions.java#L157)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](https://docs.bazel.build/versions/master/skylark/lib/globals.html#print)function on a target now shows the provider keys of the target, as debug information.
- Removed flags
- Apple / iOS
apple_binaryrules can now generate dSYM outputs with the[--apple\_generate\_dsym](https://github.com/bazelbuild/rules_apple/blob/master/doc/common_info.md#dsyms-generation-apple_generate_dsym)flag.
- Protocol buffers
- Android
- Updated default
[android_cpu](https://docs.bazel.build/versions/master/command-line-reference.html#flag--android_cpu)value fromarmeabitoarmeabi-v7a. This only affects Android builds that set--crosstool\_topto the Android NDK crosstool and that do not use--fat_apk_cpu. - 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_configforc++-link-nodeps-dynamic-library. Now we can specify different flags for shared libraries created bycc\_binaryandcc\_libraryrules.BAZEL_LINKOPTSis 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\_libraryinstead.cc\_libraryis strictly more powerful and can emulate all use cases ofcc_inc_library. You might find includes,[include_prefix](https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library.include_prefix), and[strip\_include\_prefix](https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library.strip_include_prefix)attributes useful for migration. cc\_binaryandcc\_testnow enablestatic_linking_modeordynamic_linking_modeCROSSTOOL features depending on the linking mode. We will eventually remove linking_mode_flags message from the CROSSTOOL, and use these features only. Since these features are enabled, you can migrate right now.- Added
--ltobackendoptand--per\_file\_ltobackendoptfor passing options to ThinLTO LTO backend compile actions only. See docs in the command line reference.
- Repository Rules
[repository_cache](https://docs.bazel.build/versions/master/command-line-reference.html#flag--repository_cache)is no longer experimental and enabled by default.- The native
[http_archive](https://docs.bazel.build/versions/master/be/workspace.html#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](https://docs.bazel.build/versions/master/be/workspace.html#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.