pbandk
pbandk copied to clipboard
Windows support
I'm using the pbandk plugin with google's protobuf-gradle-plugin as per your example.
I'm on windows, and the only way i can get it to work is by specifying the path to protoc-get.kotlin.bat
in the kotlin plugin block like below. I've cloned the project and built it so thats where it comes from.
protobuf {
...
plugins {
kotlin {
// This works on windows, but obviously isn't cross platform.
path = 'C:\\Users\\me\\pbandk\\protoc-gen-kotlin\\jvm\\build\\install\\protoc-gen-kotlin\\bin\\protoc-gen-kotlin.bat'
// This fails, see error below.
// artifact = 'com.github.streem.pbandk:protoc-gen-kotlin-jvm:0.8.0:jvm8@jar'
}
}
...
}
Using the jar as suggested in the example gives
* What went wrong:
Execution failed for task ':app:generateDebugProto'.
> protoc: stdout: . stderr: --kotlin_out: protoc-gen-kotlin: %1 is not a valid Win32 application.
The full command args from gradle --info are: [ C:\Users\olly_.gradle\caches\modules-2\files-2.1\com.google.protobuf\protoc\3.11.1\2f33a303623e20f356c70fce00579ae377dbc46b\protoc-3.11.1-windows-x86_64.exe, -IC:\Users\olly_\myapp\engine-rust\proto\proto, -IC:\Users\olly_\myapp\app\build\extracted-protos\main, -IC:\Users\olly_\myapp\app\build\extracted-protos\debug, -IC:\Users\olly_\myapp\app\build\extracted-include-protos\debug, --plugin=protoc-gen-kotlin=C:\Users\olly_.gradle\caches\modules-2\files-2.1\com.github.streem.pbandk\protoc-gen-kotlin-jvm\0.8.0\921451f497c1bfd53d0b145c0e8753b0c0697569\protoc-gen-kotlin-jvm-0.8.0-jvm8.jar, --kotlin_out=log=debug:C:\Users\olly_\myapp\app/gen/debug/kotlin, {list of .proto files} ]
Hi @OliverCulleyDeLange. The protoc-gen-kotlin-jvm-0.8.0-jvm8.jar
file only works on Unix-like systems. On Windows you have to build it locally and specify the path to the protoc-gen-kotlin.bat
file, as you've done. I've updated the pbandk
README to clarify this.
If you know of a way to build a Java-based self-executing file for Windows, let us know. We definitely would like to support it if it's possible.
Looks like https://github.com/TheBoegl/gradle-launch4j might be able to create a self-executing file on Windows. If someone with access to a Windows machine wants to try that out, we'll gladly accept a PR that integrates that plugin into the pbandk Gradle build.