-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add support for bzlmod #43
Conversation
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.
Thank you for this PR!
I'm not sure about the introduction of buildifier_prebuilt
Without it, looks good!
I understand this being a problem, in that case perhaps we can close this and wait to see if the upstream repo migrates to bzlmod (here's a tracking issue). |
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.
Nice! Sorry for the delay, github notifications are easy to miss, so I stumbled upon this on accident.
It looks like it makes sense to review some of the dependencies and prune where possible. Less things we depend on the less things can break in the future in weird ways :)
Bazel moved to using "allowlist" in Jun 2020 and dropped support for the legacy names in Sep 2023, so newer versions of Bazel don't work.
This version is in the Bazel Central Registry.
I've updated the PR to remove |
Less dependencies is good, yay. What do you think @bttk ? I wonder why the bazelmod.lock files are so gigantic. It makes it essentially impossible to review and look out for potential security risks of whatever it imports. Can these be trimmed to the minimum needed ? (I don't know anything about bzlmod). |
The lock files are indeed huge, but I don't see any options for compressing or shortening them. It looks like they include all of the built-in dependencies like See bazelbuild/bazel#19971 for an open issue about removing built-ins from the lock. It looks like |
I think I like that approach not to include the *.lock file and consider it an ephemeral artifact. |
Nice! I think it would be good if we mention the range of versions supported of bazel with this (in the README somewhere). Anything you'd like to add @bttk ? Are we ready to merge ? |
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.
LGTM!
Thanks for the PR, merged! |
Summary
Hi, this PR adds bzlmod support for this library and resolves #39.
I've had to update some dependencies to match the versions available in the bazel central registry. Where there was no semver-compatible version in the registry, I've updated the dependency to its latest version. The versions in the
WORKSPACE
andMODULE.bazel
should match.I've also updated some attribute names to use
allowlist
which extends this library's support to Bazel v7.0, but drops support for Bazel versions pre June 2020.Help needed
Buildifier built from source isn't available in the BCR right now, but a prebuilt binary is. I hope this change is acceptable, but at the same time it breaks the example and I'm not sure how to resolve the error.
The binary has a default_runfiles file at
external/buildifier_prebuilt~6.4.0~buildifier_prebuilt_deps_extension~buildifier_linux_amd64/file/buildifier
, but therlocation
call here for this path returns empty.Should this file just be skipped if it has no
rlocation
? I'm no Bazel expert so admit I don't know exactly what's going on here.Thanks!