[9.2.0] Add //tools:tools_for_bazel_subcommands filegroup to vendor mod tidy …#29481
Merged
iancha1992 merged 1 commit intobazelbuild:release-9.2.0from May 8, 2026
Merged
Conversation
…deps (bazelbuild#29445) `bazel vendor //...` does not vendor the implicit `@buildozer_binary` dependency of `bazel mod tidy`, so a subsequent `bazel mod tidy` run with `--vendor_dir` and `--nofetch` fails with: ``` ERROR: no such package '@@buildozer++buildozer_binary+buildozer_binary//': no such package '@@buildozer+//': Vendored repository buildozer+ not found under the vendor directory and fetching is disabled. ``` Users currently have to discover and pass the undiscoverable incantation `--repo=@@buildozer+ --repo=@@buildozer++buildozer_binary+buildozer_binary`. See bazelbuild#29222 for the full discussion. @fmeum proposed the fix adopted here: > We could add a target under `bazel_tools` that groups all such tools and that you could add to your vendor pattern list for this purpose. The reporter confirmed this approach works for their use case. Add a new public filegroup `@bazel_tools//tools:tools_for_bazel_subcommands` that groups implicit tool dependencies of Bazel subcommands. Today it contains just `@buildozer_binary//:buildozer.exe` (required by `bazel mod tidy`); future subcommands that introduce implicit tool deps can be added here. Users who run Bazel offline with `--vendor_dir` and `--nofetch` can opt in by including the target in their vendor invocation: ``` bazel vendor //... @bazel_tools//tools:tools_for_bazel_subcommands ``` This preserves the current behavior for users who don't run `bazel mod tidy` (no silent expansion of the transitive closure) while giving those who do run it a single, documented target to add to their vendor pattern. Added `test_tools_for_bazel_subcommands` in `src/test/shell/bazel/bazel_tools_test.sh` that queries the new filegroup and asserts buildozer is in its transitive dependencies. ``` Add `@bazel_tools//tools:tools_for_bazel_subcommands` filegroup that groups implicit tool dependencies of Bazel subcommands (e.g. buildozer for `bazel mod tidy`). Add this target to `bazel vendor` when working offline. ``` Fixes bazelbuild#29222 Closes bazelbuild#29445. PiperOrigin-RevId: 910718201 Change-Id: I776833cf65624b67425f85a74d0891316f1ed40e
meteorcloudy
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…deps (#29445)
bazel vendor //...does not vendor the implicit@buildozer_binarydependency ofbazel mod tidy, so a subsequentbazel mod tidyrun with--vendor_dirand--nofetchfails with:Users currently have to discover and pass the undiscoverable incantation
--repo=@@buildozer+ --repo=@@buildozer++buildozer_binary+buildozer_binary.See #29222 for the full discussion. @fmeum proposed the fix adopted here:
The reporter confirmed this approach works for their use case.
Add a new public filegroup
@bazel_tools//tools:tools_for_bazel_subcommandsthat groups implicit tool dependencies of Bazel subcommands. Today it contains just@buildozer_binary//:buildozer.exe(required bybazel mod tidy); future subcommands that introduce implicit tool deps can be added here.Users who run Bazel offline with
--vendor_dirand--nofetchcan opt in by including the target in their vendor invocation:This preserves the current behavior for users who don't run
bazel mod tidy(no silent expansion of the transitive closure) while giving those who do run it a single, documented target to add to their vendor pattern.Added
test_tools_for_bazel_subcommandsinsrc/test/shell/bazel/bazel_tools_test.shthat queries the new filegroup and asserts buildozer is in its transitive dependencies.Fixes #29222
Closes #29445.
PiperOrigin-RevId: 910718201
Change-Id: I776833cf65624b67425f85a74d0891316f1ed40e
Description
Motivation
Build API Changes
No
Checklist
Release Notes
RELNOTES: None
Commit 29477bc