-
Notifications
You must be signed in to change notification settings - Fork 44
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
Proto Dependencies Generated Not Included In Main File When Generating Code With Buf #24
Comments
I had found #19 when investigating this issue but it seems to be a separate issue |
Three separate items here. The first is that buf, and by proxy the plugins called by protoc, will only generate code for the items specified. So, by specifying only Second, it appears that you only have Third, the pathing used is the normal pathing used by |
@neoeinstein Thanks for the quick response!
So we are doing the generation of the prost plugins. And we are doing the generating of the code by doing I'll look into the pathing option. Also do you know if its possible to use the |
Hi!! I'm having a similar issue. buf generate --template buf.gen.rust.yaml --include-imports
Failure: plugin "buf.build/community/neoeinstein-prost-crate:v0.4.1" failed: No such file or directory (os error 2) where I have the following layout closely mirroring the example from this repo: ls -la
.rw-r--r-- 328 gluax 4 Oct 12:33 buf.gen.rust.yaml
.rw-r--r-- 35 gluax 4 Oct 11:55 buf.work.yaml
.rw-r--r-- 243 gluax 4 Oct 11:45 Cargo.toml
.rwxr-xr-x 238 gluax 4 Oct 10:28 generate.sh
drwxr-xr-x - gluax 4 Oct 12:16 proto
drwxr-xr-x - gluax 4 Oct 12:33 src
ls -la proto/
.rw-r--r-- 1.1k gluax 4 Oct 12:16 buf.lock
.rw-r--r-- 453 gluax 4 Oct 11:55 buf.yaml
drwxr-xr-x - gluax 4 Oct 11:58 sedachain If I comment out the Here's the contents of version: v1
plugins:
- plugin: buf.build/community/neoeinstein-prost:v0.4.0
out: src/gen
opt:
- compile_well_known_types
- file_descriptor_set
- enable_type_names
- plugin: buf.build/community/neoeinstein-prost-crate:v0.4.1
out: .
opt:
- include_file=src/gen/mod.rs
- gen_crate I did try pointing Is |
As noted in the README, the remote plugin is explicitly not compatible with the |
Ah, ok, sorry I missed that. Is there a link/docs on how to install these plugins locally then? Do I just Then to generate a EDIT: plugin: buf.build/community/neoeinstein-prost-crate:v0.4.1
out: .
opt:
- include_file=src/gen/mod.rs That complains it can't read the |
Hi gluax, a few years ago - therefore the configuration/code might require updates - my version: v1
managed:
enabled: true
plugins:
###############
### generic ###
###############
- name: doc
out: gen/doc
opt: markdown,README.md
strategy: all
- name: openapiv2
out: gen/openapi
############
### rust ###
############
# cargo install protoc-gen-prost
- name: prost
out: gen/rust/src
opt:
- bytes=.
- file_descriptor_set
- compile_well_known_types
- extern_path=.google.protobuf=::pbjson_types
# cargo install protoc-gen-prost-serde
- name: prost-serde
out: gen/rust/src
# cargo install protoc-gen-prost-tonic
- name: tonic
out: gen/rust/src
opt:
- compile_well_known_types
- extern_path=.google.protobuf=::pbjson_types
# cargo install protoc-gen-prost-crate
- name: prost-crate
out: gen/rust
strategy: all
opt:
- gen_crate=assets/Cargo.toml You can see that I installed the binaries via In my server/client application (was just a "hello-world") I included the crate by adding [dependencies]
template-api = { version = "0.1.0", path = "../../gen/rust/" } to my project's Cargo.toml. I'm sure this does not follow best practices, and I never used it in a bigger project or even in production. But hopefully it helps, in one or another way. |
Here's a short snippet of our proto file:
I generated the code via:
And the main file
issuer_api.v1.rs
only includes the tonic service definition included:And also the generated code uses the dependency like this:
Instead of
By including it
The text was updated successfully, but these errors were encountered: