Open basselworkforce opened 2 weeks ago
/cc @alesj (grpc), @cescoffier (grpc)
Thanks!
Can you provide a simple reproducer? You already gave the protoc command and that's great!
We would like to have a larger tests regarding the gRPC import.
done: https://github.com/basselworkforce/proto-consumer
also this is the proto source code for reference: https://github.com/basselworkforce/proto-sources-library and the published dependency is here: https://github.com/basselworkforce/mvn-repo/packages/2265803
Thanks @basselworkforce.
@alesj can you have a look?
Took a quick stab at this here: https://github.com/quarkusio/quarkus/pull/43706, seems to fix the issue when I tested locally
Describe the bug
When scanning a dependency for proto files to generate code for e.g.:
quarkus.generate-code.grpc.scan-for-proto=com.acme:proto-sources-library
and picking a subset of proto files to generate code for e.g.quarkus.generate-code.grpc.scan-for-proto-include."com.acme:proto-sources-library"=**/orders/**
, code gen fails when the proto files haveimport
statements relative to the root path.For example:
com/acme/grpc/orders/v1/order.proto
filecom/acme/grpc/orders/v1/order_status.proto
fileRun
./gradlew quarkusGenerateCodeDev
Observe error
Stack trace
It seems the problem is that the correct protoc import directory (
-I
or--proto_path
) argument is not one of the two passed in:com.google.protobuf-protoc-linux-x86_64-exe -I=/home/brachid/orders/build/protoc-protos-from-dependencies/58d495f113cf26357f150a443d3b533cca56d58f/com/acme/grpc/orders/v1 -I=/home/brachid/orders/build/protoc-dependencies/887869d68b3d4324376eb9ee6db4956483e8eaf8 ...
The correct import directory argument would be:
-I=/home/brachid/orders/build/protoc-protos-from-dependencies/58d495f113cf26357f150a443d3b533cca56d58f
which is the root of the proto files. The import statements use a path relative to that root as per the recommendation in the guidelines:If I re-run the protoc command with the correct
-I
argument added on then it succeeds:com.google.protobuf-protoc-linux-x86_64-exe -I=/home/brachid/orders/build/protoc-protos-from-dependencies/58d495f113cf26357f150a443d3b533cca56d58f -I=/home/brachid/orders/build/protoc-protos-from-dependencies/58d495f113cf26357f150a443d3b533cca56d58f/com/acme/grpc/orders/v1 -I=/home/brachid/orders/build/protoc-dependencies/887869d68b3d4324376eb9ee6db4956483e8eaf8 ...
Expected behavior
Code gen should succeed
Actual behavior
Code gen fails on the protoc command
How to Reproduce?
No response
Output of
uname -a
orver
Linux 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "21.0.4" 2024-07-16 LTS
Quarkus version or git rev
3.15.1
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 8.9
Additional information
No response