Closed akesling closed 4 years ago
The simplest stop-gap I've found for this is to move all service definitions into a single "services.proto" file per package. This is definitely sub-par but can at least unblock the issue.
Hi! Thanks for reporting, I believe this is a duplicate of #38?
Ah, I didn't read far enough into it. The observation in https://github.com/hyperium/tonic/issues/38#issuecomment-556796099 is definitely the same issue. Is #38 multiple issues with codegen or am I missing something? If it is, should it be split up into one issue per specific user-visible behavior?
I think it relates to the same issue as having multiple services in the same proto package that gets compiled together. Not sure what to really break it up into though :/
I believe this should be fixed by #173, feel free to reopen is it doesnt!
I have this issue when we have /auth folder for protos and then a session.proto with just type definitions. Another file service.proto. Both in the same /auth
directory, and both with package defined as auth
. Problem is that configure/compile_proto runs for service.proto and then gets overwritten later on when compiling session.proto.
Anyone find a solution to this?
Bug Report
Version
$ cargo tree | grep tonic foobar v0.1.0 (/Users/akesling/Devel/rust/tonic-break/foobar) └── tonic v0.1.0-alpha.6 └── tonic-build v0.1.0-alpha.6
Platform
$ uname -a Darwin notloh.lan 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64
Description
I've created an example project demonstrating the failure I'm seeing: https://github.com/akesling/tonic-break
When multiple proto files are provided, if they A) are in the same proto package and B) contain a service in more than one file, then compilation fails. Here's an example failure output: https://gist.github.com/akesling/4f1e026d17aa6376ce3213e79c8902b3
The issue seems to be that tonic-build is outputting multiple "pub mod client" stanzas. Everything works if only one file includes services.
Would it be possible to aggregate service definitions before codegen output to prevent stanza duplication like this?