You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use gazelle for a repo that has multiple repositories in the src/ dir and also a src/vendor/. I suspect the solution for this will be #859 but I'm filing this as a separate issue because I want to describe in more detail the scenario I'm struggling with. Feel free to close it if doesn't really value.
Hi @razvanm, thanks for describing this problem. There are a couple odd things here.
First, as you mentioned, is Gazelle's treatment of prefix = ".". At the moment, Gazelle doesn't handle empty prefixes well (#870), and "." has some of the same problems (possibly more if it's considered a relative path). I plan to fix that soon. However, since Gazelle uses the prefix to determine whether an import path is local or external, all import paths will be considered local, so vendored libraries and external repositories will not be used in repositories with empty prefixes. #859 is the ultimate fix for this, but it's a complicated change, and it will take some time.
One other thing to watch out for: your WORKSPACE file is not in your repository root directory. Bazel is fine with this for builds within your repository, but if your repository is used as an external dependency for something else it will ignore your WORKSPACE file and expect all your labels to be rooted at the repository root. If you never intend to use this repository as an external dependency, no change needed, at least from Bazel's perspective.
I'll close this issue because I think everything here is covered by #870 and #859. Please reopen though if there's something that won't work when those are implemented though.
Thanks for the comment. I really hope that the "it will take some time" will not mean a year. :-)
I am aware of the WORKSPACE is not in the repository root directory. I did that because Gazelle places the vendor/ in a fixed place and I wanted this repository to look like a normal Go workspace. There was no intention to make this usable as an external dependency.
I'm trying to use gazelle for a repo that has multiple repositories in the
src/
dir and also asrc/vendor/
. I suspect the solution for this will be #859 but I'm filing this as a separate issue because I want to describe in more detail the scenario I'm struggling with. Feel free to close it if doesn't really value.Demo repo: https://github.com/razvanm/gazelle-vendor-bug
Scenario: 4 packages (2 in vendored repos, 2 local repos) and one command in one of the local repos that use all 4 packages.
From the view of the go workspace looks like this:
The go flow works as expected:
The
repo.4/cmd/cmd4/BUILD
is not quite correct. The broken target is the following:The expected form is the following:
I use
prefix = "."
for thegazelle
rule in the topBUILD
files because an empty value would cause an error.The full
gazelle
rule from the top-levelBUILD
file:The text was updated successfully, but these errors were encountered: