What's New in Bazel 7.0
Bazel 7.0 includes over 3,700 changes since 6.0. It's the latest major release, following the release of 6.0 in December of last year, and it's Bazel's fourth 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.
While I reviewed every change, I didn't understand every change ๐ . I just wanted to mention that, since this isn't an exhaustive list of changes, but it is a lot of changes I felt were relevant to a large portion of the community. Also, this year I've included changes that appeared in the Bazel 6 minor releases (e.g. Bazel 6.1). While you might already be on a version greater than 6.0, you might not know about all of the neat changes that made it into these "minor" releases.
Similar to Bazel 6.0's changes, the end result was quite big, 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โ
- [6.1.0]
--experimental_strict_conflict_checksto--incompatible_strict_conflict_checks(77f82f4) - [6.2.0]
--experimental_remote_grpc_logto--remote_grpc_log(2715120) - [6.3.0]
--experimental_credential_helperto--credential_helper(0573eee) - [6.3.0]
--experimental_credential_helper_cache_durationto--credential_helper_cache_duration(0573eee) - [6.3.0]
--experimental_credential_helper_timeoutto--credential_helper_timeout(0573eee) --experimental_allow_unresolved_symlinks--allow_unresolved_symlinks(215f698)--experimental_heuristically_drop_nodesto--heuristically_drop_nodes(e8a69f5)--experimental_remote_build_event_uploadto--remote_build_event_upload(fb16e8c)--experimental_remote_cache_compressionto--remote_cache_compression(0cdd409)--experimental_remote_download_regexto--remote_download_regex(6d04d38)--experimental_repository_disable_downloadto--repository_disable_download(4c7baa2)--experimental_sandbox_memory_limitto--experimental_sandbox_memory_limit_mb(09a07a4)--experimental_worker_multiplexto--worker_multiplex(4ad970d)
Default values changedโ
- [6.3.0]
--experimental_credential_helper_timeout=10s(5a71d9b) - [6.4.0]
--experimental_cc_implementation_deps=true(05787f3) --android_fixed_resource_neverlinking=true(253e986)--enable_bzlmod=true(30d033c)--experimental_build_transitive_python_runfiles=false(2f9c7d6)--experimental_exec_configuration_distinguisher=off(94d8bd3)--experimental_link_static_libraries_once=true(1456361)--experimental_merged_skyframe_analysis_execution=true(1b729a5)--experimental_output_directory_naming_scheme=diff_against_dynamic_baseline(81d12db)--experimental_sandbox_async_tree_delete_idle_threads=4(d169556)--incompatible_allow_tags_propagation=true(d0625f5)--incompatible_check_sharding_support=true(d6257ee)--incompatible_disallow_java_import_exports=true(b740189)--incompatible_enable_android_toolchain_resolution=true(05bea52)--incompatible_enable_cc_toolchain_resolution=true(1be55d8)--incompatible_exclusive_test_sandboxed=true(23580aa)--incompatible_fail_on_unknown_attributes=true(5f4a0b2)--incompatible_legacy_local_fallback=false(0f75c57)--incompatible_remote_use_new_exit_code_for_lost_inputs=true(c77790f)--incompatible_sandbox_hermetic_tmp=true(fe85936)--incompatible_merge_fixed_and_default_shell_env=true(8c191d8)--incompatible_multi_release_deploy_jars=true(36998c5)--incompatible_strict_conflict_checks=true(53035bf)--incompatible_use_host_features=true(93f2216)--incompatible_visibility_private_attributes_at_definition=true(0656103)--lockfile_mode=update(8ba6618)--java_language_version=""(f23440b)--remote_build_event_upload=minimal(bfdff54)--remote_download_outputs=toplevel(9c96529)--watchos_cpus=x86_64(0205bf7)--dynamic_local_strategynow includesstandalonewhen--experimental_local_lockfree_outputis set (40cf855)- Removed
--experimental_inmemory_jdeps_filesand--experimental_inmemory_dotd_filesfrom the expansion of--remote_download_minimaland--remote_download_toplevel(0d9e477) - Removed
--nobuild_runfile_linksfrom the expansion of--remote_download_minimal(24ba4fa)
Undeprecatedโ
Surprisingly, a flag was undeprecated in Bazel 7.0:
--allowed_local_actions_regex(a1dcaea)
No-opโ
These flags now do nothing, but still exist to allow for migration off of them:
- [6.2.0]
--use_workers_with_dexbuilder(765c0eb) - [6.3.0]
--experimental_use_fork_join_pool(30cf799) --action_cache_store_output_metadata(ec6ce5b)--android_databinding_use_androidx(6a19449)--android_databinding_use_v3_4_args(6a19449)--collapse_duplicate_defines(68a4780)--experimental_allow_android_library_deps_without_srcs(2c16f3f)--experimental_android_databinding_v2(6a19449)--experimental_collect_local_action_metrics(549254e)--experimental_collect_local_sandbox_action_metrics(549254e)--experimental_enable_aspect_hints(86d4f48)--experimental_genquery_use_graphless_query(b7678af)--experimental_parse_headers_skipped_if_corresponding_srcs_found(d4625cf)--experimental_require_availability_info(c02d128)--experimental_sandboxfs_map_symlink_targets(217fafe)--experimental_worker_as_resource(660f441)--high_priority_workers(8e359e7)--legacy_bazel_java_test(08d3187)--incompatible_auto_configure_host_platform(f95df42, 51396c3)--incompatible_disallow_symlink_file_to_dir(8d375a9)--incompatible_generated_protos_in_virtual_imports(3efaa32)--incompatible_remote_build_event_upload_respect_no_cache(fe97f20)--incompatible_remote_results_ignore_disk(c88f374)--incompatible_remove_rule_name_parameter(fcf6b79)--incompatible_require_javaplugininfo_in_javacommon(192702c)--target_platform_fallback(51396c3)--use_top_level_targets_for_symlinks(32df891)
Removedโ
--android_include_proguard_location_references(bbf11ed)--apple_bitcode(37b8e1b)--apple_compiler(1acdfc4)--apple_enable_auto_dsym_dbg(40ef6d3)--apple_grte_top(fb4106b)--compress_in_memory_genquery_results(554f309)--debug_print_action_contexts(737830a)--distinct_host_configuration(9c01a5a)--deduplicate_depsets(53ca28c)--dynamic_worker_strategy(2ca7c18)--experimental_allow_top_level_aspects_parameters(6b2ff30)--experimental_analysis_test_call(b747a4f)--experimental_android_local_test_binary_resources(6122700)--experimental_apple_mandatory_minimum_version(dbd9e18)--experimental_async_execution(6b2ff30)--experimental_availability_info_exempt(6b2ff30)--experimental_build_setting_api(d72760b)--experimental_cc_shared_library_debug(92e16da)--experimental_cpp_compile_argv_ignore_param_file(b34ea66)--experimental_enable_objc_cc_deps(51f45c4)--experimental_enable_target_export_check(1456361)--experimental_execution_graph_log(8ab9c6e)--experimental_execution_graph_log_cached(6b204c0)--experimental_execution_graph_log_missed(6b204c0)--experimental_execution_log_spawn_metrics(c0f2e14)--experimental_dynamic_execution_cpu_limited(6b2ff30)--experimental_dynamic_skip_first_build(6b2ff30)--experimental_includes_attribute_subpackage_traversal(1961b09)--experimental_java_proto_library_default_has_services(0c8b3ed)--experimental_keep_config_nodes_on_analysis_discard(6b2ff30)--experimental_lazy_template_expansion(61c31d2)--experimental_local_memory_estimate(6b2ff30)--experimental_multi_cpu(6b2ff30)--experimental_multi_threaded_digest(6b2ff30)--experimental_persistent_javac(7fe8fa2)--experimental_prioritize_local_actions(e45b8d4)--experimental_replay_action_out_err(6b2ff30)--experimental_repository_cache_urls_as_default_canonical_id(a6f8923)--experimental_repository_hash_file(176b07f)--experimental_sandboxfs_path(217fafe)--experimental_shortened_obj_file_path(6b2ff30)--experimental_show_artifacts(bdcd311)--experimental_skip_runfiles_manifests(2dc7375)--experimental_skyframe_include_scanning(205091e)--experimental_skymeld_ui(681a0c1)--experimental_supports_info_crosstool_configuration(1ebfb7d)--experimental_use_sh_binary_stub_script(f2d82c6)--experimental_verify_repository_rules(176b07f)--incompatible_avoid_conflict_dlls(e1eef7c)--incompatible_disallow_legacy_javainfo(606dac7)--incompatible_disable_cc_configuration_make_variables(20528af)--incompatible_disable_cc_toolchain_label_from_crosstool_proto(20528af)--incompatible_disable_crosstool_file(20528af)--incompatible_disable_depset_in_cc_user_flags(20528af)--incompatible_disable_expand_if_all_available_in_flag_set(ff37230)--incompatible_disable_legacy_cpp_toolchain_skylark_api(20528af)--incompatible_disable_legacy_flags_cc_toolchain_api(20528af)--incompatible_disable_managed_directories(20528af)--incompatible_disable_runtimes_filegroups(20528af)--incompatible_display_source_file_location(8c24877)--incompatible_disable_sysroot_from_configuration(20528af)--incompatible_disable_tools_defaults_package(20528af)--incompatible_disable_third_party_license_checking(ae40562)--incompatible_dont_emit_static_libgcc(20528af)--incompatible_enable_legacy_cpp_toolchain_skylark_api(20528af)--incompatible_force_strict_header_check_from_starlark(3f36464)--incompatible_genquery_use_graphless_query(58a44d4)--incompatible_linkopts_in_user_link_flags(20528af)--incompatible_load_cc_rules_from_bzl(65b5640)--incompatible_provide_cc_toolchain_info_from_cc_toolchain_suite(20528af)--incompatible_remove_cpu_and_compiler_attributes_from_cc_toolchain(0567176)--incompatible_require_feature_configuration_for_pic(20528af)--incompatible_use_platforms_repo_for_constraints(a7f7df3)--legacy_spawn_scheduler(f2c11f7)--print_workspace_in_output_paths_if_needed(f2c11f7)--remove_all_convenience_symlinks(002bd04)--resource_autosense(c6ba553)--show_warnings(53b0081)--toolchain_resolution_override(60a3c5b)--tvos_simulator_version(f2c11f7)--tvos_simulator_device(f2c11f7)--use_single_jar_apk_builder(669c8aa)--use_workers_with_dexbuilder(f2c11f7)--watchos_simulator_version(f2c11f7)--watchos_simulator_device(f2c11f7)
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 made it into Bazel since 6.0.
Below are some changes that weren't tied to any specific remote feature (e.g. gRPC connections):
- [6.2.0] Added the
--remote_retry_max_delayflag, which allows remote retry max delay to be user configurable. (060fea5) - [6.3.0] Added the
--experimental_circuit_breaker_strategy,--experimental_remote_failure_rate_threshold, and--experimental_remote_failure_window_intervalflags, which causes Bazel to stop using the remote cache or remote execution after a certain rate of failures. (5575ff2, 10fb5f6) - [6.4.0] The
digest_functionfield is now set as part of all relevant gRPC requests. (0a8380b) - [6.4.0] The stack trace is now included in all gRPC errors when
--verbose_failuresis set. (454f11d) - [6.4.0] SSL
BAD_DECRYPTerrors are now retried. (fb38c3a) - Optimized fetching of
ServerCapabilities. (35642f4, 0d36c6b) exec_propertiesis now used whenremote_execution_propertiesis empty. (6f24fa5)
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:
- [6.1.0] Added the
--incompatible_remote_use_new_exit_code_for_lost_inputsflag, which causes Bazel to exit with code 39 if the remote cache evicted blobs that Bazel needed. (99cff33) - [6.1.0] Background download progress is now reported in the UI. (0f524c6)
- [6.1.0] Bazel now cleans up stale metadata when it detects that remote cache blobs have been evicted. (963640a, 32e4f23, c05ba76)
- [6.1.0] When using a combined cache, the AC integrity check now applies to disk part as well. (5f2866f)
- [6.1.0] Fixed
--remote_download_minimalto work withbazel test. (e8182ce) - [6.2.0] Added the
--experimental_remote_cache_eviction_retriesflag, which automatically retries the build if it encounters a remote cache eviction error. (24b4589) - [6.2.0] All remote metadata is now cleared if any blobs are detected as evicted from the remote cache. (49a9502)
- [6.2.0] Removed
action_idmetadata from prefetched inputs. (f62a8b9) - [6.2.0]
ALREADY_EXISTSwhen uploading is now treated as a success. (daa3dbe) - [6.2.0] Improved the upload early return logic. (50ec6bb)
- [6.2.0] Fixed failures creating output directories. (4050120)
- [6.3.0]
--experimental_remote_cache_eviction_retriesis now disabled if--invocation_idis set. (d9b94cb) - [6.2.0] Output symlinks are now gracefully handled when using Build without the Bytes. (ca30372)
- [6.3.0] The
prefetecheraction_idmetadata is now set for prefected inputs. (3b39ab8) - [6.3.0] Fixed local action non-declared symlink issue when using Build without the Bytes. (5c4cf47)
- [6.3.0] Fixed a potential memory leak in the UI. (ce8836d)
- [6.4.0] Added the
--experimental_remote_require_cachedflag, which fails the build if any remotely cachable actions aren't cached. (22f518c) - [6.4.0] Added support new-style digest functions. (88412ce)
- [6.4.0] Added support for multiple digest functions. (f8c8875)
- Added the
--incompatible_disallow_unsound_directory_outputsflag, which disallows materializing an output file as a directory. (77f8603) - Added the
--remote_download_allflag, which is similar to the--remote_download_{toplevel,minimal}flags. (d097b5d) - Added the
--experimental_remote_cache_ttlflag, which causes old blobs to be considered potentially evicted from the remote cache. (1ebb04b) - Added the
--experimental_remote_cache_lease_extensionflag, which causes a background thread to periodically sendFindMissingBlobsrequests to the remote cache during a build. (1a2b792) - Added the
--experimental_remote_scrubbing_configflag, which allows scrubbing remote cache keys for locally run actions. (24de276) - Build without the Bytes now works without setting the
--experimental_inmemory_*_filesflags. (ba5e617) - Changing
--remote_download_modeno longer invalidates the analysis cache. (d426b3d) - HTTP remote cache failures are now retried. (6115d94)
- If the remote cache is unavailable at the start of the build, it will now automatically fall back to local execution. (0d36c6b)
- Tree objects are now emitted in topological order. (c20d7ed)
- The mtime is now updated on files stored or retrieved from the disk cache. (7a774ff)
- Fixed
--experimental_remote_download_regexto work in incremental builds. (20552d8) - Fixed Build without the Bytes when using multiple source roots. (de4746d)
- Fixed prefetching symlinks. (0a1d505)
- Fixed runfile symlink handling when using Build without the Bytes. (fb76e6e)
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:
- [6.1.0] Added the
--experimental_remote_discard_merkle_treesflag, which discards in-memory copies of the input root's Merkle tree and associated input mappings during calls toGetActionResultandExecute. (4069a87) - [6.1.0] Made Bazel more responsive and use less memory when
--jobsis set to a high value. (4069a87) - [6.1.0] Fixed handling of remote cache eviction when uploading inputs. (c1168e1)
- [6.2.0] Optimized building Merkle trees. (f63ce79, 6d6fa81)
- [6.2.0] Tree artifacts are now included in the Merkle cache. (0f55d12)
- [6.3.0] Added support for
output_symlinksinActionResult. (e842fd5, d3fb047) - [6.3.0] Remote symlink outputs are now supported when using building without the bytes. (0ff6b88)
- [6.4.0] The
no-remote-execexecution requirement is now part of the action salt. (5a23ab2)
Dynamic executionโ
Dynamic execution allows for Bazel to race remote and local execution of actions, potentially allowing you to get the benefit of both modes, without the drawbacks of either. Bazel 7.0 only included a single notable user-facing change to dynamic execution:
- Added the
--experimental_dynamic_ignore_local_signalsflag, which allows local failures under dynamic execution to be ignored for exit codes > 127 (signals). (07ee4b7)
Build Event Service (BES)โ
Using a build event service can give you unparalleled insight into your Bazel builds at scale. There were a couple nice changes to BES support:
- [6.1.0] stdout and stderr logs are now uploaded when using
--experimental_remote_build_event_upload=minimal. (17b8e44) - [6.1.0] When using
--experimental_remote_build_event_upload=minimal,bytestream://is always used for BEP referenced files. (b0c5eb3) - Added the
--bes_system_keywordsflag, which allows specifying non-prefixed notification keywords. (8daa3dc) - Added the
--build_event_{binary,json,text}_file_upload_modeflags, which specify the upload mode to use for each file type. (ca62ca1)
Loggingโ
Bazel offers various methods to gain insight into your build. I cover some of the notable changes to those methods below.
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, --build_event_binary_file, and --build_event_text_file.
The vast majority of changes added additional information to the BEP, though some are fixes and improvements:
- [6.3.0] Added the
action_cache_statisticsfield toBuildMetrics.ActionSummary. (7963528) - Added the
end_time,start_time, andstrategy_detailsfields toActionExecuted. (2ddacab) - Added the
exec_kindfield toBuildMetrics.ActionSummary.RunnerCount. (0e1d1b6) - Added the
execution_phase_time_in_msfield toBuildMetrics.ActionSummary.TimingMetrics. (be63eee) - Added the
package_load_metricsfield toBuildMetrics.ActionSummary.PackageMetrics. (0597a07) - Added the
symlink_target_pathfield toFile. (7fa5796) - Added the
system_timeanduser_timefields toBuildMetrics.ActionSummary.ActionData. (5f1a570) - Added the
worker_idsfield toBuildMetrics.WorkerMetrics. (d31dd09) - Added the
worker_key_hashfield toBuildMetrics.WorkerMetrics. (58eeea1) - Added the
worker_pool_metricsfield toBuildMetrics. (284e5a3) - Added the
CoverageActionsFinishedIdevent. (c2a6f0c) - Added the
ExecRequestevent. (9a047de) - Added the
TestProgressevent. (d8b8ab0) - Added the
--experimental_publish_package_metrics_in_bepflag, which populates theBuildMetrics.ActionSummary.PackageMetrics.package_load_metricsfield. (0597a07) - Added the
--experimental_run_bep_event_include_residueflag, which populates theExecRequest.argvfield. (9a047de, dab6383) - Deprecated the
worker_idfield inBuildMetrics.WorkerMetrics. (d31dd09) - Fixed Starlark flags set in
.bazelrcfrom appearing inUnstructuredCommandLine. (f272df3)
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:
- [6.1.0] Added the
bazel_versionfield tootherData. (7569b0d) - [6.2.0] Added the
profile_finish_tsfield tootherData. (dbc8423) - [6.4.0] Added profiling of Bzlmod operations. (e7cfd2e, 8a68310)
- Added local action cache hits as a stacked chart. (610b56f)
- Added the
--experimental_collect_pressure_stall_indicatorsflag, which adds Linux PSI data to the profile. (50446bc) - Added the
--experimental_collect_resource_estimationflag, which adds CPU and memory estimation profiling. (2e2f5d9) - Added the
ANALYZE_AND_EXECUTE(interleaved loading, analysis and execution) phase. (78140bf) - Added profiling of checking outputs. (df3d00a)
- Added profiling of execution log creation, writing, and sorting. (c2e25ea)
- Added profiling of long wait times for cancelling the other branch in dynamic execution. (9f2cc56)
- Added profiling of network handshakes. (bf9b177)
- Added profiling of symlink tree creation and deletion. (f84329e)
- Doubles are now used instead of strings for counter series. (6d1dd4e)
REMOTE_DOWNLOAD(remote output download) now has a 10ms threshold. (b8e2c5f)- Extended the span of checking action cache hits to include all of the work and not only the actual cache lookup. (df3d00a)
- Removed
taskId. (bf2368a) - Fixed local execution to use
LOCAL_PROCESS_TIME(Local execution process wall time) instead ofREMOTE_PROCESS_TIME(Remote execution process wall time). (480b234)
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 few noticeable changes:
- [6.1.0] Added the
--execution_log_sortflag, which allows disabling execution log sorting. (1a6ffe6) - [6.4.0] Added the
is_toolfield toFile. (0434287) --execution_log_json_fileand--execution_log_binary_fileare now mutually exclusive. (61fa933)- Renamed the
remote_cache_hitfield inSpawnExectocache_hit. (60dbc64) - Removed the
progress_messagefield fromSpawnExec. (0ca0510) - Removed the
walltimefield fromSpawnExec. (60e03bf)
Execution graphโ
The execution graph,
which is enabled with the --experimental_enable_execution_graph_log flag,
logs all actions executed during a build.
It differs from the execution log in that it contains additional information needed to reconstruct the full dependency graph.
Even though there aren't many changes to the execution graph in Bazel 7.0, I only recently learned about its existence, and wanted to call attention to it:
- Added the
discover_inputs_millisfield toMetrics. (0e099d9) - Added the
--experimental_execution_graph_enable_edges_from_filewrite_actionsflag, which adjusts how filewrite action edges are handled. (4973166) - Added the
--experimental_enable_execution_graph_logand--experimental_execution_graph_log_pathflags, which replace the--experimental_execution_graph_logflag. (8ab9c6e) - The execution graph is now written to the output base instead of the workspace. (b5808a4)
- Shared actions are now included in the execution graph. (2036a0f)
- Test actions no longer output an extra node. (c3260c4)
Otherโ
- [6.3.0] Changed
--memory_profile_stable_heap_parametersto accept more than one GC specification. (3dc6951) - Added the
--experimental_command_profileflag, which records a Java Flight Recorder CPU profile into aprofile.jfrfile in the output base. (5cbb153)
Executionโ
Executing build commands is a primary function of Bazel. Some execution related changes can be classified in a particular way, such as remote execution or dynamic execution. For the rest, I've collected them here.
Below I summarize some foundational execution related changes, including "local execution" strategies:
- [6.1.0] Added the
--experimental_writable_outputsflag, which causes the permissions of all output files to0755instead of0555. (88c426e) - [6.1.0] Added the
--local_extra_resourcesflag, which allows specifying additional resource types that can limit concurrently running actions. (2b2bea4) - [6.1.0] Fixed symlink creation overhead. (c15148a)
- [6.2.0] ctime is now used in file digest cache keys. (763f1d9)
- [6.2.0] Optimized file checksumming. (368bf11)
- [6.3.0] Adjusted
--top_level_targets_for_symlinksto work in more cases. (ceb9955) - [6.4.0] Added the
--allow_analysis_cache_discardflag, which when false causes the build to fail if the analysis cache would be discarded. (1997f09) - [6.4.0] Added the
blake3option to--digest_function. (cc49d68) - [6.4.0] Added the
diff_against_dynamic_baselineoption to--experimental_output_directory_naming_scheme. (39b450c) - [6.4.0] Added the
FORMATTED_DATEentry to the volatile workspace status file. (ee36d32) - Added a
forced=koption to--test_sharding_strategy. (bd5f3c3) - Added the
--experimental_gc_thrashing_limitsand--gc_thrashing_limits_retained_heap_limiter_mutually_exclusiveflags, which causes Bazel to trigger an OOM crash when too much garbage collection thrashing happens. (9f93780) - Added the
--experimental_throttle_action_cache_checkflag, which throttles action cache checks. (3d29b2e) - Added the
--experimental_skymeld_analysis_overlap_percentageflag, which limits amount of analysis phase and execution phase overlap. (9adbe0f) - Added the
--experimental_use_semaphore_for_jobsflag, which limits the number of concurrent action execution with a semaphore. (a83a97e) - Added the
--skip_incompatible_explicit_targetsflag, which skips incompatible targets that are explicitly listed on the command line. (136a1ee) - Actions can now opt into path mapping with the
supports-path-mappingexecution requirement. (a239ea8) --flag_aliascan now be set oncommonandalways. (86fe599)- Elevated the
analysis cache discardedmessage fromINFOtoWARN. (0a47a1f) - Normalized
--action_env,--flag_alias,--host_action_env, and--test_envvalues. (4dc5de8) 0755instead of0777is now used when creating a writable directory. (ff0e61a, 4da0642)- Optimized computing digests from the filesystem. (e2a57ac)
- When using
--experimental_merged_skyframe_analysis_execution, symlinks aren't planted for paths in.bazelignore. (e1fbc83) - When using
--subcommandsthe mnemonic is now reported. (afa2500) - Removed the
sandboxfsstrategy. (217fafe) - Fixed
--reuse_sandbox_directoriesto work with differently-named workspaces. (2dc5ba9) - Fixed encoding of non-ascii contents written to parameter files. (dc80fa7)
- Fixed state tracking for actions that run under multiple strategies. (d46aed6)
- Fixed docker strategy
GIDclash. (4082e0f)
Running and testingโ
In addition to building targets,
Bazel can run applications and tests with the run and test commands.
Here were some notable changes to that functionality:
- [6.1.0] Non-test actions are no longer reported as tests in the UI. (fcb0077)
- [6.1.0] Non-started tests now count as skipped. (16427c9)
- [6.2.0]
SIGWINCHis now correctly handled whenbazel run-ing test rules. (38ece3c) - [6.2.0] Fixed missing output from quick tests run with
bazel run. (c04f0d4) - [6.3.0] Added the
--incompatible_check_sharding_supportflag, which will fail sharded tests that don't touch theTEST_SHARD_STATUS_FILEfile. (f7d795a) - [6.3.0]
test-setup.shnow raises a signal on exit codes above 128. (90c4bdf) - [6.4.0] Runfiles related environment variables are now cleared when using
bazel run. (bc83389) - [6.4.0] When
--test_summary=detailedis used, passing methods are now also included in the test summary. (c75fda9) - Added the
--runflag, which if false prevents bazel from running the built executable. (6069512) - Added the
//command_line_option/fragment:testoption for thetransitive_configsattribute. (6bd7878) - Made
--experimental_inprocess_symlink_creationwork with--nobuild_runfile_links. (7b87ae1) - When switching from
--enable_runfilesto--noenable_runfilesthe previous runfiles symlink tree is now cleaned up. (f84329e) - Fixed incrementality issues related to runfiles and a changing
--output_base. (c9d7ff9)
Coverageโ
Bazel can collect code coverage when running tests. Recent changes made the default settings work for more people:
- [6.1.0]
bazel coveragenow works with--remote_download_minimal. (e8ff51f) - [6.1.0]
@remote_coverage_toolsis now only fetched when collecting coverage. (4d188a9) - [6.1.0] Fixed LLVM coverage collection for source file paths with a
tmpsegment. (88b51f5) - [6.3.0] Added the flag
--experimental_collect_code_coverage_for_generated_files, which collects code coverage for generated files. (9c83049) - [6.3.0] Added the
metadata_filesparameter to thecoverage_common.instrumented_files_infofunction. (ef54ef5) - [6.3.0]
--experimental_split_coverage_postprocessingnow works in combination with--experimental_generate_llvm_lcov. (9d3b375) - [6.3.0] Fixed
json.gzcheck to not rely ongcov --version. (7f628d7) - The
CoverageReportaction now uses theno-remoteexecution requirement instead oflocal. (188b4ef) - The
coverage_support_filesparameter on thecoverage_common.instrumented_files_infofunction now acceptsFilesToRunProviderarguments. (062b83f) - Fixed coverage combining to happen after exclusive tests have run. (6eb7dbb)
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 the
--experimental_shrink_worker_poolflag, which shrinks the worker pool if memory pressure gets too high. (dce697d) - Added the
--experimental_worker_allowlistflag, which specifies which mnemonics can use persistent workers. (85dcafe) - Added the
--experimental_worker_memory_limit_mbflag, which kills workers using more than a given amount of memory. (8d1db5b) - Added the
--experimental_worker_metrics_poll_intervalflag, which allows changing the interval between collecting worker metrics and possibly attempting evictions. (a95847c) - Added the
--experimental_worker_sandbox_hardeningflag, which uses the linux sandbox for worker sandboxing. (6669a4f) - Removed support for high priority workers. (8e359e7)
Queryingโ
Here are some changes that were made to the query family of commands,
starting with ones that applied to more than one of the commands:
- [6.2.0] The
aqueryandcquerycommands now respect the--query_fileflag just like thequerycommand. (fb23246) - [6.4.0] Added the
--consistent_labelsflag, which forces consistent label formatting across all output modes that is also compatible withstr(Label(...))in Starlark. (20cdacc) - Added the
--proto:include_attribute_source_aspectsflag, which includes a new fieldsource_aspect_nameto theAttributemessage that indicates the source aspect that the attribute comes from. (5c7a159) - Added a filter in
cquery/aqueryto skip targets with mismatched configurations. (a2bd3ef) label_flagandlabel_settingvalues now consider defaults. (658b3a6)
queryโ
- [6.3.0] Added
jsonprotooption to the--outputflag. (a94383f) - [6.3.0] Fixed
--output=proto --order_output=depsnot returning targets in topological order. (2ff87be) - [6.4.0] Renamed
--output=jsonprototostreamed_jsonprotoand made the format valid ndjson. (2cd583a) - Duplicates in
<rule-inputs>when usingquery --output=xml --aspect_deps=preciseare removed. (5c7a159)
cqueryโ
- [6.2.0] Added support for
aliastargets to theprovidersfunction. (156325e) - Added the
streamed_protooption to the--outputflag. (aa88357) - Starlark transitions now have full fidelity in
cquery. (9575c7f) cquery --output=starlarknow respectsBuildLanguageOptions. (1447f24)
aqueryโ
- [6.1.0] The effective environment is now printed for for all
CommandActions. (2ae409b) - Added
streamed_protooption to the--outputflag. (8490321) - Added the target paths of
UnresolvedSymlinkactions. (df82dcd) - Added whether or not a
FileWriteaction's output is executable. (abac1c6) - Added
RepoMappingManifestto the set of files that--include_file_write_contentsaffects. (604a9ef) - Removed duplicate printing of
ExecutionInfo. (dd3b0ec)
Dependency managementโ
With Bazel 7.0 external dependencies can be managed either with Bzlmod or the WORKSPACE file.
Here are some changes that apply to either method:
- [6.1.0] Improved readability of human-readable download progress. (66b58ee)
- [6.1.0] Repository fetch progress is now reported during main repo mapping computation. (51e6c38)
- [6.3.0] Added the
archive_typeattribute tohttp_archive. (c7695ce) - [6.3.0] Download progress now includes a percentage complete if possible. (6ffff17)
- [6.3.0] Hash strings can now contain uppercase characters. (cc8ecc5)
- [6.4.0] Fixed handling of non-ASCII characters in archive entry file names. (10169bb)
- [6.4.0] Generated patches files now use
\nfor line endings on all platforms. (07e0d31) - Added support for
.tbzfiles in therepository_ctx.download_and_extractfunction. (6e01b25) - Added the
--experimental_worker_for_repo_fetchingflag, which allows fetching repositories using a worker thread. (1590dbc) - Added the
--http_connector_attemptsand--http_connector_retry_max_timeoutflags, which makes connection retry attempts and timeout configurable. (f29db1b) .gitdirectories are now deleted fromgit_repositoryexternal repositories when usingstrip_prefix. (2977ba6)- Extended
--unix_digest_hash_attribute_nameto also work in the repository cache. (87d6e9a) - HTTP 429 (Too Many Requests) errors are now retried. (4ed6a2f)
- URLs are now used as default canonical IDs in common repo rules. (a6f8923)
Bzlmodโ
With Bazel 7.0 Bzlmod is enabled by default. While Bzlmod was made non-experimental in Bazel 6.0, the minor releases contained a lot of additional quality-of-life and feature improvements:
- [6.1.0] Tildes are now acceped in
--override_module. (094a0aa) - [6.2.0] Added the
--lockfile_modeflag, which controls how the bzlmod lockfile is generated and checked. (3b11a2f) - [6.2.0] Added the
dev_dependencyattribute toregister_execution_platformsandregister_toolchains. (f39454f) - [6.2.0] Added the
is_dev_dependencyattribute tomodule_ctx. (1a719ce) - [6.2.0] Added the
extension_metadataattribute tomodule_ctx. (6a47481) - [6.2.0] Added the
max_compatibility_levelattribute tobazel_dep, which allows version selection to upgrade a dependency up to the specified compatibility level. (152a001) - [6.2.0] Added support for relative paths in
--override_module. (f7627e0) - [6.2.0] Fixed an issue where WORKSPACE and WORKSPACE-loaded .bzl files couldn't see the Bzlmod root module's mappings when Bzlmod is enabled. (dfdf63a)
- [6.3.0] Added the
root_module_has_non_dev_dependencyattribute tomodule_ctx. (640e850) - [6.3.0] Added the
showcommand tobazel mod. (1ae56c2) - [6.3.0]
REPO.bazelandMODULE.bazelfiles are now considered workspace boundary markers. (f93b2f3) - [6.3.0] Overrides specified by non-root modules no longer cause an error, and are silently ignored instead. (78cb7d5)
- [6.3.0] The canonical repo name of the
platformsmodule is now forced to beplatforms. (343ab03) - [6.3.0] Renamed
modquerycommand tomod. (f6c2ef9) - [6.3.0] Yanked module versions no longer contribute dependency requirements or emit
DEBUGmessages forprint()statements. (2a2a474) - [6.4.0] Added the
environattribute tomodule_extension. (64554a3) - [6.4.0] Added the
--experimental_isolated_extension_usagesflag, which enables theisolateparameter ofuse_extension. (19a9710, 3a4b04f) - [6.4.0] Builtin modules are now injected at the end of the
MODULE.bazelfile. (0e58b0d) - [6.4.0] Release candidates are now considered equivalent to the actual release for
module.bazel_compatibility. (21cd4ef) - [6.4.0] Optimized computing root repository mapping. (8a68310)
- [6.4.0] Optimized memory usage. (74aadb2)
- [6.4.0] Optimized registry downloading. (8337dd7)
- Added the
--allflag to thefetchcommand. (0356a3f) - Added the
--repoflag to thefetchcommand. (9a1d385) - Added support for the
use_repo_ruledirective inMODULE.bazelfiles. (ab016be) - All labels in Bazel error messages, log output, Build Event Protocol, etc. are now prefixed with
@@instead@where applicable, to properly denote that they contain canonical repo names. (c456082) - Optimized CPU usage. (57b0bd7)
Platformsโ
Platforms are where your build tools run (i.e. execution platforms) or where your built products will run (i.e. target platforms). In previous years I catagorized changes along those lines, but this year I'm not making that distinction.
Androidโ
- Continued progress on Starlarkifying the Android rules
- [6.1.0] Made desugar dependencies deterministic. (a306f4f)
- [6.1.0] Fixed multiplexed workers for busybox tools. (8b1521e)
- [6.2.0] Added test coverage support to
android_local_test. (6bd2cc3) - [6.2.0] Fixed worker and multiplex workers for
DexBuilderandDesugaractions. (765c0eb) - Added the
--experimental_persistent_aar_extractorflag, which uses persistent workers for aar extractors. (74bc046) - Added the
--optimizing_dexerflag, which allows specifying a binary to use to do dexing without sharding. (9337dfe) - Added the
bazel_androidfragment. (bd0f9b0) - Added the
dexdumptool toandroid_sdk_repository. (773b50f) - Added the
dexdumpattribute toandroid_sdk. (1e4b275) - Added persistent worker support for
GenerateDataBindingBaseClasses. (9092e29) - Added persistent worker support for
ProcessDatabinding. (9092e29) - Added support for
R.txtfiles generated withaapt2 link --package-id. (41f894f) - Added support for optimizers rewriting baseline profiles. (5391486)
AndroidDataBindingProcessingActionnow emits deterministic zip file timestamps. (10af780)- Made
AndroidInstallactions hermetic with respect to dex shards. (2b104c8) - The
--no_proguard_location_referenceflag is now added unconditionally to the command line ofaapt2. (7d911b5) - The default Android SDK toolchain is now registered first. (9be1e9b)
- Baseline profile wildcards are now expanded before optimizer tools see them. (52c3566)
- Removed support for Databinding v1. (6a19449)
Appleโ
- [6.1.0]
xcrunis now used to invokeinstall_name_tool. (8ec8743) - [6.1.0] Dropped support for macOS versions prior to 10.13. (43dadb2)
- [6.2.0] Patched
zlibto fix compatibility with latest Xcode. (1f2b3ed) - [6.3.0] Bumped
default_macos_sdk_versionto10.11. (86ef4f4) - [6.4.0] Added initial visionOS support. (c113e62)
- [6.4.0] The
xcode_autoconfrepository rule will now re-run when theDEVELOPER_DIRorXCODE_VERSIONenvironment variable changes. (19979e6) - [6.4.0] Removed the
-sflag fromlibtoolinvocation. (ae7cfa5) - Added
-dead_striptooptlinker flags. (1da8a82) - Added the
extra_requested_featuresandextra_disabled_featuresparameters to theapple_common.link_multi_arch_binaryfunction. (1f8951c) - Linker framework arguments now use the two-argument form (e.g.
["-framework", "UIKit"]instead of["-Wl,-framework,UIKit"]). (32fb0a2) - Moved Apple toolchain setup to apple_support. (699e403)
xcode_autoconfnow usedconfigure = Trueinstead oflocal = True. (c747ae7)xcrunwrapperis no longer used for theObjcBinarySymbolStripaction. (80621fd)- Removed
apple_common.multi_arch_split. (a76763c) - Removed
apple_common.apple_crosstool_transition. (534e6f8) - Removed
darwinas a--cpuvalue. (d1b4fb7) - Removed bitcode support. (37b8e1b)
- Removed the use of
-undefined dynamic_lookup. (4853dfd)
Linuxโ
- [6.3.0]
--local_termination_grace_secondsis now used when testing sandbox availability. (d0e19ae) - Added the
--experimental_sandbox_memory_limitflag, which allows setting per-sandbox memory limits. (03996c1) .bazelignorepaths on Linux are no longer watched for changes. (4dabe43)- Bazel's local CPU resource on Linux is now container aware. Use
--local_cpu_resources,--loading_phase_threadsor--jobsto override. (ab2953c)
Windowsโ
- [6.1.0] The
archive_param_filefeature is now enabled by default for Windows. (bb0b886) - [6.1.0] Fixed
--nozip_undeclared_test_outputson Windows. (cd10d50) - [6.2.0] C++ deps pruning is now enabled on Windows when PARSE_SHOWINCLUDES is available. (788801a)
- [6.3.0] Fixed VS 2022 autodetection. (cd33d14)
- [6.4.0] Compilation actions using the auto-configured MSVC toolchain are forced to emit error messages in English if the English language pack for Visual Studio is installed. (0f10359)
- [6.4.0] Fixed Bash runfiles failure when the output base contains uppercase letters. (ea4ab7d)
- Added the
external_include_pathsfeature to the windows cc toolchain. (850b334) .bazelignorepaths on Windows are no longer watched for changes. (4dabe43)- The execution platform, instead of the host platform, is now used to decide whether to do Windows-specific things in a few places. (2f0948b)
- The arm64 version of the embedded JDK is now used for Windows ARM64. (b43418d)
- Enabled the
compiler_param_filefeature in the Windows MSVC toolchain. (d47a410) - Removed forced link to
clang_rt.builtinsin the Windows MSVC toolchain. (761b280) - Fixed
launcher_makerto work with long paths on Windows. (33fed24)
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.
Bashโ
- [6.1.0] Fixed
runfiles_current_repositorywith RBE. (497b7e4) - [6.1.0] Fix root symlink edge case in runfiles library. (dd24a00)
- Fixed runfiles calling repository lookup for directly run scripts. (da1a6d7)
C and C++โ
- Continued progress on Starlarkifying C/C++ rules. (starlarkification roadmap)
- [6.1.0] Added support for
.pydextensions. (073f54b) - [6.1.0] Added support for
.wasmextensions. (de062a6, 4b6f014) - [6.1.0] Added the sanitizer features to
unix_cc_toolchain_config. (abae5ca) - [6.1.0] The exec transition is now applied to
lcov_mergerinsh_testandcc_test. (37953c5) - [6.1.0] The
cc_shared_library.rootsattribute was renamed todeps. (68aad18) - [6.1.0]
libtoolis no longer hardcoded when using the unix cc toolchain. (3c47b47) - [6.1.0] Removed the
-O1flag from sanitizer feature flags. (e132653) - [6.1.0] Removed the
static_depsattribute fromcc_shared_library. (9815b76) - [6.2.0] Exposed
cc_proto_aspectas a toplevel symbol. (2aa06cf) - [6.3.0] Added the
force_no_whole_archivefeature, which force disables--whole-archive. (661ebef) - [6.3.0] Added the
additional_compiler_inputsattribute tocc_library. (ade32e6) - [6.3.0] Added the
CcSharedLibraryHintInfoprovider. (dbb09c9) - [6.3.0] File extensions are case sensitive again. (e4990f8)
- [6.3.0] Unused targets listed in
cc_shared_library.dynamic_depsare now linked. (ba5c740) - [6.3.0]
cc_binarytargets withdynamic_depsattributes no longer link indirectdynamic_depson Unix. (95ae4db) - [6.3.0] Added the
exclude_bazel_rpaths_in_transitive_libsandlink_indirect_dynamic_deps_in_binaryfeatures. (95ae4db) - [6.3.0] Removed
cc_shared_library_permissions. (adfd4df) - [6.3.0] Removed the
preloaded_depsattribute fromcc_shared_library. (3b7e233) - [6.3.0] Fixed the
cc_shared_libraryaspect to propagate along all attributes. (590ee17) - [6.3.0] Fixed the order of linker inputs in
cc_binaryandcc_shared_library. (a772452) - [6.3.0] Fixed rpath for symlinks in
cc_shared_library. (044a14c) - [6.3.0] Fixed
cc_shared_libraryto take into account unusedCcInfos. (b6b9eec) - [6.3.0] Fixed
cc_shared_libraryto take into account indirect top level deps. (f9008f6) - [6.3.0] Fixed
exports_filterincc_shared_library. (bc33ac2) - [6.4.0] Added the
additional_linker_inputsattribute tocc_library. (0589995) - [6.4.0] Debug info context is now collected from the
cc_library.implementation_depsattribute. (e55fee2) - [6.4.0] Data dependencies are now propagated through the
cc_library.implementation_depsattribute. (56e9020) - [6.4.0]
c++14is now used as the default C++ standard. (978cd23) - Added auto-configured Unix toolchain support for
BAZEL_CONLYOPTS. (b272cef) - Added a feature definition for
static_link_cpp_runtimesto the unix cc toolchain config. (6c7147b) - Added support for optional toolchains to
find_cpp_toolchain. (6b126d6) - Added the
external_includesattribute tocompilation_context. (a6ef0b3) - Added the
validates_layering_check_in_textual_hdrsfeature, which skips theparse_headersaction. (8ef60d0) - Added the
prefer_pic_for_opt_binariesfeature, that indicates that PIC compiles are preferred for binaries even in optimized builds. (4084671) - Added the
--memprof_profileflag, which allows passing an LLVM MemProf toCppCompileactions. (617a3bd) - Added the
--@bazel_tools//tools/cpp:link_extra_libsflag, which allow. (9f2c62a) - Added the
link_extra_libattribute tocc_binarys specifying extra libraries to be linked into every binary. (5eff703) - Added the
module_filesoutput group, which enables building PCMs fromcc_librarytargets directly. (9b30bf7) - Added support for
expand_if_availabletoenv_entry. (cc335fd) - Added the
use_lto_native_object_directoryfeature, which adds tree artifact support to thethin_ltofeature. (db34798, 480c8c8) - Added a tool name for
objcopy. (2d1f37d) cc_testcan now be configured by using anative.toolchain(). (99b672b)--crosstool_topis now unset when--incompatible_enable_cc_toolchain_resolutionis set. (0013115)--fdo_optimizeno longer accepts a relative path. (afe070e)- C++ branch coverage is now enabled when using gcov 8 or later. (57ae1ff)
- The
BAZEL_CURRENT_REPOSITORYpreprocessor variable is now only set during compilation if the target depends on the runfiles library viadepsorimplementation_deps. (1b214d2) - The
includesparameter in thecc_common.compile()function now accepts depsets as well as lists. (c8d6c11) - Made
generate_system_module_map.shmore deterministic. (78f98e7) - Moved
CcSharedLibraryHintInfoto cc_common. (b1c2e8d) libstdc++(libc++on macOS) andlibmare no longer linked in if none of their symbols are referenced, e.g., in a pure C target. (2482322)- When building C++ modules, FDO variables and profile inputs are no longer added. (edeb037)
- Relocatable object files are no longer wrapped in
-Wl,-whole-archive-Wl,-no-whole-archive. (61267b3) - Removed the
cc_host_toolchain_aliasrule. (3543b19) - Removed the
grep_includesparameter fromcc_commonfunctions. (b82e202)
Javaโ
- Continued progress on Starlarkifying Java rules. (starlarkification roadmap)
- [6.1.0] Coverage can now be collected for external targets. (00e9af1)
- [6.1.0] Fixed coverage collection with the Java 8 runtime. (c266651)
- [6.1.0] Fixed
--experimental_java_classpath=bazel. (ac504cb) - [6.2.0] Added the
versionattribute tojava_runtimeandJavaRuntimeInfo. (7556e11) - [6.2.0] Added
-Xep:IgnoredPureGetter:OFFto defaultjavacopts. (3b57894) - [6.2.0] Added
-Xep:LenientFormatStringValidation:OFFto defaultjavacopts. (33a3b01) - [6.2.0] Added
-Xep:ReturnMissingNullable:OFFto defaultjavacopts. (e80ca15) - [6.2.0] JVM warnings are now redirected to stderr. (abea37b)
- [6.3.0]
local_java_repositorynow sets theversionattribute ofjava_runtime. (1c1584b) - [6.3.0]
ijarnow handles dynamic constants. (69d2991) - [6.4.0] Added a toolchain type for the Java bootstrap runtime. (8715e9a)
- [6.4.0] Optimized classpath pre-processing in
java_stub_template.txt. (4e8f0bd) - Added
-Xep:EmptyTopLevelDeclaration:OFFto defaultjavacopts. (8d9a06e) - Added the
bootclasspathparameter to thejava_common.compilefunction. (a75f516) - Added the
default_cdsattribute tojava_runtimeandJavaRuntimeInfo. (53ff268) - Added the
exec_compatibility_withandtarget_compatibility_withattributes tolocal_java_runtimeanddefault_java_toolchain. (27fe30b) - Added the
ijarattribute toJavaToolchainInfo. (0dd6a49) - Added the
proguard_allowlisterattribute toJavaToolchainInfo. (8b9e8d5) - Added the
javac_options_listattribute tocompilation_info. (ea154dc) - Added the
--incompatible_disable_non_executable_java_binaryflag, which removes thecreate_executableattribute fromjava_binary. (d12c7fa) - Added the
--incompatible_java_info_merge_runtime_module_flagsflag, which causes theJavaInfoconstructor to mergeadd_exportsandadd_opensofruntime_depsin addition todepsandexports. (e2249f9) - Added the
--build_targetflag tosinglejar, which allows changing thebuild.targetproperty when stamping is enabled. (a1a5f33) darwin_x86_64anddarwin_arm64now have separatejava_toolsreleases. (3b475b3)java_stub_template.txtis now exported from@java_tools//jdk. (1465771)- The
--experimental_local_java_optimization_configurationflag now only accepts a single-label. (6e3a421) - Proto toolchains are now used in
java_lite_proto_library. (8c38be3) - Proto toolchains are now used in
java_proto_library. (51970d2) - Optimized
java_common.mergememory usage. (8ffb972) - Upgraded default
java_toolchain.java_runtimeto JDK 17. (75e0f7d) - Replaced remote JDK 18 with JDK 20. (19b2e2f, 0e8e611, 7ff98ba)
- Removed the
transitive_depsandtransitive_runtime_depsattributes fromJavaInfo. (72058be) - Removed deprecated targets from
@java_tools//jdk. (844b5d2) - Fixed proguard output map symlink when
proguard_specsis aselect(). (c2761af)
Objective-Cโ
- [6.3.0] Added the
implementation_depsattribute toobjc_library. (ae7b9c5) - [6.4.0] Added the
--incompatible_disable_objc_library_transitionflag, which removesobjc_libary's custom transition. (0f34e76) - Added the
target_should_alwayslinkattribute to theobjcfragment. (c878b59, 3c0f394) - Added the
--incompatible_disallow_sdk_frameworks_attributesflag, which disallows thesdk_frameworksandweak_sdk_frameworksattributes inobjc_libraryandobjc_import. (66121a7) - Added the
--incompatible_objc_alwayslink_by_defaultflag, which changes the default ofobjc.target_should_alwayslinktoTrue. (a8b36c1) - Added the
--incompatible_objc_provider_remove_linking_infoflag, which removes linking information fromObjcProvider. (3e170fb) - The
apple_common.new_executable_binary_providerandapple_common.new_dynamic_framework_providerfunctions no longer require theobjcargument. (28f9056) - The
variables_extensionparameter on theapple_common.link_multi_arch_binaryfunction can now beNone. (87bd420) objc_commonno longer sets linking information inObjcProvider. (0fa7933)- Linking no longer uses
ObjcProviderinformation. (426f225) - Linking features, in addition to linkopts, are considered when determining the stripping type. (3a31a6c)
- Tree artifacts in source attributes of
objc_librarycan now have arbitrary extensions. (280ae1a) - Removed the
runtime_depsattribute fromobjc_library. (3ea60b7) - Removed the
objc_archiveaction (cpp_static_libraryis used instead). (e1cb203) - Removed the
objc++-executableaction (objc-executableis used instead). (1623f7e, 6d0c210, 004c73c) - Fixed the
includesattribute ofobjc_librarywhen--experimental_sibling_repository_layoutis set. (bbe453e)
Protoโ
- Continued progress on Starlarkifying Proto rules. (starlarkification roadmap)
- [6.3.0] Added the
output_filesattribute toproto_lang_toolchain. (4d14d3f) - Added the
--incompatible_enable_proto_toolchain_resolutionflag, which causes proto language rules to use toolchain resolution. (d435c6d) - Removed the
proto_compilerattribute fromproto_lang_toolchain. (f5fb2f6) - Fixed proto generation when using
--experimental_sibling_repository_layout. (6c6c196)
Pythonโ
- Continued progress on Starlarkifying Python rules. (starlarkification roadmap)
- [6.1.0] Added host transition to the
lcov_mergerattribute ofpy_test. (4a6d056) - [6.2.0] Fixed runfiles lookup when using a manifest file. (91584dd)
- Added the
--incompatible_python_disable_py2flag, which causespython_version=PY2,srcs_version=PY2orsrcs_version=PY2ONLYwithpy_binary,py_test,py_library,py_runtime, orpy_runtime_pairto throw an error. (d1bbf4b, 95a57ef) - Added the
--incompatible_python_disallow_native_rulesflag, which causes an error if a native Python rule is used without going through rule_python. (2e558ed) - Added the
build_python_zipattribute to thepyfragment. (38b2789) - Added the
default_python_versionattribute to thepyfragment. (c3b2be9) - Added the
default_to_explicit_init_pyattribute to thepyfragment. (38b2789) - Added the
use_toolchainsattribute to thepyfragment. (c3b2be9) - Added the
bootstrap_templateattribute topy_runtime. (0696ba3) - Removed the
py_transitionsmodule. (e2c4d3c)
Starlark and Build APIโ
Starlark is the configuration language used to configure your project. It is also the programming language used to define rules. Bazel also has a Build API which defines standard functions, modules, and rules that can be used from Starlark. Here are some notable changes to both:
- [6.1.0] Added the
--incompatible_use_host_featuresflag, which causes the--featuresflag to only apply to the target configuration, while the--host_featuresflag only applies to the exec configuration. (0ef9c7c) - [6.1.0] Added the
package_relative_labelfunction on thenativemodule. (b859571) - [6.1.0] The
map_eachcallback intemplate_dict.add_joinedcan now returnNone. (db68419) - [6.1.0] The
map_eachcallback intemplate_dict.add_joinedcan now return a list of strings. (8783459) - [6.2.0] Added the
module_nameandmodule_versionattributes on thenativemodule. (bcf309b) - [6.2.0]
json.decodenow accepts duplicate keys. (8548e20) - [6.2.0] Multiple matching
selectbranches are now allowed if they resolve to the same value. (d43737f) - [6.4.0] Added the
--incompatible_merge_fixed_and_default_shell_envflag, which merges rule supplied and shell provided environment variables. (d1fdc53) - [6.4.0] Optimized empty depsets. (fa0ff49)
- [6.4.0] Optimized single transitive depsets. (216fce5)
- [6.4.0] Rule and aspect validation output groups are now merged. (cd72583)
- [6.4.0] When the
reprfunction is called on an exported rule the name of the rule is now included in the output. (002490b) - Added the
abs()function. (5e37989) - Added the
allow_closureattribute totemplate_dict.add_all. (4188edd) - Added the
compressed_outputattribute togenquery. (7f639c6) - Added the
format_joinedcallback totemplate_dict.add_all. (4188edd) - Added the
initializerparameter to therulefunction, which allows specifying a function that computes default values for attributes. (45bac19) - Added the
--experimental_enable_scl_dialectflag, which allows loading.scl(Starlark Configuration Langauge) files. (a0cd355) - Added the
--experimental_rule_extension_apiflag, which enables the use of rule extension and subrules. (8815980) - Added the
--incompatible_no_package_distribsflag, which disables thedistribsattribute ofpackage. (e8184e0) - Added the
starlark_doc_extractrule, which is used by newer versions of Stardoc. (fa65782) - Changed the default value of
attrsinrule()andaspect()to an empty dictionary. (e8f5082) --deleted_packagesnow accumulates multiple values. (2a5d9c7)attrobjects now use value equality rather than reference equality. (31fd464)json.decodenow takes an optionaldefaultpositional parameter. If this parameter is specified and decoding fails,json.decodewill return thedefaultvalue instead of failing Starlark evaluation. (71fb1e4)proto.encode_text()now omits struct fields withNonevalues. (88346f1)- Besides for
implementation, all arguments to therulefunction now need to be named. (cbd63ea) - The
locationof rules that explicitly specifygenerator_nameand/orgenerator_functionattributes is now the top-level call in theBUILDfile. (9800ffd) - Transitions can now inspect attribute value. (ceddfb1)
_whitelist_function_transitionis now applied automatically. (60f3319)- Optimized calls to functions with
kwargs. (2fc7ab9) - Optimized depsets in providers. (cb5a033)
- Optimized provider memory layout. (fc86f15)
- Optimized singleton tuples (e.g.
(single_value, )). (2cc9e13) - Optimized statement/expression heavy code. (704027e)
- Optimized string
find/indexcalls whenendisn't specified. (70c821a) - Optimized string
{l,r,}stripcalls. (62ceeaf) - Optimized string key dictionary lookups. (6087258)
- Optimized tuple and list
inchecks. (d027d48) - Optimized type checks. (2e4694d)
- Optimized
OutputGroupInfo. (655849b) - Removed the
default_providerattribute from thectxmodule. (2ce1a1b) - Removed the
host_configurationattribute from thectxmodule. (51e1da9) - Removed the
host_fragmentsattribute from thectxmodule. (0ca7857) - Removed the
new_filefunction from thectxmodule. (ffe595c) - Removed the
exec_toolsattribute fromgenrule. (5ce12ee) - Removed the
cmd_helpermodule. (b3749b3) - Removed support for
_whitelist_function_transition. (4064d78) - Fixed
ctx.expand_locationhandling of binary target inputs. (4148241) - Fixed
genruleto use the execution platform to determine whichcmd*to run. (c64fa6d) - Fixed encoding of positive infinity in
proto.encode_text. (98e3752)
Aspectsโ
Aspects allow augmenting build dependency graphs with additional information and actions.
- Console output now includes target status, even if non-validation aspects are requested. (944b154)
- Only the visibility of an aspect's implicit dependencies are checked now. (bc1df91)
- Fixed resolving aspect attributes with the same name as an underlying target attribute. (93ad589)
Platforms and toolchains APIโ
In Bazel 7.0 the C++, Android, and Apple rules completed their migration to support building with Platforms.
Here are some of the platforms and toolchains related changes which weren't tied to any of those migrations:
- [6.1.0]
--platformsis no longer cleared in transitions when no change is made to--cpu. (5b4de12) - Added support for platform to Starlark flags platform mappings. (8a7f5e2)
- Added the
--experimental_exec_configflag, which allows setting a custom transition to be used forcfg = "exec". (23de211, f847e3f) - Added the
--incompatible_auto_exec_groupsflag, which automatically creates exec groups for each toolchain used by a rule. (design doc, 6194956) - Added the
--incompatible_check_visibility_for_toolchainsflag, which applies visibility checking to toolchain implementations. (eecd04f) - Added the
--use_target_platform_for_testsflag, which uses the target platform for running tests. (d181353) --extra_toolchainsprecedence is now last-wins, instead of first-wins. (a4576c1)- Attributes on
platformare now non-configurable. (b8faa69) - The
platformrule is now non-configurable. (87fb462) - Made
target_compatible_withwork better onalias()targets. (1d2e9c8) - Root repository mappings now work in the
platform_mappingsfile. (c0fc433) - Target incompatibility is now checked before toolchain resolution. (8482c7c)
- Subsequent settings of
--extra_execution_platformsnow override previous settings, instead of adding them to a list. (c602cec) - Removed the
copy_from_ruleattribute fromexec_group. (f48412f) - Removed the
hosttransition. (c18e6d5)
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:
- [6.2.0]
@foolabels can now be used on the command line as the top-level target. (24f6fe8) - [6.3.0] Options specified on the pseudo-command
commonin.rcfiles are now ignored by commands that do not support them as long as they are valid options for any Bazel command. (44d3953) - [6.3.0] Added the
alwayspseudo-command which has the semantics of pre-6.3.0commonin.rcfiles. (44d3953) - [6.3.0] Credential helpers now apply to repository fetching as well. (9731e69)
- [6.3.0] Wall-time is now used for credential helper invalidation. (5f77aba)
- Added the
--experimental_include_default_valuesflag, which includes default values for Starlark flags in thecanonicalize-flagscommand. (33e9bf1) --ui_event_filtersnow accumulates multiple values. (3d1aeb5)- JVM options in the
JAVA_TOOL_OPTIONSandJDK_JAVA_OPTIONSenvironment variables no loner propagate to the Bazel server; use--host_jvm_argsinstead. (22e3ba5) - The repo mapping manifest is now generated when possible, not only when Bzlmod is enabled. (cb55897)
Summaryโ
As you can see, Bazel 7.0 was another massive release (20% larger than last year!). Thankfully, through the rolling releases process, people were able to test, or even actively depend on, these changes well before the first 7.0 release candidate was cut.
Work on Bazel 8.0 is well underway, and I look forward to summarizing its changes next year. Until then, ๐.