-
Notifications
You must be signed in to change notification settings - Fork 650
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
Generate symlinks for vendor/ directory #376
Comments
There's not really a way to access external repositories in Bazel. They're stored in Bazel's cache directory, and their location within that directory tends to change between Bazel versions. Unfortunately, I don't really have a good solution for you. There are a lot of rough edges around dependency management right now, and it's something we're looking at improving. Probably the best thing for IDE support at the moment is to use regular vendoring (instead of listing dependencies in WORKSPACE). You can generate BUILD files for vendored packages with |
Thank you @jayconrod. I had considered using a vendoring tool (like glide or any one of the dozen others, many of which we've tried) and gazelle, but for now prefer to use external repositories. Since my only goal here is for tool/IDE support, I hacked together a small tool which reads the workspace and maintains the repositories in a vendor/ directory. Here is the tool for those interested. |
Glad you found something that works for you. I hope we can improve this further in the future. |
We use bazel and rules_go to build our infrastructure repo composed of various golang services. We've specced out all of our go dependencies using WORKSPACE,
new_git_repository
, andgo_library
in a third_party dir. I like this a lot because it allows us to be extremely explicit with all of our dependencies. This works great for building our binaries and docker files, however it gets difficult for tool support. It would be awesome if we could symlink all of our dependencies underneathvendor/
so whatever IDE you're using that supports the vendor directory can automatically see the dependent sources.For example a WORKSPACE file that defines:
And a
third_party/go/x_crypto.BUILD
:You can see the build.bzl file here, it simply sets up an alias and calls
go_library
.It would be great if we could symlink
vendor/golang.org/x/crypto
to wherever@go_x_crypto
is checked out. I don't see a way currently to do this. Is there a way to do so? I found gobazel but it seems like there should be a simpler (and platform independent) way by just using bazel rules and symlinks... or maybe I am thinking about this entirely wrong?The text was updated successfully, but these errors were encountered: