-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
[bazel] Add support for bzlmod module system #55924
Comments
@aaronmondal If you test with recent rolling releases of Bazel, local overrides of modules also get a repo name with a suffix, which means that you can more easily reproduce issues caused by that locally. bazelbuild/bazel#15553 contains some ideas on how to handle bzlmod repo names in copts. |
@fmeum Thanks for the infos! The first one should make testing a lot easier. The second one may be able to fix the issue with |
Ok things seem to be working now. I updated the initial post and will send a patch for review. |
Some groundwork proposed in https://reviews.llvm.org/D136496. Also opened an issue in the BCR: bazelbuild/bazel-central-registry#206 For those interested, I am upstreaming from https://github.com/eomii/bazel-eomii-registry/tree/llvm-project-overlay/modules/llvm-project-overlay. |
@aaronmondal Maybe I just haven't figured out Phabricator, but I think I'm unable to comment on the LLVM revision, so I'm going to comment here. You should indeed be able to drop the The way you patch a repo through a symlink looks slightly "adventurous" and I'm not 100% convinced it won't break some assumptions Bazel makes about external repos, but if it's only going to be used by LLVM devs, I think that would be acceptable. |
Yeah that was indeed an oversight. I keep losing track of all the changes locally in all the different repos 😅
The easiest variant is for sure to use a |
Prefix occurrences of `//utils/bazel` with an explicit `@llvm-raw`. This change lets us reuse code from `configure.bzl` in future compatibility patches for the bzlmod module system. The llvm-project overlay will be made available as an `@llvm-project-overlay` (name WIP) module in the Bazel Central Registry. This means that we will have an `@llvm-project-overlay` workspace in addition to the `@llvm-raw` and `@llvm-project` workspaces currently involved in the build. To keep future patches to the existing build files as small as possible, the explicit naming proposed in this change appears to be the simplest way to not confuse the module workspace resolution. This is not a functional change to the current WORKSPACE build. It is a foundation for future patches. GitHub Issue in the BCR: bazelbuild/bazel-central-registry#206 GitHub Issue in LLVM: #55924 Reviewed By: csigg Differential Revision: https://reviews.llvm.org/D136496
@aaronmondal where did you leave this one, are you interested in working on this still? I might be interested in picking it up |
@keith Whoops we had to delete and recreate the registry I posted previously for various reasons. The patches are slightly outdated but should still be mostly functional: https://github.com/eomii/bazel-eomii-registry/tree/main/modules/llvm-project-overlay/17-init-bcr.3 |
Hmm unless we want to add root-level That PR adds |
I think for now we could call the original APIs with a module_extension to get the same behavior, but I haven't tried |
Tested this again. Still won't work. We can't use |
instead of doing that could we use a fake |
That would work, if we could add a |
oh i was thinking there would be some way to make that work with it in the overlay still. i agree that would be ideal but am not sure how much pushback there would be. if we only supported bzlmod you only need the MODULE.bazel and BUILD.bazel (no WORKSPACE* required). if you wanted to keep supporting both i think we'd also need a WORKSPACE.bzlmod to make bazel ignore the WORKSPACE.bazel when bzlmod is enabled |
Ha! It seems like I messed something up with the |
bazel 8.0.0 now prints a warning that "WARNING: WORKSPACE support will be removed in Bazel 9 (late 2025), please migrate to Bzlmod, see https://bazel.build/external/migration." As a heads up, it sounds like "late 2025" might be a deadline for this bug that's been actively worked on+open for years. See also #119425. |
We are currently working on making the Clang/LLVM Bazel overlay available via the
bzlmod
system. We noticed that parts of our code may be desirable to have in the Clang/LLVM overlay in this repo.What works
MODULE.bazel
file here (ignore therules_ll
specific stuff).extensions.bzl
file to apply the overlay etc. is here, mostly copied fromconfigure.bzl
.What doesn't work
I would expect that we would need to fix the following issues before something like this would be acceptable for upstreaming:
zlib
etc. This should be simple to fix by exposing related functionality as extensions.http_archive
because of this bug: Label resolution fails by repo mapping when used by a repo rule inside a module extension bazelbuild/bazel#14659. Workarounds are possible, but not pretty.Conclusion
Please let me know whether
bzlmod
support is something that would have a place in the bazel overlay in this repository. If it is, please also let me know which issues, apart from those already mentioned we would have to address.The text was updated successfully, but these errors were encountered: