mbonnin
07/27/2025, 2:58 PM*.main.kts file? Like output or something? It won't import my dependencies but I'm unsure why...joseph_ivie
07/28/2025, 3:27 PM*.main.kts? It would be incredibly useful.Olaf Gottschalk
08/01/2025, 5:10 AMBasicScriptingHost.eval(...) function to run script code, is there any way, a script can programmatically add elements to the reports property of the ResultWithDiagnostics that it returns?
In some situations that are caught at runtime of my script, I want to return a warning just like a compiler warning, but my script can only detect this at runtime like when a user does something they are not intended to do. My current "solution" is to log a warning using a logger... but this is really not what I want. I need this information as a side-information along with the result of the script evaluation. So, ideally, in my script, I would like to call a function that adds elements to this collection of ScriptDiagnostic elements with a severity of warning...
Is that possible?Tim Putnam
08/05/2025, 8:30 PMBasicJvmScriptingHost embedded in an application that's dynamically loading JPMS modules using ModuleLayer.
I simply want the classloader from this ModuleLayer to be visible to the compiler. I"m setting baseClassLoader in the host configuration thus:
val hostconf = ScriptingHostConfiguration {
jvm {
baseClassLoader(appClassloader)
}
}
I've also tried a variety of ways to set the classloader in the ScriptCompilationConfiguration but to no avail. I don't want to add explicit jars (e.g. dependenciesFromClassloader() ). I just want it to use a provided classloader, but it always just uses the main/boot classloader.
This is something I've had working at some stage in the pass, but now doesn't seem to.
I feel like I'm missing something obvious - it seems to want external files? Please, any pointers?darkmoon_uk
08/23/2025, 12:02 AM.kts files instead of Bash, to perform more complex steps; like preparing ECS Deployment tasks.
The good news is - GitHub Actions images already include kotlin, so no complex preparation steps, just run: kotlin myScript.main.kts and off you go! kodee happyPaul Woitaschek
09/07/2025, 5:10 PMmikehearn
09/15/2025, 12:58 PMmikehearn
09/15/2025, 1:54 PM@file:DependsOn unless you do this because correct resolution of those artifacts requires Maven model building. There are likely other edge cases too.
Please note that I didn't bother implementing any support for options as I don't use them. But it should be easy enough to see how to do it.
Hope that helps!Primoz Delopst
09/16/2025, 9:08 PMPrimoz Delopst
09/26/2025, 6:36 AMy9san9
09/27/2025, 5:24 PMS.
10/11/2025, 3:21 PMShaun Wild
10/24/2025, 11:37 AMShaun Wild
10/24/2025, 5:38 PMShaun Wild
10/25/2025, 4:15 PMColton Idle
10/28/2025, 3:11 PMCaleb Miles
10/30/2025, 7:41 PMrefineConfiguration#onAnnotations
We would like to just implement the basic DependsOn,Repository,Import,and CompilerOptions however whenever I specify annotations in onAnnotations I get this:
unable to load class kotlin.script.experimental.dependencies.DependsOn. It seems to error on whichever annotation is first in the list. For the life of me I cannot figure this out.
refineConfiguration {
onAnnotations(DependsOn::class, Repository::class, Import::class, CompilerOptions::class, handler = AnnotationProcessor())
}
I can send a link to the repo if needed 🙂
Any help is much appreciated.Shaun Wild
11/01/2025, 12:50 AMShaun Wild
11/01/2025, 1:17 AMShaun Wild
11/02/2025, 7:14 PMShaun Wild
11/02/2025, 7:15 PMedwinRNDR
11/05/2025, 9:04 AMedwinRNDR
11/07/2025, 10:51 AMBasicJvmScriptingHost such that I can get exceptions thrown during script evaluation?Draget
11/09/2025, 12:33 AM#!/usr/bin/env kotlin
@file:DependsOn("com.squareup.okhttp3:okhttp:5.3.0")
import okhttp3.OkHttpClient
println(OkHttpClient())
Am I missing something? Thought I could define dependencies like this - but it always fails with
test.main.kts:3:8: error: unresolved reference 'okhttp3'.
import okhttp3.OkHttpClientShaun Wild
11/25/2025, 5:31 PMscripts -> common -> example
My script file in assets cannot see any of the kotlin files in example or commonShaun Wild
11/27/2025, 5:44 PMShaun Wild
11/28/2025, 9:14 AMOlaf Gottschalk
11/28/2025, 1:52 PMbeforeCompiling block in refineConfiguration to do some checks in the source.text - but I would need comments already removed from the code snippet... I don't want to reimplement a code parser... 😞Primoz Delopst
12/03/2025, 10:59 AMAndreas Martin Mørch
12/08/2025, 4:01 PMScriptCompilationConfiguration with isStandalone(false) and include a script of this type in my normal Kotlin sources, should I still expect the script to be compiled as it did in < Kotlin 1.9? (Without the flags for enabling the old behaviour)
I've tried with Kotlin 2.2.21 and Kotlin 2.3.0-RC2, and I can't seem to find any traces of the compiled script in the build output. Is it only for avoiding the IDE warning about placing it in the Kotlin sourceset of a project?