Skip to content

Keep include calls together in MODULE.bazel files#1345

Merged
vladmos merged 1 commit intobazelbuild:mainfrom
fmeum:compact-includes
Mar 21, 2025
Merged

Keep include calls together in MODULE.bazel files#1345
vladmos merged 1 commit intobazelbuild:mainfrom
fmeum:compact-includes

Conversation

@fmeum
Copy link
Contributor

@fmeum fmeum commented Mar 21, 2025

No description provided.

@vladmos vladmos merged commit ee6c0a3 into bazelbuild:main Mar 21, 2025
2 checks passed
@fmeum fmeum deleted the compact-includes branch March 24, 2025 13:52
@psalaberria002
Copy link
Contributor

psalaberria002 commented Mar 26, 2025

bazel mod tidy seems to format the includes with empty lines between them. Is that also fixed in a more recent Bazel version?

Right now buildifier and bazel mod tidy don't seem to agree with the formatting in our repo.

@fmeum
Copy link
Contributor Author

fmeum commented Mar 26, 2025

How do you obtain buildifier? This PR hasn't been included in any release yet, so I don't see how it could format includes without empty lines at this point.

@psalaberria002
Copy link
Contributor

psalaberria002 commented Mar 26, 2025

How do you obtain buildifier? This PR hasn't been included in any release yet, so I don't see how it could format includes without empty lines at this point.

We consume it as a go module with a commit reference, and then executing the bazel binary target that comes with it.

@fmeum
Copy link
Contributor Author

fmeum commented Mar 26, 2025

In that case you'll have to wait for a new buildtools release, which can then be used for a new release of the buildozer module. Bazel uses that module for bazel mod tidy, so when it's out, you just need to bump a bazel_dep rather than update Bazel.

@honnix
Copy link

honnix commented May 5, 2025

In that case you'll have to wait for a new buildtools release, which can then be used for a new release of the buildozer module. Bazel uses that module for bazel mod tidy, so when it's out, you just need to bump a bazel_dep rather than update Bazel.

Which module is supposed to be bumped? We use buildifier and buildozer through rules_multitool and are experiencing the same format conflict issue.

@fmeum
Copy link
Contributor Author

fmeum commented May 5, 2025

The buildozer BCR module is what Bazel uses under the hood. You can pin it with a single_version_override.

@TroyKomodo
Copy link

TroyKomodo commented Oct 9, 2025

@fmeum what I am gathering here is if we add

bazel_dep(name = "buildozer", version = "8.2.1")

to the MODULE.bazel then this will force bazel internally to use >= 8.2.1 of buildozer thus making bazel mod tidy include this formatting change?

If so, perhaps this can be documented somewhere outside of this PR comments. for bazel versions prior to some version x.y.z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants