Comments (7)
Not really sure what Gazelle can do with that directory without adding a lot of special cases. There are a large number of .proto files with no BUILD file.
I think there would need to be a handwritten BUILD file in that directory (either upstreamed, or emplaced with a repository rule) that defines proto_library
and go_proto_library
. When #12 is implemented, Gazelle would index these rules. When you import one of these proto files, it would resolve the dependency to the proto_library
or go_proto_library
as appropriate. WDYT?
from bazel-gazelle.
I'd go with external repo. As long as the generated build file is not using "//google/api" as target, I don't have to touch the build file and add #gazelle:ignore
on the top.
I've already tried to use new_repository
with a local build file as temp fix, which seems not a huge maintenance burden.
from bazel-gazelle.
There's no way to tell whether a proto import is from an external repo or not just by looking at the import string (without special cases). They're paths that are relative to the repo root, but they could be in any repo including the workspace.
When #12 is working, we'll have an index of all the proto files in external repos, so Gazelle will be able to generate correct targets. I think that will fix it.
from bazel-gazelle.
SG. I'll manually put these files in my workspace and put a huge DO NOT EDIT
in the readme for now.
It's indeed annoying to work with these special cases, as the import syntax in proto files is not built for open source world at first place :(
from bazel-gazelle.
@jayconrod Indexing files in current workspace works already, and I think the external one seems can be solved by using repo overlays as the build files in third_party
directory. Is this the direction gazelle moves toward to? I'd love to give it a shot if that's the long term plan.
from bazel-gazelle.
@ashi009 Sorry for the slow response; just got back from a trip.
The long-term plan for repositories that need some customization (that go_repository
doesn't work for) is to use overlay build files (via Gazelle's http_archive
and git_repository
). The build files will be stored in a third_party
directory and will be kept up to date with Gazelle, but they can have manual customizations, too.
The command to add a new repository to one of these rules or migrate an existing go_repository
will look something like this:
gazelle update-repos -rule=git_repository example.com/repo
After that, you'll be able to update to a new commit and update build files at the same time with gazelle update-repos example.com/repo
or gazelle update-repos -all
.
I was hoping to have this working already, but a bunch of stuff has been happening in rules_go, so most of my attention has been there. I still hope to get this done soon.
from bazel-gazelle.
Closing this since Gazelle 0.13.0 includes special cases for protos in github.com/googleapis/googleapis
and for the Well Known Types.
from bazel-gazelle.
Related Issues (20)
- Include @protobuf as option for resolving well-known types
- Failure when building //cmd/gazelle:gazelle_lib with bazel HOT 2
- Poor failure message when go.sum contains a merge-conflict HOT 1
- Adding non-strings (eg: a function) to a target's deps
- FR: Gazelle should import direct dependencies directly without requiring buildozer HOT 4
- concurrent map read and map write HOT 3
- Use host module cache without build cache
- go_repository does not support fallback configured via GOPROXY environment variable HOT 1
- cahed bazel_gazelle_go_repository_tools does not rebuild when OS architecture changes HOT 3
- Transitive Go dependencies not included when using `go_deps.from_file` HOT 3
- Any way to conditionally apply module_overrides? HOT 6
- Gazelle gets confused if directories already contain both BUILD and .pb.go files
- Gazelle extremely slow with MODULE.bazel and kubernetes
- Tables in the documentation are difficult to read HOT 2
- Expose bazel_deps to go_deps extension HOT 1
- new gazelle v0.36.0 fails with Go sum mismatches HOT 10
- go.mod FilePath ReplaceDirective is missing when using the go-deps bzlmod extension HOT 1
- gazelle_binary fails nogo linting
- 'invalid use of internal package' in IDE in external tests HOT 4
- Failing to upgrade to gazelle 0.36 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bazel-gazelle.