gRPC codegen fails for large file name like io.envoyproxy.controlplane:api on windows
Describe the bug
I stumbled upon this problem while testing envoy control plane api.
gRPC codegen fails with an exception when adding quarkus.generate-code.grpc.scan-for-proto=io.envoyproxy.controlplane:api to scan envoy controlplane api for proto files.
Caused by: io.quarkus.bootstrap.prebuild.CodeGenException: Failed to generate java files from proto file in C:\test\code-with-quarkus\build\classes\java\quarkus-generated-sources\proto\.
at io.quarkus.grpc.deployment.GrpcCodeGen.trigger(GrpcCodeGen.java:177)
at io.quarkus.deployment.CodeGenerator.lambda$trigger$4(CodeGenerator.java:204)
at io.quarkus.deployment.CodeGenerator.callWithClassloader(CodeGenerator.java:179)
at io.quarkus.deployment.CodeGenerator.trigger(CodeGenerator.java:201)
at io.quarkus.deployment.CodeGenerator.initAndRun(CodeGenerator.java:78)
... 28 more
Caused by: java.io.IOException: Cannot run program "C:\test\code-with-quarkus\build\com.google.protobuf-protoc-windows-x86_64-exe": CreateProcess error=206, The filename or extension is too long
at io.quarkus.deployment.util.ProcessUtil.launchProcess(ProcessUtil.java:38)
at io.quarkus.grpc.deployment.GrpcCodeGen.trigger(GrpcCodeGen.java:165)
... 32 more
Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long
Probably only an issue on windows, as it builds fine on a WSL Ubuntu VM.
Note that the io.envoyproxy.controlplane:api artifact also contains generated code, so it is possible to use the code from the artifact.
Expected behavior
No exception occurs
Actual behavior
java.io.IOException: CreateProcess error=206, The filename or extension is too long occurs
How to Reproduce?
Reproducer: https://github.com/ls-bit/quarkus-grpc-codegen-issue
Output of uname -a or ver
Microsoft Windows [Version 10.0.22631.3007]
Output of java -version
openjdk 17.0.8 2023-07-18
OpenJDK Runtime Environment GraalVM CE 17.0.8+7.1 (build 17.0.8+7-jvmci-23.0-b15)
OpenJDK 64-Bit Server VM GraalVM CE 17.0.8+7.1 (build 17.0.8+7-jvmci-23.0-b15, mixed mode, sharing)
Quarkus version or git rev
Quarkus 3.7.2
Build tool (ie. output of mvnw --version or gradlew --version)
------------------------------------------------------------
Gradle 8.5
------------------------------------------------------------
Build time: 2023-11-29 14:08:57 UTC
Revision: 28aca86a7180baa17117e0e5ba01d8ea9feca598
Kotlin: 1.9.20
Groovy: 3.0.17
Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM: 17.0.8 (GraalVM Community 17.0.8+7-jvmci-23.0-b15)
OS: Windows 11 10.0 amd64
Additional information
No response
/cc @alesj (grpc), @cescoffier (grpc)
I'm not sure we can do anything. Can you try with WSL?
Yes, it works with WSL. Maybe it is possible to pass some kind of parameter file to protoc as mentioned in https://github.com/protocolbuffers/protobuf/issues/274 ?
Hum, it worse a try - I fear it's windows specific (meaning I cannot test).
if it is of any help, i can offer to test on windows
@ls-bit Sorry for the late reply - can you check https://github.com/quarkusio/quarkus/pull/39291?
Awesome, I can confirm that the issue is fixed by your PR, thanks!
Thanks for the feedback!