-
Notifications
You must be signed in to change notification settings - Fork 389
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 Bzlmod in a monorepo #1658
Comments
@tyler-french What do you think, are there any footguns in allowing multiple |
I want to better understand the reason behind having the multiple Are the different projects built with different resolved versions of the different modules? In this case, supporting multiple Are there any I'm wondering if it might be more practical to have one |
Actually I think yes, this would be a better question to ask as there's no good documentation on the best practices with gazelle and Bzlmod anywhere(specifically when it comes to monorepos). |
Hello, I am currently using a monorepo with some multiple go modules inside, managed via bzlmod.
Hope it can help |
I'm also trying to understand how (as well as relatedly #1715) Concretely -
Here is a setup that is not pleasant but it works (without bzlmod). I can't see how to port it to bzlmod.
# gazelle:repository_macro go_repositories.bzl%go_repositories
go_repositories()`
|
A true monorepo would only have a single Replace directives mentioning local paths are waiting for Bazel features that would allow us to overlay a local repo with generated build files. It's also actively being worked on. |
My current state is multiple To satisfy both
Does that sound right? The protobuf shadow directory makes me suspicious I'm still missing some best practices. |
This PR may be relevant: #1731 |
What version of gazelle are you using?
v0.33.0
What version of rules_go are you using?
v0.41.0
What version of Bazel are you using?
7.0.0-pre.20231011.2
Does this issue reproduce with the latest releases of all the above?
Yes
What operating system and processor architecture are you using?
macos 14.1 Beta (23B5056e), x86
What did you do?
I'm basically trying to move to Bzlmod from WORKSPACE, and I'm confused about how to use gazelle with it in a monorepo.
The docs at https://github.com/bazelbuild/rules_go/blob/master/docs/go/core/bzlmod.md say that gazelle will use go_deps, and that I don't need to run
gazelle update-repos
anymore but the problem is that I can only define onego_deps.from_file
in my MODULE.bazel file, but I have multiple go projects in my monorepo with different dependencies for each.With the WORKSPACE file it was at least possible to run
update-repos
for each go.mod file, but I do know that that's not the recommended way of doing it, and that gazelle has a tool to combine all go.mod files into a single go.mod file in the repo's root.But is there a way to still use multiple go.mod files?
The text was updated successfully, but these errors were encountered: