-
Notifications
You must be signed in to change notification settings - Fork 19
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
Support for automated module fixups for changed dependencies #52
Comments
I am not sure about buildozer, need to look into that. But I did want to add support for reading the lock files directly to get the versions similar to how it works in go |
The way it currently works with Gazelle's go is the following: go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(
go_deps,
"com_connectrpc_connect",
"com_connectrpc_grpchealth",
"com_connectrpc_grpcreflect",
# ...
) When running Example:
In the current dependencies implementation for Bzlmod (very elegant btw 👏🏻), the dependencies are defined with the extension method One feature we could add is something like: buf_deps = use_extension("@rules_buf//path/to:extensions.bzl", "buf_deps")
buf_deps.from_file(buf_lock = "//path/to:buf_lock") The big change with this approach however would be to create separate workspaces for each dependency, instead of grouping the modules under a single Then we could use something like:
and access them using This might also unlock the ability of doing some dependency-level override, e.g. applying a patch to a specific dependency (I have this specific case atm, where buf.build/googleapis/googleapis has a |
Is there any progress on this? Buf seems to be the last thing I need a workplace file for. |
It might be that we need https://buf.build/docs/build-systems/bazel updated to explain how to use it in module mode? |
The Gazelle plugin at the moment only works on
buf_dependencies
when runningupdate-repos
, which is mostly geared toWORKSPACE
-based projects.There is support to pull in Buf dependencies in a Bzlmod context with the module extensions, but that's mostly manual work (correct me if I'm wrong).
However, Bazel has support for automatic
use_repo
fixups (source: bazelbuild/bazel#17908), and can be seen in action here for Go: bazel-contrib/bazel-gazelle#1511 (review)We could add something similar here too, so that running
bazel run :gazelle
can output dependencies fixes, and applied with a script similar to this:The text was updated successfully, but these errors were encountered: