Skip to main content

What's New in Bazel 5.0

Brentley Jones
Brentley Jones, Developer Evangelist @ BuildBuddy

Bazel 5.0 includes nearly 3,000 changes since 4.2.2. It's the first major release since 4.0 was release in January of last year, and it's Bazel's second LTS release. Since there were so many changes, many of them quite impactful, I felt I needed to review them all and provide a nice summary for y'all. So that's what I did πŸ˜„.

The end result was quite big though, so I've included a table of contents to allow easy navigation to the changes that interest you the most:

Command-line flag changes​

Bazel's LTS strategy allows for breaking changes between major versions. In particular, it allows for command-line flags to be removed, renamed, made to do nothing, or have their default values changed. In the following sections I collected all such flag changes I could find.

Renamed​

  • --incompatible_use_lexicographical_unordered_output is now --incompatible_lexicographical_output. (2ee3c2b)
  • --experimental_run_validations is now --run_validations. (374cb1f)
  • --experimental_existing_rules_immutable_view is now --incompatible_existing_rules_immutable_view. (3518200)
  • --project_id is now --bes_instance_name. (2b48c6b)

Default values changed​

  • --analysis_testing_deps_limit=800 (de3b3ca)
  • --experimental_enable_aggregating_middleman=false (64d5bae)
  • --experimental_exec_groups=true (fa4e14b)
  • --experimental_forward_instrumented_files_info_by_default=true (5b216b2)
  • --experimental_jlpl_enforce_strict_deps=true (0c1257e)
  • --experimental_no_product_name_out_symlink=true (06bd3e8)
  • --experimental_profile_cpu_usage=true (f56b134)
  • --experimental_skyframe_cpu_heavy_skykeys_thread_pool_size=HOST_CPUS (38dd8aa)
  • --include_aspect=true (44e46b8)
  • --incompatible_disable_depset_items=true (ef967be)
  • --incompatible_disallow_resource_jars=true (fec2fdb)
  • --incompatible_disallow_strict_deps_for_jlpl=true (10b3479)
  • --incompatible_display_source_file_location=true (32721fb)
  • --incompatible_java_common_parameters=true (cfaa88b)
  • --incompatible_override_toolchain_transition (4b47d6f)
  • --incompatible_require_javaplugininfo_in_javacommon=true (1c062e2)
  • --incompatible_top_level_aspects_dependency=true (9a765c8)
  • --incompatible_use_toolchain_resolution_for_java_rules=true (c2485f6)
  • --trim_test_configuration=true (ebac27e)

Deprecated​

  • --bep_publish_used_heap_size_post_build (a512791)
  • --experimental_force_gc_after_build (ae2a6a2)
  • --experimental_required_aspects (88a02cd)
  • --{,no}experimental_send_archived_tree_artifact_inputs (37115a5)
  • --experimental_spawn_scheduler (b41576b)
  • --watchfs (03bd0eb)

No-op​

These flags now do nothing, but still exist to allow for migration off of them:

  • --all_incompatible_changes (7300231)
  • --bep_publish_used_heap_size_post_build (d9a523e)
  • --check_constraint (d623892)
  • --experimental_cc_skylark_api_enabled_packages (ba258e8)
  • --experimental_force_gc_after_build (cdeb49f)
  • --{experimental_,}json_trace_compression (8d39164)
  • --experimental_shadowed_action (3e8cda1)
  • --experimental_skyframe_eval_with_ordered_list (35ef799)
  • --experimental_starlark_config_transitions (6619d77)
  • --experimental_multi_threaded_digest (6ac6954)
  • --experimental_profile_cpu_usage (3c5e531)
  • --incompatible_applicable_licenses (af3add8)
  • --incompatible_dont_collect_so_artifacts (144a62a)
  • --incompatible_load_python_rules (253933f)
  • --incompatible_use_toolchain_resolution_for_java_rules (5b8f054)
  • --legacy_dynamic_scheduler (5b04895)
  • --use_singlejar_apkbuilder (b213637)

Removed​

  • --apple_sdk (166771e)
  • --bep_publish_used_heap_size_post_build (6555d95)
  • --enable_apple_binary_native_protos (3135f49)
  • --enable_runfiles (5a91c25)
  • --experimental_dynamic_configs (e68a7d0)
  • --experimental_enable_aggregating_middleman (e956469)
  • --experimental_exec_groups (3973b5f)
  • --experimental_forward_instrumented_files_info_by_default (c411d9a)
  • --experimental_interleave_loading_and_analysis (544b51d)
  • --experimental_nested_set_as_skykey_threshold (359ceb4)
  • --experimental_no_product_name_out_symlink (b621b1b)
  • --experimental_objc_enable_module_maps (427b4dd)
  • --experimental_query_failure_exit_code_behavior (c1695ef)
  • --experimental_starlark_config_transitions (28a1e6e)
  • --experimental_ui_mode (5752762)
  • --incompatible_enable_execution_transition (f0c6eab)
  • --incompatible_ignore_duplicate_top_level_aspects (ed25118)
  • --incompatible_objc_compile_info_migration (bcdd55d)
  • --incompatible_objc_provider_remove_compile_info (952c0d7)
  • --incompatible_prefer_unordered_output (e7202e3)
  • --incompatible_prohibit_aapt1 (aefd107)
  • --incompatible_require_java_toolchain_header_compiler_direct (f9db4fb)
  • --is_stderr_atty (4d9c6f9)
  • --javabase and --java_toolchain (e1c404e)

Remote​

One of Bazel's most powerful features is its ability to use remote caching and remote execution. Numerous improvements and fixes to Bazel's remote capabilities are included in Bazel 5.0.

gRPC​

Bazel uses gRPC as a protocol for most of its remote capabilities. There were a couple changes that applied at this foundational level:

  • Added mnemonic and label to remote cache and remote execution requests. (a750a56)
  • Bazel no longer crashes on errors returned while creating a gRPC connection. (b0ae0af)

Remote caching (RBC)​

Using a remote cache is one of the most popular ways of speeding up a Bazel build. Thankfully these changes make using a remote cache both more performant and more reliable:

  • Added the --experimental_remote_cache_compression flag, which compresses gRPC uploads/downloads. (50274a9)
  • Added the --experimental_remote_cache_async flag, which makes uploads happen in the background. (7f08b78)
  • Added the --experimental_remote_merkle_tree_cache flag, which can speed up action cache hit checking. (3947c83)
  • Added the --experimental_action_cache_store_output_metadata flag, which can speed up Remote Build without the Bytes after a Bazel server restart. (4e29042)
  • Added the no-remote-cache-upload tag, which allows downloading, but not uploading, outputs from the remote cache. (bfc2413)
  • Reduced FindMissingBlobs calls when using a combined cache. (dc32f0b)
  • FindMissingBlobs calls and file uploads are now deduplicated. (db15e47)
  • Fixed "file not found" errors when remote cache is changed from enabled to disabled. (f948989)
  • chmod 0555 is now consistently set on outputs. (11066c7)

Remote execution (RBE)​

For some projects, using remote execution is the ultimate performance unlock for their Bazel builds. In addition to the remote caching changes covered above, which also apply to remote execution, the following changes improve the remote execution experience:

  • Added the --experimental_dynamic_skip_first_build flag, which skips dynamic execution until there has been a successful build. (1e42b94)
  • Improved debug output when using the --experimental_debug_spawn_scheduler flag. (060d596)
  • Improved performance of workers when using dynamic execution. (6080c1e)
  • Improved dynamic execution's local execution delay logic. (04754ef)
  • The disk cache can now be used with remote execution. (cf57d03)
  • Target-level exec_properties now merge with values from --remote_default_exec_properties. (713abde)
  • Failure messages from remote execution are now propagated. (399a5be)

Build Event Service (BES)​

Using a build event service can give you unparalleled insight into your Bazel builds at scale. There were some nice changes to BES support, though I think the improvements to how it interacts with the remote cache are especially noteworthy.

  • Added the --incompatible_remote_build_event_upload_respect_no_cache flag, which prevents the BES uploader from uploading the outputs of actions that shouldn't be cached remotely. (bfc2413)
  • Added the --bes_header flag, which allows passing extra headers to the BES server. (ef42d13)
  • Added logging when a blob upload isn't uploaded in time. (71b50f6)
  • The --build_event_binary_file flag now implies --bes_upload_mode=wait_for_upload_complete. (62060ba)
  • BES referenced blobs are no longer stored in the disk cache. (dc59d9e)
  • The BES uploader now uses the same code as the remote cache uploader and is now more robust to errors. (e855a26)
  • Fixed the BES uploader to handle errors in more edge cases. (c51eb57)

Logging​

Bazel offers various ways to gain insight into your build. It's not too surprising then that there were over 30 changes to these capabilities in Bazel 5.0.

Build Event Protocol (BEP)​

The build event protocol is used by build event services, so all of these changes could have also been listed in that section as well. The BEP can also be collected locally with --build_event_json_file and --build_event_binary_file.

The vast majority of changes added additional information to the BEP, though some are fixes and improvements:

  • Added cumulative_metrics field to BuildMetrics. (77a980f)
  • Added worker_metrics field to BuildMetrics. (c674101)
  • Added action_data field to BuildMetrics.ActionSummary. (f572d3b)
  • Added source_artifact_bytes_read field to BuildMetrics.ActionSummary. (0a23a5e)
  • Added analysis_phase_time_in_ms field to BuildMetrics.TimingMetrics. (34b2947)
  • Added garbage_metrics field to BuildMetrics.MemoryMetrics. (8965d25)
  • Added count and size of output files and top-level files seen during a build to BuildMetrics.ArtifactMetrics. (dd8afa0)
  • Added incomplete field to TargetComplete.OutputGroup. (3e1ba0c)
  • Added the --experimental_bep_target_summary flag, which adds the TargetSummary event, which is intended to summarize all TargetComplete (including for aspects) and TestSummary messages for a given configured target. (8d48154)
  • Added attempt_count field to TestSummary. (766cd0e)
  • Added test suite expansions. (7fb0c16)
  • Added conflicting action output reporting. (2487920)
  • Replaced remote_cache_hits field with a more detailed runner_count. (f880948)
  • Timestamps and durations now use Well Known Types. (e5c832a)
  • Improved reporting of Starlark build settings. (bf31feb)
  • The used_heap_size_post_build field is now populated when the --memory_profile flag is set. (3d58523)
  • Made --bep_publish_used_heap_size_post_build work for query and other non-build commands. (1c3bc90)
  • You can now assume the named_set_of_files event will appear before any event referencing that named_set by ID; this allows consumers to process the files for such events (eg. TargetCompleted) immediately. (fcf9dd5)
  • The BEP now includes all files from successful actions in requested output groups; previously, an output group's files were excluded if any file in the output group was not produced due to a failing action. (d2f93fd)

Timing profile​

The action timing profile, which is enabled by default with --profile, is viewable both locally in Chrome and on build event services. These changes add more detail and clarity to the profile:

  • Added server heap usage. (f4fbbd6)
  • Added system CPU and memory metrics. (ec2eda1)
  • Added file system traversal tracing. (45d82ca)
  • Added mobile-install tracing. (559db4e)
  • Added worker execution tracing. (786b418)
  • Renamed action count field from cpu to action. (c5f87ea)
  • Renamed "grpc-command" and "Service Thread" threads to "Main Thread" and "Garbage Collector". (a03674e)
  • The profile now mentions when an action is acquiring resources. (fa9fabb)

Execution log​

Bazel logs all of the spawns it executes in the execution log, which is enabled with the --execution_log_json_file or --execution_log_binary_file flags. This feature is relatively stable, with just a single noticeable change:

  • Added wall time duration. (f92d80c)

Query​

bazel build wasn't the only command to get improvements in this release. Here are some changes that were made to the query family of commands:

  • Added the --incompatible_lexicographical_output flag (on by default), which lexicographically sorts the output of query --order_output=auto. (acbcedd)
  • Added the --deduplicate_depsets flag (on by default) to aquery, which removes duplicate subsets in dep_set_of_files. (28ffaa2)
  • Added --keep_going functionality to graphless query. (a01371a)
  • Added execution platform information to aquery output. (11c09c5)
  • Fixed output of config_setting visibility. (5dfffef)

Dependency management​

A new (currently experimental) external dependency system, codenamed Bzlmod, was added in Bazel 5.0. Besides for all of the changes needed to support Bzlmod, there was one more notable dependency management related change:

  • Added the --experimental_repository_downloader_retries flag, which allows Bazel to retry certain repository download errors. (a1137ec)

Platforms and toolchains​

The C++, Android, and Apple rules are being migrated to support building with Platforms. While progress has been made, they don't fully support it yet in Bazel 5.0. For C++ projects, it's recommended that the --incompatible_enable_cc_toolchain_resolution flag is used, to help the Bazel team discover any issues in the wide variety of projects that exist.

Here are some of the platforms and toolchains related changes which weren't tied to any of those migrations:

  • Added the --experimental_platform_in_output_dir flag, which causes the output dir name to use a non-default platform name instead of the CPU. (daecf42)
  • target_compatible_with can now be used with all non-workspace rules. (d052ece)
  • The --toolchain_resolution_debug flag now accepts regexes matching targets, as well as toolchain types, when choosing what debug messages to print. (545befb)
  • The toolchain transition is now enabled for all toolchains. (4b47d6f)
  • Progress is being made on changing all host configurations to exec. (8d66a41)

Execution platforms​

Execution platforms are platforms which build tools execute on. These include the host platform on which Bazel runs.

In the following sections I collected notable changes for Linux and macOS. I'm sure there were some for Windows as well, but since I don't use Bazel on Windows, none of the changes stood out to me as pertaining only to it.

Linux​

I only noticed a single change that was directly related to Linux execution:

  • Added the --experimental_use_hermetic_linux_sandbox flag, which configures linux-sandbox to use a chroot environment. (11f7d80)

macOS​

On the other hand, macOS had a lot of changes related to it:

  • Added the xcode_version_flag.precision attribute to allow matching a subset of the version components. (7484c98)
  • Added progress reporting in xcode_configure. (762f9e2)
  • Toolchain tools now compile as universal binaries if possible. (de5fc19)
  • xcode-locator is now built as a universal binary. (6916fc1)
  • Sandboxed actions can now run /bin/ps. (652d1cc)
  • If --experimental_prefer_mutual_xcode is passed, Bazel chooses the local default (instead of the newest mutually available version) if it's available both locally and remotely. (4bef502)
  • Generated xcode_version targets now include product version aliases. (f52e218)
  • osx_archs.bzl is now explicitly exported from the crosstool. (aeec9a8)
  • Fixed typo in the cache directory name. (b5bbe28)
  • Fixed libtool with params files. (48dd159)
  • Fixed the --experimental_prefer_mutual_xcode flag not being used correctly for all parts of the build. (bb41ebc)
  • Fixed a crash when a custom crosstool specifies a DEVELOPER_DIR environment variable. (1811e82)
  • Fixed JSON output for xcode-locator. (1bae172)

Target platforms​

Target platforms are platforms which you are ultimately building for. I cover the Android and Apple platforms in the following sections, as they still have some functionality provided by Bazel core, instead of being fully supported by standalone Starlark rules.

Android​

  • Added the --experimental_run_android_lint_on_java_rules flag, which causes Java rules to invoke Android Lint. (909bec5)
  • Added the android_sdk.legacy_main_dex_list_generator attribute. (0ccbbde)
  • Added support for location expansion in the java_toolchain.android_lint_opts attribute. (1c0194c)
  • Added support for symlinks in Android SDK repositories. (e41440e)
  • The minimum Android build tools version for the Android rules is now 30.0.0. (0e65273)
  • --apk_signing_method now accepts the value v4. (f9df9d7)
  • Tags are now propagated to AndroidBinary actions. (8f927d2)
  • aapt2 convert is now used instead of relinking final APK as static lib. (8465c17)
  • The --no-proguard-location-reference flag is now passed to aapt2 when linking and generating proguard configurations. (705b419)
  • Made Android Lint worker compatible. (65dc407)
  • Made AarGeneratorAction worker compatible. (64ffc09)
  • Android Lint validations are now correctly propagated through android_binary's split transition. (c6c6389)
  • android_binary now always uses the bytecode optimizer's mnemonic. (c381a27)
  • Fixed Android API level support in NDK crosstools. (b4c637c)
  • Fixed AarResourcesExtractor action to produce consistent zips. (85ab374)
  • Fixed --fat_apk_hwasan when using --{,android_}cpu instead of --fat_apk_cpu. (a38eb75)

Apple​

  • Added support for the Apple Silicon iOS simulator. (c1ea2d4)
  • Added support for the Apple Silicon watchOS simulator. (9c1c622)
  • Added the --host_macos_minimum_os flag. (6345c80)
  • Added support for LLVM BC files. (f53c389)
  • Added the --incompatible_disable_native_apple_binary_rule flag, which disables the native apple_binary rule. (65e9732)
  • When building an iOS target it now defaults to the Apple Silicon iOS simulator when building on an Apple Silicon host. (ca5f67f)
  • Made -c opt strip dead code by default. (3114e80)
  • Timestamps are now disabled in linking actions. (073ae81)
  • --apple_bitcode=embedded now applies to cc_library targets. (3439a52)
  • Removed support for "nodeps" dynamic libraries. (ec55533)
  • Lipo operations are now conditional with the linkMultiArchBinary Apple binary Starlark API. (066fba3)
  • --apple_crostool_top is now preserved in host/exec transitions. (3ece10a)

Languages​

While there are lots of programming languages that are supported through standalone Starlark rules, some are still written as "native" rules in Bazel core, or are bundled Starlark rules while Starlarkification is in progress. In the following sections I summarize the notable changes in support of these languages.

C and C++​

  • Added support for CUDA header file type (.cuh). (c750c52)
  • Added .rlib as an allowed extension for static libraries. (ad03823)
  • Added support for location expansion in cc_*.defines attributes. (28fc8a1)
  • Added the cc_toolchain.target_transition_for_inputs attribute. (26abd97)
  • Added native options for cc_shared_library. (96afa0f)
  • Added -g in per_object_debug_info for Clang 12 and GCC 11. (fa69b78)
  • Added support for clang's libc++ to the Unix toolchain. (f1531dc)
  • Added support for LLD to the Unix toolchain. (00e30ca)
  • Added the external_include_paths feature, which disables warnings from external headers. (08936ae)
  • Added the --incompatible_enable_cc_test_feature flag, which switches from the use of build variables to the feature of the same name. (c74ae11)
  • Added the --experimental_cpp_compile_resource_estimation flag, which estimates precise resource usage for local execution of CppCompileAction. (f5196e2)
  • Added the --experimental_use_cpp_compile_action_args_params_file flag, which causes CppCompileAction to write exposed action.args to a parameters file. (dc914c6)
  • Added support for Starlark transitions on --incompatible_enable_cc_toolchain_resolution. (c4357cf)
  • Added the dynamic_mode attribute to the cpp fragment. (e2915a8)
  • C++ modules are no longer created if there are no modular headers. (09cba3b)
  • Made the abi_version and abi_glibc_version attributes optional for cc toolchains. (9a5bef9)
  • Made gcov optional in cc toolchains. (e8a95ca)
  • Renamed target_transition_for_inputs to exec_transition_for_inputs to better reflect the mechanism at play. (5448c7c)
  • The oso_prefix_is_pwd feature now applies to C++ link actions. (9b4844a)
  • Fixed CppCompileActionTemplate's handling of PIC. (0349360)
  • Fixed build failures when the same shared lib is depended on multiple times. (b571f2c)
  • Fixed C++ code coverage when using remote execution. (ab1da7b)
  • Fixed a performance issue when cc_binary depended on cc_shared_library targets. (503d56e)
  • Fixed a crash when feature configuration or cc toolchain were None. (d3b3425)

Java​

  • Upgraded JDK11. (698c17a)
  • Removed JDK14. (06f7340)
  • Added JDK16. (e2ed2fd)
  • Added JDK17. (eb7bf8c)
  • Added support for Java versions with a single component. (2a3e194)
  • Added support for worker cancellation. (05d0446)
  • Added support for record attributes to ijar. (26229fe)
  • Added support for sealed class attributes to ijar. (70ae390)
  • Added the --host_jvmopt flag. (570f019)
  • Added the javabuilder_data and turbine_data attributes to java_toolchain. (a1b19df)
  • Added the http_jar.downloaded_file_path attribute. (15b1840)
  • Added mnenomic tags for java toolchain actions. (120ea6c)
  • Added java_outputs to JavaPluginInfo. (f73e28c)
  • Java rules now use toolchain resolution. (Issue #7849)
  • Java branch coverage now applies Jacoco’s coverage filters. (065e2e8)
  • The local JDK is now attached to JVM8_TOOLCHAIN_CONFIGURATION. (7e48642)
  • Only JDK repositories that are needed are downloaded now. (903c272)
  • java_test now has the requires-darwin execution requirement on macOS. (ca39c05)
  • Removed ABSOLUTE_JAVABASE. (2a07fed)
  • Removed the jarFiles, resources and sourceJarsForJarFiles attributes from JavaSourceInfoProvider. (34cfab5)
  • Removed the JavaInfo.add_compile_time_jdeps and compile_time_jdeps attributes. (4d54234)

Objective-C​

  • Added support for location expansion in the objc_library.copts attribute. (d966a0d)
  • Swift module maps are no longer generated in objc_library and objc_import targets. (31bec27)
  • Removed the generate_dsym method from the objc fragment. (1bf5843)

Rules authoring​

Bazel's extensibility is powered by the ability to write custom rules. Most rules used in a project will be provided by open source rule sets, but projects may also define rules themselves. Bazel 5.0 includes numerous changes that make custom rules more performant, easier to write, or even expand what is possible to do with them.

Aspects​

Aspects allow augmenting build dependency graphs with additional information and actions. These changes expanded their capabilities:

  • Added the --experimental_enable_aspect_hints flag,](https://github.com/bazelbuild/bazel/commit/60ebb105dbf34f0b267ea7573157246b4c9bfcaf) [which adds the aspect_hints attribute to rules. (a2856bf)
  • Added the --experimental_required_aspects flag, which allows aspects to depend on other aspects. (f8c3408)
  • Added the --incompatible_top_level_aspects_dependency flag, which allows top-level aspect dependencies. (ed25118)
  • When using the --allow_analysis_failures flag (for example, via bazel-skylib's analysistest with expect_failure = True), analysis-time failures in aspect implementation functions will now be propagated and saved in AnalysisFailureInfo, just like analysis-time failures in rules. (020dd5f)

Persistent workers​

Persistent workers improve build performance by sending multiple requests to long-running processes. Here are some notable changes to persistent worker support:

  • Added support for worker cancellation. (e0d6f8b)
  • Added the verbosity field to the worker protocol, primarily controlled by the --worker_verbose flag. (40d3363)
  • JSON based workers now have their requests formatted according to the ndjson spec. (299e50a)

Starlark​

As mentioned at Bazelcon, progress is being made on migrating natives rules out of Bazel and into standalone Starlark rules. In the Bazel 5.0 release progress was made on the Android, C++, Java, and Objective-C rules.

In addition to changes directly needed for Starlarkification, for which there were many and I'm not going to list them here, the Starlark language itself received performance and feature improvements:

  • Added support for nested def statements. (5ca2064)
  • Added support for lambda expressions. (50ce3f9)
  • Added support for allow_closure in the args.add_all and args.add_joined methods. (6e0050d)
  • Added support for augmented field assignment (y.f += x). (fbbac6b)
  • Added support for %x, %X, and %o conversions in string % number. (99b7226)
  • Added 64-bit integer support to StarlarkInt.{floordiv,mod}. (3e45967)
  • Added support for some subsitutions in action progress messages. (bfa3643)
  • Added support for string build settings which accept multiple values. (a13f590)
  • Starlark rules can now use native transitions in the cfg parameter. (d1619b7)
  • Optimized str(int). (8f97db1)
  • Optimized () + tuple and tuple + (). (0ebb269)
  • Optimized long integer multiplication. (9d3f225)
  • Optimized &, |, ^, and ~ for 64-bit integers. (fa421b8)
  • Optimized list(list). (d7d7f82)
  • Optimized Starlark transitions. (5b4fb02)
  • Optimized --experimental_existing_rules_immutable_view. (dec8b5a)
  • Fixed Label() behavior when called with @repo parts. (463e8c8)
  • Propagated DefaultInfo no longer loses runfiles. (62582bd)

Misc​

There were a handful of changes that I couldn't find a nice home for in the sections above, but I still felt were important or interesting enough to call attention to:

  • Added the the --incompatible_enforce_config_setting_visibility flag, which makes config_setting honor the visibility attribute (defaulting to //visibility:public). (79989f9)
  • Added the --remove_all_convenience_symlinks flag to the clean command, which deletes all symlinks in the workspace that have the symlink_prefix prefix and point into the output directory. (f3513c1)
  • Added the --no-log-init flag to docker sandbox. (d4390f8)
  • Added the --experimental_keep_config_nodes_on_analysis_discard flag (default on), which reduces long-running memory usage. (2f4ed67)
  • Added the --experimental_reuse_sandbox_directories flag, which causes reuse of already-created non-worker sandboxes with cleanup. (1adb512)
  • Added the --experimental_skyframe_cpu_heavy_skykeys_thread_pool_size flag, which causes the loading/analysis phase of Skyframe to use 2 independent thread pools. (16c0408)
  • Added the --experimental_oom_sensitive_skyfunctions_semaphore_size flag, which configures the semaphore in ConfiguredTagetFunction. (b5bfcc1)
  • Added the --experimental_retain_test_configuration_across_testonly flag, which skips configuration trimming when when testonly is true on non-test targets. (309f4e1)
  • Test configurations are no longer trimmed when --nodistinct_host_configuration is on. (0b51d43)
  • The canonicalize-flags command now inherits from the build command in order to pick up build-specified --flag_alias settings from rc files. (3e6e975)
  • Bazel will no longer create a bazel-out symlink if --symlink_prefix is specified: the directory pointed to via the bazel-out symlink is accessible via ${symlink_prefix}-out. (06bd3e8)
  • Set TEST_RUN_NUMBER when the test runs multiple times. (9e4216e)
  • All (instead of just C++) source files are now filtered for coverage output according to --instrumentation_filter and --instrument_test_targets. (f38e293)
  • genrule.srcs is now considered a source attribute for coverage. (fa118ae)
  • label_keyed_string_dict attributes are now considered when gathering instrumented files for coverage. (9015f38)
  • Changed DEFAULT_STUB_SHEBANG to use python3 instead of python. (2945ef5)
  • Added the default solib dir to the rpath for shared libs with transitions. (20061f8)
  • Removed //visibility:legacy_public. (0803ce4)
  • Removed --action_graph from the dump command. (7cf0c34)
  • Added some fixes for the Starlark transition hash computation. (557a7e7)

Summary​

As you can see, Bazel 5.0 was a massive release. Thankfully, through the rolling releases process, people were able to test, or even actively depend on, these changes well before the first 5.0 release candidate was cut.

I expect Bazel 5.1 to be a fast follow with some changes that missed the final release candidate. Work on Bazel 6.0 is well underway as well, and I look forward to summarizing its changes later this year.