← Bazel Blog

Bazel 0.12

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 the libc++ STL.
  • 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

Community update

Other changes

  • –config expansion order is changed
  • The new --direct_run flag on bazel run lets one run interactive binaries. Tests are then run in an approximation of the official test environment. The BUILD_{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 way bazel run is 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@attempts syntax, like runs_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.
  • Apple / iOS
    • apple_binary rules 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 from armeabi to armeabi-v7a. This only affects Android builds that set --crosstool\_top to 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 against libc++.
  • C++ Rules
    • CcToolchain: Introduced action_config for c++-link-nodeps-dynamic-library. Now we can specify different flags for shared libraries created by cc\_binary and cc\_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 use cc\_library instead. cc\_library is strictly more powerful and can emulate all use cases of cc_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\_binary and cc\_test now enable static_linking_mode or dynamic_linking_mode CROSSTOOL 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 --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](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 via load("@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 via load("@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.