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_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@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_attrsallows 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
printfunction 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_dsymflag.
-
- Protocol buffers
- Android
- Updated default
android_cpuvalue fromarmeabitoarmeabi-v7a. This only affects Android builds that set--crosstool_topto 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_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, andstrip_include_prefixattributes useful for migration. -
cc_binaryandcc_testnow enablestatic_linking_modeordynamic_linking_modeCROSSTOOL 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
--ltobackendoptand--per_file_ltobackendoptfor passing options to ThinLTO LTO backend compile actions only. See docs in the command line reference.
-
- Repository Rules
-
repository_cacheis no longer experimental and enabled by default. - The native
http_archiverule has been deprecated. Use the Skylark version available viaload("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")instead. - The native
git_repositoryrule 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.