-
Notifications
You must be signed in to change notification settings - Fork 114
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
[Self-Filed] Bzlmod support #54
Comments
Any further updates on when this may be available? Or an estimate of effort? As someone setting up Bazel usage with bzlmod, this sounds great to use - especially if it allows for easy source-code viewing of bzlmod packages pulled in via http archives. |
Hey, Kyle! Honestly, we haven't really spent much time scoping bzlmod yet. This issue was meant to track interest in order to figure out the right time to add bzlmod support. I see there are now lots of 👍🏻; thanks for commenting and bringing me back here. For my prioritization and understanding: Is WORKSPACE instead of bzlmod blocking you (or others reading this)? Are there important things it's getting you that WORKSPACE file does not? Are there things about, e.g., the new canonical workspace stuff, that are breaking features for you? My mental state, if useful as a diff base. Please tell me if I'm wrong or if there are other things I should be thinking about!
Thanks! |
Perhaps this repo need a tag, so that I can make a PR on bazel-central-registry. |
Hi, I've been using bzlmod for quite some time in rules_ll and I'm the one (slowly 😅) adding bzlmod support to LLVM. In case it helps:
Yes it does. Even
I think so, but the file structure might have changed. Bzlmod exclusively uses the (new?) "canonical" path schemes which can sometimes look a bit strange like
I'm not familiar with the codebase for this tool, but I'd guess that adding bzlmod as distribution mechanism is probably a lot easier than adding parsing for modules. Basically, you can just copy-paste most of the previous
It definitely feels a bit experimental. Stardoc is just getting support for it, but from an in-organization perspective it's amazing how clean an user-friendly end user
This is of course highly opinionated, but IMO once you go bzlmod you won't want to go back. The dev experience is incredibly nice once you have it set up. It took 3(!) attempts to make things work well with custom registries etc (we have a bazel-eomii-registry, bazel-eomii-registry-deprecated and bazel-eomii-registry-also-deprecated 🤣) and a bit of tinkering with versioning (ended up with I don't think I'd have time to create a PR here myself, but I'd be happy to provide feedback on PRs etc if it helps you. |
Thanks guys. Based on that, I think the code, as is, will already play nicely with modules (aka external workspaces) brought in via bzlmod, since we don't assume anything about the name of those workspaces (in the path, above). That is, @kylepl, I think we'll already help you accomplish your goal of "allow[ing] for easy source-code viewing of bzlmod packages." If that's wrong, again, please say so we can work together to get it fixed asap. My working hypothesis remains that we should probably continue to recommend bringing this tool in via the WORKSPACE just until there's Renovate update support for bzlmod, since I'm assessing that WORKSPACE copy-paste integration is pretty easy and already not much of a barrier--but that encouraging updates is pretty important to getting the best experience for everyone per unit effort. But, as usual, if you think I've misassessed, please do say. Or if someone's knows how to make bzlmod automatically pickup the latest commit, with GitHub actions, say--and would be willing to help with a PR--we could continue to live at head while supporting it alongside in the meantime. Cheers, |
Hi all, EDIT: |
Ooh great! Thanks for your efforts, Luke. For my learning: I was thinking people would just use the WORKSPACE snippet from their WORKSPACE during the migration period. Anything I should know there? (I think both work together and am guessing it'll be a long time (if ever) until they get rid of the WORKSPACE.) |
Yes, according to the readme here, both WORKSPACE and MODULE.bzlmod can work together, although personally, I'm setting up a new project so would like it all to be in the new system as that is set to become default in Bazel v7 (although I'm sure workspace will still be around for a long time). TO ADD bazel-compile-commands-extractor TO BZLMOD VIA AN EXTENSION:
(Or alternatively something like this if you find it neater:)
That's as simple as I could get the process, the docs here provide an extended way of doing this under the "Fetch external dependencies with module extensions" section, which I had working in the extended form, but now it's not and I'm not sure what I broke😅 Anyway, the extended form just broke it down into a repositories.bzl file that had the http download and then used that function in the extensions.bzl, which was then included in the main repo. I do wonder if we could have a MODULE.bazel file added to this project that would work alongside the WORKSPACE file, they should both be fine to work together, and Bazel will simply automatically choose preference of the MODULE.bazel if bzlmod is enabled on their setup - this would make it easier to get included without needing the extra extensions file and shouldn't be a hard fix! |
I've created a PR with a permanent fix, all it took was adding a MODULE.bazel and extensions.bzl file to the repo, all functionality now works with bzlmod smoothly via a simple inclusion. This works much better than the hacky fix above, as it actually solves the root support problem by having the complimentary MODULE.bazel file available in the repo. It also means the commands are executed by the repo's extension file itself, rather than the user doing it. The above hack also didn't have support for running the workspace configuration method, but the PR method does, so it's a seamless and fully functioning transition from the WORKSPACE system. See PR #146 |
Woo! So Luke got found a great way for us to get bzlmod support out for all you early adopters--and it's hot off the presses. Please check out the bzlmod install path, added to the README, and tell us whether it's working for you! |
We'd love also your double checking that Renovate properly upgrades the bzlmod version, letting us know either way and filing a discussion over at Renovate if not. |
Bazel's working on a new external dependency management system called Bazelmod, arriving in 6.0 and by default in 7.0, replacing and deprecating the WORKSPACE.
Please chime in if you're looking to use bzlmod (or even help us support it!) so we can support the new external dependency syntax at the right time.
Cheers!
Chris
The text was updated successfully, but these errors were encountered: