Programmatic way to run kotlin as a scripting language via JSR 223 or a homegrown api?

Is there any plan to be able to run a script written in kotlin programmatically and inject variables similarly to groovy or nashorn? It seems like with the upcoming gradle build script support it will have to be possible to have something like this.

1 Like

You can use GitHub - kscripting/kscript: Scripting enhancements for Kotlin

Yes, we do plan to support JSR 223, even though it’s not actually related to the Gradle work we’re currently doing.

2 Likes

You can use my DynKT project under GitHub - xafero/dynkt: This is a JSR-223 scripting engine for the language "Kotlin" .
I could contribute it to Kotlin as well, if there’s interest.

Someone recommended your project to me on twitter yesterday. It looks like it’ll fit my needs (especially since it works with OSGi out of the box), but I haven’t had a chance to play with it yet. All I’ve done so far is poke around the code.

Any updates to post on this?

JSR 223 has been supported since Kotlin 1.1.

Discovered that a bit later. Thank you. Sorry to bother