github bazelbuild/bazel 8.0.0rc1

pre-release12 hours ago

Note

If you are looking for rolling releases, please visit this page.

The following release notes are still in the process of being updated. For a more up-to-date version, take a look at the release announcements doc.

Release 8.0.0rc1 (2024-10-08)

Release Notes:

  • [Incompatible] Java runtime toolchains created via local_java_repository from @bazel_tools//tools/jdk:local_java_repository.bzl, which includes local_jdk, now have target_compatible_with set to the auto-detected host constraints. This can result in errors about toolchain resolution failures for @bazel_tools//tools/jdk:runtime_toolchain_type, especially when cross-compiling. These failures can be fixed in the following ways (listed in decreasing order of preference): * Replace java_binary targets that aren't meant to be run with bazel run or as tools during the build with java_single_jar (available in @rules_java//java:java_single_jar.bzl). Such targets do not require a Java runtime for the target configuration. * Set --java_runtime_version=remotejdk_N for some Java version N to let Bazel choose and download an appropriate remote JDK for the current target platform. This setting defaults to local_jdk, which means that Bazel can only use the local JDK, which isn't compatible with any other platform. * Manually define and register a local_java_runtime with no value set for exec_compatible_with (defaults to []) and select it by setting --java_runtime_version to its name. This fully restores the previous behavior, but can result in incorrect results when cross-compiling (see #18265).
  • "bazel aquery" now returns the headers C++ compilation actions can include if the --include_scheduling_dependencies command line option is set.
  • [Incompatible] transition is removed from objc_library (#19688)
  • This change will set the default size limit for named set of files in BEP from unlimited to 5000. In the event that the limit is reached, the message will be split.
  • [Incompatible] The attribute new_local_repository.build_file no longer accepts a path; a label must be passed instead.
  • [Incompatible] Delete the --experimental_execution_log_file flag. Use --execution_log_binary_file in conjunction with --noexecution_log_sort instead.
  • [Incompatible] The --experimental_repository_cache_urls_as_default_canonical_id flag is no longer available. Instead, the http_archive, http_file, http_jar, jvm_maven_import_external, and jvm_import_external repository rules now use the URLs as the canonical ID if none is provided explicitly. If this behavior is not desired, it can be disabled via --repo_env=BAZEL_HTTP_RULES_URLS_AS_DEFAULT_CANONICAL_ID=0.
  • [Incompatible] --incompatible_sandbox_hermetic_tmp is enabled by default. See #19915 for migration advice.
  • [Incompatible] All labels in Bazel error messages, log output, Build Event Protocol, etc. are now prefixed with double-at (@@) instead of single-at (@) where applicable, to properly denote that they contain canonical repo names.
  • [Incompatible] Incoming transitions on rules can't be set to "exec" transition.
  • The global "applicable_licenses" attribute has been renamed to "package_metadata". The older name may be used for creating targets, but starlark code must use the name "package_metadata" to retrieve it. Breaking change.
  • WorkerMetrics of killed workers are logged (max 50 based on custom prioritization and then arranged in order of worker id). WorkerMetrics also includes the number of actions executed by each worker are now logged in the BEP. The semantics of WorkerPoolStats.evicted_count to refer to the workers that are killed (destroyed) as a result of memory pressure (evicted_count <= destroyed_count).
  • --incompatible_depset_for_java_output_source_jars is a no-op
  • JavaInfo.compilation_info.javac_options now returns a depset. Use tokenize_javacopts from @rules_java to get the options as a correctly ordered list.
  • The invocation URL in the terminal is now prominently colorized in blue.
  • [Incompatible] The BAZEL_CURRENT_REPOSITORY preprocessor variable, which holds the canonical name of the Bazel repository containing a cc_* target, is now only set during compilation if the target depends on the C/C++ runfiles library @bazel_tools//tools/cpp/runfiles via deps or implementation_deps.
  • --zip_undeclared_test_outputs now preserves symlinks when zipping $TEST_UNDECLARED_OUTPUTS_DIR.
  • [Incompatible] Toolchains and execution platforms are now registered in the following order with --enable_bzlmod: 1. root module's module file 2. WORKSPACE or WORKSPACE.bzlmod 3. non-root modules' module files 4. default toolchains registered by Bazel (does not apply with WORKSPACE.bzlmod or execution platforms)
  • [Incompatible] incompatible_enable_cc_toolchain_resolution is a no-op, enabled by default (#7260)
  • [Incompatible] cc_toolchain_suite is a no op rule (#7260).
  • [Incompatible] * On Linux, Bazel's RAM estimate for the host machine is now aware of container resource limits. * On macOS, Bazel no longer consistently overestimates the total RAM by ~5% (1024^2/1000^2). * On Windows, Bazel's RAM estimate is now generally more accurate as it is no longer influenced by JVM heuristics.
  • Log all WorkerPoolStats for all worker pools (even though workers aren't created or destroyed). Also add unknown_destroyed_count and alive_count to the WorkerPoolStats proto.
  • Added a flag --enable_workspace (defaults to True) that allows the user to completely disable WORKSPACE logic when turned off.
  • Various methods and fields related to labels and repos are deprecated in favor of new options with clearer naming and intent. The deprecated APIs can be disabled by setting --noincompatible_enable_deprecated_label_apis. * native.repository_name() is deprecated in favor of the new native.repo_name(). * Label.workspace_name is deprecated in favor of the new Label.repo_name. * Label.relative() is deprecated in favor of the new Label.local_target_label() alongside the existing native.package_relative_label() and Label().
  • [Incompatible] Passing a FilesToRunProvider to coverage_support_files will now result in an error as opposed to being silently ignored.
  • The invocation URL is re-colorized to cyan from blue due to readability issues with dark backgrounds.
  • Label.local_target_label is renamed to Label.same_package_label.
  • [Incompatible] progress messages print short primary input and output without root base
  • Update iOS tutorial link.
  • The package(distribs=[...]) attribute has been removed It has been a no-op for several years now.
  • Prevent linux-sandbox(ed) spawns from being able to write in the cgroups mount.
  • modifies visibility error to be more readable.
  • fixes overly-broad test assertion
  • The deprecated fragments["apple"].bitcode_mode and fragments["cpp"].apple_bitcode_mode APIs have been removed from Bazel. Apple deprecated Bitcode in Xcode 14.
  • [Incompatible] CppLinkAction returns 2 args to aspects that have correct quoting set (before it was always 1 args object defaulting to bash escaping)
  • bazel mod dump_repo_mapping <canonical repo name>... returns the repository mappings of the given repositories in NDJSON. This information can be used by IDEs and Starlark language servers to resolve labels with --enable_bzlmod.
  • The flag --experimental_worker_for_repo_fetching now defaults to auto, which uses virtual threads from JDK 21 if it's available. This eliminates restarts during repo fetching.
  • Bazel's Bash completion can now complete external repository labels when using --enable_bzlmod.
  • [Incompatible] The --host_jvm_profile command line argument is not supported anymore.
  • [Incompatible] The "input_manifests" argument of ctx.actions.{run,run_shell} is now a no-op. resolve_command and resolve_tools always return the empty list as the input manifest list.
  • BEP's execution_phase_time_in_ms no longer includes the analysis-only part at the beginning of the build. Artificial downtrend in execution_phase_time_in_ms expected.
  • The new bazel mod tidy subcommand automatically updates use_repo calls in the MODULE.bazel file for extensions that use module_ctx.extension_metadata.
  • Introduce new flag --experimental_worker_use_cgroups_on_linux that uses cgroups to track memory usage for singleplex workers (on Linux).
  • The scheme for generating canonical repository names has changed to improve cacheability of actions across dependency version updates. Note that canonical names are not considered to be public API and can change at any time. See https://bazel.build/external/module#repository_names_and_strict_deps for advice on how to avoid hardcoding canonical repository names.
  • [Incompatible] Coverage report generators don't get anymore the JAVA_RUNFILES and PYTHON_RUNFILES environment variables.
  • [Incompatible] apple_cc_toolchain rule was removed, use regular cc_toolchain
  • [Incompatible] "bazel query" and "bazel print_action" can't run under the output base anymore.
  • Added a new method, repository_ctx.watch(), which asks Bazel to watch for changes to an arbitrary file. When said file changes, Bazel will refetch the repo.
  • [Incompatible] The Starlark methods copts, generate_linkmap, should_strip_binary in objc fragment have been deleted. Please use the equivalent methods objccopts, objc_generate_linkmap, objc_should_strip_binary in cpp fragments instead.
  • Bazel now respects expires from Credential Helpers.
  • genrule now supports setting stamp = -1 to request conditional stamping (based on the value of the build's --stamp flag).
  • The result of canonicalize-flags now includes all Starlark flags by default. Use --noexperimental_include_default_values for the old behavior that only reports Starlark flags with non-default values.
  • Added windows_quoting_for_param_files feature for windows-style parameter file escaping.
  • New $(DUMPBIN) make variable is now available for Visual Studio toolchains.
  • Bazel on Linux and BSD now respects the XDG_CACHE_HOME environment variable instead of assuming that ~/.cache/bazel is writable.
  • The local_repository and new_local_repository repository rules are now available as Starlark rules under @bazel_tools//tools/build_defs/repo:local.bzl. They are drop-in replacements for their native counterparts, and can be used in module extensions.
  • [Incompatible] removed def_file from cc_common.create_link_variables
  • incompatible_make_thinlto_command_lines_standalone is a no-op
  • [Incompatible] Flipped --incompatible_struct_has_no_methods
  • Added bazel dump --skyframe=function_graph to generate a DOT file representing the relationship between SkyFunction implementations in the Bazel skyframe graph.
  • aquery: //foo:bar now means "all configured targets with label //foo:bar" instead of "choose an arbitrary configured target with label //foo:bar". This is in line with cquery behavior.
  • toolchain type requirements of rules are now treated as implicit dependencies in bazel query. This includes those defined via the toolchains parameter of starlark rule() definitions.
  • Starlark min and max buitins now allow a key callback, similarly to sorted.
  • [Incompatible] On Windows, the default msys64 root is changed to C:/msys64 instead of C:/tools/msys64.
  • distribs() at the package level is no longer legal syntax. It may still be set on individual targets, even though it is a no-op.
  • Added a new include() directive to MODULE.bazel files.
  • print statements in module files are now only executed for the root module and modules subject to non-registry overrides (e.g. local_path_override).
  • bzlmod git_repository now accepts the strip_prefix arg and passes it to the underlying git_repository call.
  • BEP now contains data similar to dump command breakdowns for rules, aspects and skykeys
  • Delete the native AndroidDevice rule. This follows the deletion of the native AndroidTest and AndroidInstrumentationTest rules.
  • Starlark command-line flags can now be referred to through alias targets.
  • native.package_relative_label can now be used in rule initializers.
  • The combined coverage report produced via --combined_report=lcov is now announced on the BES via the new CoverageReport event.
  • The compact and full execution logs now contain start times for spawns (if available).
  • The format for MODULE.bazel.lock is now less likely to result in merge conflicts and is updated incrementally, with only new files downloaded from registries and existing ones taken from the repository cache (if configured).
  • The native aar_import is no longer provided in Bazel. See github.com/bazelbuild/rules_android.
  • The default Unix C++ toolchain now supports the parse_headers feature to validate header files with --process_headers_in_dependencies.
  • A no-op transition is now available as config.target().
  • The new refresh value for --lockfile_mode behaves like the update mode, but additionally forces a refresh of mutable registry content (yanked versions and missing module versions) when switched to or from time to time while enabled.
  • Paths in the Linux sandbox are now again identical to those outside the sandbox, even with --incompatible_sandbox_hermetic_tmp.
  • cc_toolchain now passes runfiles for its *_files attrs (e.g. data files for a tool built for linking).
  • Label instances passed to print or fail as positional arguments are now formatted with apparent repository names (optimized for human readability).
  • [Incompatible] The --experimental_aquery_dump_after_build_format and --experimental_aquery_dump_after_build_output_file command line options are not available anymore.
  • Changes to environment variables read via getenv now correctly invalidate module extensions.
  • --experimental_collect_system_network_usage is flipped to true.
  • Progress is no longer written to BEP after the build completing event is posted.
  • [Incompatible] path attribute is removed from filegroup
  • Git merge conflicts in MODULE.bazel.lock files can be resolved automatically. See https://bazel.build/external/lockfile#automatic-resolution for the required setup.
  • Deleted Bazel's builtin aar_import helper tools. They live in rules_android now.
  • query now uses 3% less RAM.
  • --experimental_repository_downloader_retries defaults to 5.
  • genquery now supports (unconfigured) cycles, but may have higher peak memory usage. The default value of --skyframe_high_water_mark_minor_gc_drops_per_invocation and --skyframe_high_water_mark_full_gc_drops_per_invocation has been decreased to 10, which can result in Bazel OOMing more eagerly as Skyframe state is no longer dropped an unlimited number of times in response to high memory pressure.
  • Experimental support for path mapping CppCompile actions can be enabled via --modify_execution_info=CppCompile=+supports-path-mapping.
  • Stop exposing the AndroidPlatformsTransition to Starlark.
  • Added --experimental_collect_skyframe_counts_in_profiler to collect Skyframe node counts in the JSON profile over time. Currently, the following SkyFunctions are measured: BZL_LOAD, GLOB, GLOBS, PACKAGE, CONFIGURED_TARGET, ASPECT, ACTION_EXECUTION.
  • --compile_one_dependency selects header-only cc_librarys in more cases
  • The format of canonical repo names has changed to use plus (+) instead of tilde (~). Effectively, this flips the flag --incompatible_use_plus_in_repo_names to true, and the flag is now a no-op (i.e. cannot be "unflipped").
  • Bazel no longer has the android_ndk_repository rule. Use https://github.com/bazelbuild/rules_android_ndk instead. See #23199
  • Bazel no longer has the android_local_test rule. Use https://github.com/bazelbuild/rules_android instead. See #23199
  • BEP will include correct `TestResult` and `TargetSummary` events when special test inputs like `$test_runtime` fail to build.
  • Improve progress message in case there are no actions in flight, and display explicitly "no actions running" in that case.
  • aspects can now return DefaultInfo, which will then be merged with that of the configured target they are applied to. Currently, only the files= field is supported.
  • The new cc_static_library rule produces a static library that bundles given targets and all their transitive dependencies. It has to be enabled via --experimental_cc_static_library.
  • Deleted native Android mobile-install
  • Repository rules instantiated in the same module extensions can now refer to each other by their extension-specified names in label attributes.
  • A new experimental flag, --experimental_build_event_output_group_mode, allows users to change how a given output group's files are reported in BEP. The current behavior is FILESET which populates OutputGroup.file_sets. Users may now specify INLINE to instead report files directly in the TargetComplete/AspectComplete event under OutputGroup.inline_files. Users may also specify BOTH to populate OutputGroup.file_sets and OutputGroup.inline_files.
  • [Incompatible] ctx.resolve_tools is no longer available by default, in preparation for complete removal. See #22249 for migration instructions. Use --noincompatible_disallow_ctx_resolve_tools to temporarily make it available again.
  • Bazel no longer has the android_binary, android_library, android_device_script_fixture and android_host_service_fixture rules. Use https://github.com/bazelbuild/rules_android instead. See #23199
  • Bazel no longer has the android_sdk_repository rule. Use https://github.com/bazelbuild/rules_android instead.
  • --incompatible_remote_downloader_send_all_headers is removed.
  • --build_event_upload_max_threads is removed.
  • incompatible_remote_output_paths_relative_to_input_root is removed.
  • The default value of --experimental_remote_cache_compression_threshold is changed to 100.
  • [Incompatible] The aquery command now reports all potential inputs of actions that support input discovery, including the input headers of C++ compilation actions and those explicitly marked as unused through the unused_inputs_list argument to ctx.actions.run. Set --noinclude_pruned_inputs to omit pruned inputs from aquery output when running it after action execution. [Incompatible] This is not a release note, but a reminder to remove the note for --include_scheduling_dependencies, which was introduced in the 8.x tree but won't make it into the final release.
  • [Incompatible] --zip_undeclared_test_outputs now defaults to false, causing undeclared test outputs (i.e., files written to $TEST_UNDECLARED_OUTPUTS_DIR by a test) to be produced as a directory instead of a zip file.
  • Symlink trees are now created through direct filesystem calls by default, instead of delegated to a helper process. On Windows, this entails respecting the --windows_enable_symlinks flag, falling back to a copy when the flag is unset (the helper process always attempts to create symlinks, irrespective of the flag). Set --noexperimental_inprocess_symlink_creation to temporarily revert to the previous behavior, which will be removed in a future release.
  • By default, coverage artifacts will be reported inline in the TargetComplete event. To disable this behavior, pass --experimental_build_event_output_group_mode=baseline.lcov=named_set_of_files_only.
  • Uploading local action results to a disk or remote cache now occurs in the background whenever possible, potentially unblocking the execution of followup actions. Set --noremote_cache_async to revert to the previous behavior.
  • Overrides in the root MODULE.bazel file are now ignored with --ignore_dev_dependency. (Overrides in non-root modules are already ignored.)
  • Added support for using a remote cache that evicts blobs and doesn't have AC integrity check (e.g. HTTP cache).
  • [Incompatible] --legacy_important_outputs is flipped to false. See #14353 for details
  • Undeclared test outputs are now reported individually in the BEP, unless zipping is enabled via --zip_undeclared_test_outputs.
  • Bazel can now parse .scl files, a dialect of Starlark without Bazel-specific symbols.
  • The native version of android_tools_defaults_jar is no longer in Bazel. Use https://github.com/bazelbuild/rules_android instead.
  • Bazel fetch and vendor command now supports --target_pattern_file for specifying target patterns.
  • [Incompatible] This is not a release note, but a reminder to remove the note for --include_scheduling_dependencies, which was introduced in the 8.x tree but won't make it into the final release. - --zip_undeclared_test_outputs now defaults to false, causing undeclared test outputs (i.e., files written to $TEST_UNDECLARED_OUTPUTS_DIR by a test) to be produced as a directory instead of a zip file.
  • Dormant dependencies and materializer functions are now available with the --experimental_dormant_deps flag.
  • The compact execution log now stores runfiles in a more compact representation that should reduce the memory overhead and log output size, in particular for test spawns. This change required breaking changes to the (experimental) log format.
  • override_repo and inject_repo can be used to override and inject repos in module extensions.
  • Patches to the module file in single_version_override are now effective as long as the patch file lies in the root module.
  • If --allowed_cpu_values is set, the --cpu flag value is validated against it.
  • Native android_sdk is no longer available within Bazel. Use https://github.com/bazelbuild/rules_android
  • [Incompatible] With the default Unix toolchain on macOS, binaries now use @rpath to find their .dylib dependencies. This is required to fix issues where tools run during the build couldn't find their dynamic dependencies.
  • Add the --incompatible_simplify_unconditional_selects_in_rule_attrs option to simplify configurable rule attributes which contain only unconditional selects; for example, if ["a"] + select("//conditions:default", ["b"]) is assigned to a rule attribute, it is stored as ["a", "b"].
  • --incompatible_disallow_unsound_directory_outputs is deleted.
  • --incompatible_remote_symlinks and --incompatible_remote_dangling_symlinks are deleted.
  • The default value of --experimental_remote_cache_eviction_retries is changed to 5.
  • If --proto:rule_classes flag is enabled, query proto output will contain rule class definitions in Stardoc proto format.
  • Non-singleton target visibility lists can now contain "//visibility:public" and "//visibility:private" elements; the result is appropriately simplified when assigned to an attribute: ["//foo:subpackages", "//visibility:public"] is saved as ["//visibility:public"], ["//foo:subpackages", "//visibility:private"] is saved as ["//foo:subpackages"], and for consistency's sake, an empty target visibility list [] is saved as ["//visibility:private"].
  • Symbolic Macros -- and with them, Finalizers and the new Macro-Aware Visibility model -- are now generally available (--experimental_enable_first_class_macros now defaults to true). Trivial select() values are automatically unwrapped (--incompatible_simplify_unconditional_selects_in_rule_attrs now defaults to true).
  • Moved all Bazel Android tool and action code to rules_android.
  • [Incompatible] This is not a release note, but a reminder to remove the note for --include_scheduling_dependencies, which was introduced in the 8.x tree but won't make it into the final release. - --zip_undeclared_test_outputs now defaults to false, causing undeclared test outputs (i.e., files written to $TEST_UNDECLARED_OUTPUTS_DIR by a test) to be produced as a directory instead of a zip file. - --legacy_important_outputs is flipped to false. See #14353 for details
  • Add conlyopts and cxxopts attributes to cc rules
  • @bazel_tools//tools/android no longer exists. Use https://github.com/bazelbuild/rules_android instead.
  • [Incompatible] The flag --incompatible_disallow_empty_glob now defaults to true.
  • Bazel now supports all characters in the rlocation and target paths of runfiles and can be run from workspaces with a space in their full path.

Acknowledgements:

This release contains contributions from many people at Google, as well as Adam Azarchs, Adam Singer, Alan Falloon, Alessandro Patti, Alex Eagle, Alex Sharoff, Alexander Golovlev, Alexandre Boulgakov, Artem V. Navrotskiy, Ben Lee, Benjamin Peterson, Brentley Jones, CaerusKaru, Cameron Martin, Chi Wawng, Chirag Ramani, Chris Gray, Christian Scott, Clay McClure, Cornelius Riemenschneider, Cristin Donoso, Daniel Wagner-Hall, David Ostrovsky, David Sanderson, Dennis van den Berg, detailyang, Dimi Shahbaz, DocQuantum, Douglas Thor, eantpil, Ed Schouten, Emil Waijers, Fabian Meumertzheim, FaBrand, Fil-Den, Fredrik Medley, Fredrikhms, George Gensure, Greg Magolan, Greg Roodt, Grzegorz Lukasik, Guillaume Maudoux, Gunnar Wagenknecht, Honnix, Ikko Eltociear Ashimine, Isaac Torres, Jacob Van De Weert, James Sharpe, Jamison Lahman, Jan Keromnes, Jason Schroeder, Javier Maestro, Jay Conrod, Jiawen (Kevin) Chen, JKutscha, Joe Lencioni, John Millikin, Jonas Scharpf, Jonathan Block, jonshea, Jordan Mele, Josh Chorlton, Keith Smiley, Laurent Le Brun, Laurenz Altenmller, Letu Ren, Lior Gorelik, Luis Padron, M. Taimoor Zaeem, Marc Redemske, Maria, Mark Elliot, Matt Brown, Matt Smith, Matthieu MOREL, Michael Siegrist, Muescha, Nick Biryulin, Nikhil Kalige, Niko Wenselowski, Nils Wireklint, ouguoc2-stripe, Patrick Balestra, Paul Janzen, Peter Lobsinger, PikachuHy, Rahul Butani, Richard Smith, Romain Chossart, Roman Salvador, Ryan Beasley, Sangita.Nalkar, Sara Adams, shingt, Siddhartha Bagaria, Simon Mavi Stewart, Son Luong Ngoc, Spencer Putt, Stefano Baghino, Sushain Cherivirala, Tanya Bouman, Ted, thesayyn, Thi Doan, Thomas Weischuh, Tianyu Geng, Timothy Gu, Tomasz Pasternak, UebelAndre, Ulf Adams, Ventzilla, Victor Hiairrassary, Viktor Kustov, Wade Carpenter, Xavier Bonaventura, xinyu.wang, and Yannic Bonenberger.

Notice: Bazel installers contain binaries licensed under the GPLv2 with Classpath exception. Those installers should always be redistributed along with the source code.

Some versions of Bazel contain a bundled version of OpenJDK. The license of the bundled OpenJDK and other open-source components can be displayed by running the command bazel license. The vendor and version information of the bundled
OpenJDK can be displayed by running the command bazel info java-runtime. The binaries and source-code of the bundled OpenJDK can be downloaded from our mirror server.

Security: All our binaries are signed with our public key 3D5919B448457EE0.

Don't miss a new bazel release

NewReleases is sending notifications on new releases.