ilya.chernikov
02/27/2017, 9:35 AMscriptCompilationClasspathFromContext
, with the minimal classpath needed for your script. You need to make sure that at least kotlin-script-runtime
and java stdlib is included there.andrewoma
03/02/2017, 8:32 PMkotlin-script-util
to the classpath and added a file:
@file:ScriptTemplate("org.jetbrains.kotlin.script.util.FilesAndMavenResolver")
@file:DependsOn("junit:junit:4.11")
org.junit.Assert.assertTrue(true)
println("Hello, world!")
if (args.isNotEmpty()) {
println(args.joinToString())
}
println("done")
andrewoma
03/02/2017, 8:32 PMScriptTemplate
(amongst other things)andrewoma
03/02/2017, 8:36 PMGradleScriptTemplatesProvider
. Is there no way of using other templates in the IDE?andrewoma
03/03/2017, 6:01 AMilya.chernikov
03/03/2017, 9:03 AMSettings
-> Build, execution, Deployment
-> Kotlin Compiler
-> Script template classes
for specifying FQN of the classes that should be recognised in IDEA. And Script templates classpath
for all template dependencies.
- from CLI compiler - -classpath
option for dependencies, and -script-templates
for templates FQNs`
Couple of caveats to keep in mind:
- you need to specify transitive dependencies as well, when you’re using corresponding functionality, and for maven resolving this is unfortunately quite a lot raising from using of jcabi-aether
and maven-core
.
- after specifying templates in the IDEA settings, you'll need to reload the project
The generic scripting support is still work in progress, so this is going to become easier eventually.andrewoma
03/03/2017, 9:55 AMandrewoma
03/06/2017, 12:57 AMkotlin-script-util
and all dependencies (a whopping 43MB of them) on the script template classpath and used org.jetbrains.kotlin.script.util.templates.StandardArgsScriptTemplateWithMavenResolving
but it doesn’t seem to do anything as far as I can tellandrewoma
03/06/2017, 12:58 AMRun
doesn’t add the script template options. Also the gradle daemon seemed to complainandrewoma
03/06/2017, 12:59 AMilya.chernikov
03/07/2017, 10:01 AMandrewoma
03/07/2017, 10:09 AMandrewoma
03/07/2017, 10:21 AMilya.chernikov
03/07/2017, 10:29 AMsdeleuze
03/10/2017, 12:51 PMWarning:Kotlin: Some JAR files in the classpath have the Kotlin Runtime library bundled into them. This may cause difficult to debug problems if there's a different version of the Kotlin Runtime library in the classpath. Consider removing these libraries from the classpath or use '-Xskip-runtime-version-check' to suppress this warning
warning in IDEA, it comes from kotlin-script-util
.sdeleuze
03/10/2017, 12:52 PMsdeleuze
03/10/2017, 1:07 PMsdeleuze
03/10/2017, 1:08 PM-Xskip-runtime-version-check
via gradle configuration (if it is possible)?sdeleuze
03/10/2017, 1:09 PMsdeleuze
03/10/2017, 1:30 PMkotlinOptions.freeCompilerArgs = [”-Xskip-runtime-version-check"]
sdeleuze
03/10/2017, 1:31 PMudalov
kotlin-script-util.jar
because it obviously does not have the Kotlin Runtime library bundledudalov
sdeleuze
03/10/2017, 2:16 PMsdeleuze
03/10/2017, 2:19 PMkotlin-script-runtime
dependencysdeleuze
03/10/2017, 2:19 PMsdeleuze
03/10/2017, 2:19 PMsdeleuze
03/10/2017, 2:25 PMsdeleuze
03/10/2017, 2:29 PMsss
03/11/2017, 4:11 AMGoland merging dep into the main toolchain - https://github.com/golang/dep/wiki/Roadmap.
IMHO this is the first compiled language that is adopting a manifest + lock style dependency management (very similar to kotlin)