mbonnin
04/03/2020, 5:03 PM*.main.kts
support dependencies resolution ? The following doesn't work:
#!/usr/bin/env kotlin
@file:DependsOn("com.squareup.moshi:moshi:1.9.2")
@file:DependsOn("com.squareup.okio:okio:2.4.3")
import okio.source // error: unresolved reference: source
import <http://java.io|java.io>.File
File("foo").source()
if I swap the imports of okio and moshi, it works well though, leading me to think that the script will import the first version it encounters ?jimn
04/03/2020, 7:52 PM@file:DependsOn
documented? i didn't see this as i was perusing the kotlinc and REPL pageexport JAVA_OPTS=-Xmx512m ; kotlinc-jvm -Xnew-inference -jvm-target 11 -cp $(find ../cursor/target/ -name '*jar'|xargs -n999 echo|tr ' ' :) -script histogram.kts `
mbonnin
04/03/2020, 9:01 PMkotlin-main-kts
artifact (https://github.com/Kotlin/KEEP/blob/master/proposals/scripting-support.md#kotlin-main-kts). Things got pretty improved in kotlin 1.3.70 so now you can just name a file *.main.kts and it will pull kotlin-main-kts
in the classpath: (changelog: https://blog.jetbrains.com/kotlin/2020/03/kotlin-1-3-70-released/)DependsOn
jimn
04/04/2020, 3:25 AMmbonnin
04/13/2020, 12:23 AM