Skip to content

Conversation

@bazel-io
Copy link
Member

@bazel-io bazel-io commented Dec 8, 2025

The implementation has to handle command line overrides on module repos subject to non-registry overrides specially to avoid a cycle when requesting the main repo mapping.

Fixes #24617
Fixes #17128

RELNOTES: --override_repository now supports apparent repository names from the point of view of the main repository. An unknown apparent repo name will result in an error.

Closes #27706.

PiperOrigin-RevId: 841652194
Change-Id: Ic8d53e5c7beec0cf14a293c2d589ab08a5ba4f9d

Commit 82c06ca

The implementation has to handle command line overrides on module repos subject to non-registry overrides specially to avoid a cycle when requesting the main repo mapping.

Fixes bazelbuild#24617
Fixes bazelbuild#17128

RELNOTES: `--override_repository` now supports apparent repository names from the point of view of the main repository. An unknown apparent repo name will result in an error.

Closes bazelbuild#27706.

PiperOrigin-RevId: 841652194
Change-Id: Ic8d53e5c7beec0cf14a293c2d589ab08a5ba4f9d
@bazel-io bazel-io requested a review from a team as a code owner December 8, 2025 09:41
@bazel-io bazel-io added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. awaiting-review PR is awaiting review from an assigned reviewer labels Dec 8, 2025
@bazel-io bazel-io requested a review from Wyverald December 8, 2025 09:41
@gemini-code-assist
Copy link

Summary of Changes

Hello @bazel-io, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant improvement to Bazel's module system by allowing the --override_repository flag to recognize and process apparent repository names. This change simplifies the process of overriding module-defined repositories, especially in complex dependency graphs, by letting users refer to repositories by the names they are familiar with from their MODULE.bazel files. The update also includes robust error handling for invalid or misspelled apparent names and refactors internal override mechanisms for better clarity and correctness.

Highlights

  • Apparent Name Support for --override_repository: The --override_repository flag now accepts apparent repository names (the names used in MODULE.bazel files) in addition to canonical names, enhancing flexibility for module overrides.
  • Improved Override Resolution Logic: The internal repository definition function has been updated to correctly resolve overrides, prioritizing command-line overrides even when a module is subject to a non-registry override.
  • Enhanced Error Handling: When an unknown apparent repository name is provided to --override_repository, Bazel will now produce a more informative error message, including "did you mean" suggestions for potential typos.
  • Internal Refactoring: The REPOSITORY_OVERRIDES precomputed value has been moved from RepositoryMappingFunction to RepoDefinitionFunction to better align with the new override resolution logic.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for using apparent repository names with --override_repository. The implementation is solid, handling potential cycles by specially treating command-line overrides on module repos with non-registry overrides. The changes are consistent across the codebase, and the new functionality is well-tested, including new tests for precedence of overrides and helpful error messages for typos. The refactoring to move REPOSITORY_OVERRIDES to RepoDefinitionFunction is clean. Overall, this is a great improvement to user experience and robustness.

@iancha1992 iancha1992 enabled auto-merge December 8, 2025 19:55
@iancha1992 iancha1992 added this pull request to the merge queue Dec 9, 2025
Merged via the queue into bazelbuild:release-9.0.0 with commit 598a385 Dec 9, 2025
46 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants