-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make bazel mod tidy
work with include()
#22455
Conversation
Tests will fail until a new buildozer release (with bazelbuild/buildtools@1429e15). Tested locally with a patched buildozer and it passes. |
rootUsage.getProxies().stream().filter(p -> !p.isDevDependency()).findFirst().get(); | ||
moduleFilePathToCommandsBuilder.put( | ||
firstNonDevProxy.getContainingModuleFilePath(), | ||
makeUseRepoCommand("use_repo_add", firstNonDevProxy.getProxyName(), importsToAdd)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens here if the proxy is not exported? I agree we don't need to support this case, but how bad is the failure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the proxy name would be the empty string, resulting in commands like use_repo_add repo1 repo2
, which means repo1
would be interpreted as the exported name...
I changed it so that unexported proxies would be treated as if they're exported as _unnamed_usage
. Will probably tip people off that these are supposed to be named.
src/main/java/com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionMetadata.java
Show resolved
Hide resolved
We now generate fixup commands targeting `include()`d segments in addition to the root MODULE.bazel file itself. Fixup commands are grouped by file, and then passed to Buildozer using `-f -` (i.e. multiple commands for multiple files, passed in using stdin). - For repos to add, we find the first usage with the correct prod/dev type and add them there. - For repos to remove, we remove them from whichever usage had them. - At the end, all module files and included segments are formatted. Fixes #22063
2e8cc8f
to
31b9db9
Compare
We now generate fixup commands targeting `include()`d segments in addition to the root MODULE.bazel file itself. Fixup commands are grouped by file, and then passed to Buildozer using `-f -` (i.e. multiple commands for multiple files, passed in using stdin). - For repos to add, we find the first usage with the correct prod/dev type and add them there. - For repos to remove, we remove them from whichever usage had them. - At the end, all module files and included segments are formatted. Fixes bazelbuild#22063 Closes bazelbuild#22455. PiperOrigin-RevId: 636680730 Change-Id: Id894a449d8d1cdf39271ea3a724a91aebc51befb
We now generate fixup commands targeting `include()`d segments in addition to the root MODULE.bazel file itself. Fixup commands are grouped by file, and then passed to Buildozer using `-f -` (i.e. multiple commands for multiple files, passed in using stdin). - For repos to add, we find the first usage with the correct prod/dev type and add them there. - For repos to remove, we remove them from whichever usage had them. - At the end, all module files and included segments are formatted. Fixes #22063 Closes #22455. PiperOrigin-RevId: 636680730 Change-Id: Id894a449d8d1cdf39271ea3a724a91aebc51befb
We now generate fixup commands targeting `include()`d segments in addition to the root MODULE.bazel file itself. Fixup commands are grouped by file, and then passed to Buildozer using `-f -` (i.e. multiple commands for multiple files, passed in using stdin). - For repos to add, we find the first usage with the correct prod/dev type and add them there. - For repos to remove, we remove them from whichever usage had them. - At the end, all module files and included segments are formatted. Fixes #22063 Closes #22455. PiperOrigin-RevId: 636680730 Change-Id: Id894a449d8d1cdf39271ea3a724a91aebc51befb
We now generate fixup commands targeting
include()
d segments in addition to the root MODULE.bazel file itself. Fixup commands are grouped by file, and then passed to Buildozer using-f -
(i.e. multiple commands for multiple files, passed in using stdin).Fixes #22063