kotlin-cli-starter icon indicating copy to clipboard operation
kotlin-cli-starter copied to clipboard

Support Windows

Open jmfayard opened this issue 4 years ago • 4 comments

jmfayard avatar May 05 '21 17:05 jmfayard

we need libcurl linked statically, this is currently not possible might change with https://github.com/msys2/MINGW-packages/pull/8469 depends on ktor

see: https://kotlinlang.slack.com/archives/C3SGXARS6/p1620282215299400?thread_ts=1620247483.298800&cid=C3SGXARS6

NikkyAI avatar May 06 '21 08:05 NikkyAI

I removed the dependency to ktor-client and curl

The CI fails

e: D:\a\kotlin-cli-starter\kotlin-cli-starter\src\nativeMain\kotlin\io\NativeActuals.kt: (32, 14): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
public operator fun <T, R> DeepRecursiveFunction<TypeVariable(T), TypeVariable(R)>.invoke(value: TypeVariable(T)): TypeVariable(R) defined in kotlin
e: D:\a\kotlin-cli-starter\kotlin-cli-starter\src\nativeMain\kotlin\io\NativeActuals.kt: (42, 18): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
public operator fun <T, R> DeepRecursiveFunction<TypeVariable(T), TypeVariable(R)>.invoke(value: TypeVariable(T)): TypeVariable(R) defined in kotlin

this corresponds to those two lines

    val fp = popen("$commandToExecute $redirect", "r") ?: error("Failed to run command: $command")
    val status = pclose(fp)

@NikkyAI do you think you can debug that?

jmfayard avatar May 14 '21 10:05 jmfayard

so currently it fails because it is runing on a linux-like target on windows (mingw or msys2 or such).. but okio only handled windows like paths when compiled for mingw

https://github.com/square/okio/issues/951

jmfayard avatar Jun 10 '21 11:06 jmfayard

I have merged the work from Nikky. Support for windows is not perfect but better than it was. If someone wants to contribute, feel very welcome!

https://github.com/jmfayard/kotlin-cli-starter/pull/20

jmfayard avatar Jun 26 '21 20:06 jmfayard