Error "Tried to write the same file twice." only with kotlin

183 views
Skip to first unread message

Choucroute_melba

unread,
Oct 30, 2023, 7:52:28 PM10/30/23
to Protocol Buffers
I'm trying to build the arduino cli grpc sources (https://github.com/arduino/arduino-cli/tree/master/rpc) in Kotlin using the gradle protobuf plugin.
So I have four outputs in my build : grpc, grpckt, java and kotlin an kotlin is the only one to fail with the following error :

Execution failed for task ':stub:generateProto'.
> protoc: stdout: . stderr: cc/arduino/cli/commands/v1/BoardKt.kt: Tried to write the same file twice.

I have tried a lot of things but I really don't know how to work around this error, especially because it work with every other languages.

If it can help, here is the command that the gradle plugin execute and the one that the arduino team execute to build their Go sources :

Gradle :
```
D:\Vivien\AppData\.gradle\caches\modules-2\files-2.1\com.google.protobuf\protoc\3.24.1\3052022638437eefd2645963518be582bb24273a\protoc-3.24.1-windows-x86_64.exe, -ID:\Vivien\Projects\Idea\intellino\stub\build\extracted-protos\main, -ID:\Vivien\Projects\Idea\intellino\stub\build\extracted-include-protos\main, --java_out=D:\Vivien\Projects\Idea\intellino\stub\build\generated\source\proto/main/java, --kotlin_out=D:\Vivien\Projects\Idea\intellino\stub\build\generated\source\proto/main/kotlin, --plugin=protoc-gen-grpc=D:\Vivien\AppData\.gradle\caches\modules-2\files-2.1\io.grpc\protoc-gen-grpc-java\1.57.2\5670558169ce74039d210781b06c8d8136c0868f\protoc-gen-grpc-java-1.57.2-windows-x86_64.exe, --grpc_out=D:\Vivien\Projects\Idea\intellino\stub\build\generated\source\proto/main/grpc, --plugin=protoc-gen-grpckt=D:\Vivien\Projects\Idea\intellino\stub\build\scripts\protoc-gen-grpc-kotlin-1.4.0-jdk8-generateProto-trampoline.bat, --grpckt_out=D:\Vivien\Projects\Idea\intellino\stub\build\generated\source\proto/main/grpckt, D:\Vivien\Projects\Idea\intellino\stub\build\extracted-protos\main\cc\arduino\cli\commands\v1\board.proto, D:\Vivien\Projects\Idea\intellino\stub\build\extracted-protos\main\cc\arduino\cli\commands\v1\commands.proto, D:\Vivien\Projects\Idea\intellino\stub\build\extracted-protos\main\cc\arduino\cli\commands\v1\common.proto, D:\Vivien\Projects\Idea\intellino\stub\build\extracted-protos\main\cc\arduino\cli\commands\v1\compile.proto, D:\Vivien\Projects\Idea\intellino\stub\build\extracted-protos\main\cc\arduino\cli\commands\v1\core.proto, D:\Vivien\Projects\Idea\intellino\stub\build\extracted-protos\main\cc\arduino\cli\commands\v1\debug.proto, D:\Vivien\Projects\Idea\intellino\stub\build\extracted-protos\main\cc\arduino\cli\commands\v1\lib.proto, D:\Vivien\Projects\Idea\intellino\stub\build\extracted-protos\main\cc\arduino\cli\commands\v1\monitor.proto, D:\Vivien\Projects\Idea\intellino\stub\build\extracted-protos\main\cc\arduino\cli\commands\v1\port.proto, D:\Vivien\Projects\Idea\intellino\stub\build\extracted-protos\main\cc\arduino\cli\commands\v1\upload.proto, D:\Vivien\Projects\Idea\intellino\stub\build\extracted-protos\main\cc\arduino\cli\settings\v1\settings.proto
```

Arduino (from their github repo)
```
     protoc --proto_path=rpc --go_out=./rpc --go_opt=paths=source_relative --go-grpc_out=./rpc --go-grpc_opt=paths=source_relative ./rpc/cc/arduino/cli/commands/v1/*.proto'
      protoc --proto_path=rpc --go_out=./rpc --go_opt=paths=source_relative --go-grpc_out=./rpc --go-grpc_opt=paths=source_relative ./rpc/cc/arduino/cli/settings/v1/*.proto'
```
Thanks in advance, - Vivien



Daniele Segato

unread,
Jan 26, 2024, 6:20:55 AMJan 26
to Protocol Buffers
I know it's very late for this, but I think the problem you are having is this one I just filed a bug for:
Reply all
Reply to author
Forward
0 new messages