Hi all, I really fell in love in single-file Kotli...
# scripting
p
Hi all, I really fell in love in single-file Kotlin scripts, and I also like staying close to Kotlin-centric libraries. A problem occurs when I try to use e. g. kotlinx.serialization. See https://youtrack.jetbrains.com/issue/KT-47384. Is there any sane workaround, or a concrete plan to solve it? I created it as a bug, but it got converted to a feature request without any comment 😕
b
My solution is to execute the script with the -Xplugin argument. I add it to my script's shebang:
Copy code
#!/usr/bin/env -S kotlinc -script -Xplugin="${KOTLIN_HOME}/lib/kotlinx-serialization-compiler-plugin.jar" --
Just make sure the KOTLIN_HOME environment variable is set. And I'm not sure if there's an equivalent for e.g. Windows, but on my linux machine it works well.
👋 1
👀 1
p
thanks Ben, it got me unblocked! I wrote more in the comment under the issue
😁 1