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_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, like runs_per_test.
  • Query / Dump
  • 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.
  • Apple / iOS
  • Protocol buffers
  • Android
    • Updated default 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 --fatapkcpu.
    • 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, and 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 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 via load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") instead.
    • The native 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.