so .. the minimal scripting example has been updat...
# scripting
n
so .. the minimal scripting example has been updated.. now it also features the idea integration: https://github.com/NikkyAI/MinimalScriptingExample although firs time opening i expect it to not work until it ran
publishToMavenLocal
one on the
script-host
if anyone know how to make this work as ONE gradle project without publishing to maven and depending on that, PRs or hints are welcome
y
This is all looking so close to awesome, but doesn't quite just work. Do you need to restart or just reopen the project after publishing to maven?
I'm going to park this for a few weeks and come back. I've got a lot of scripts I'm going to move over from the JSR 223 approach once it's there e.g. https://github.com/yschimke/okurl/blob/master/src/test/kotlin/commands/gmail-inbox.kts
n
yes
you need to reopen it once because idea needs to get the jar which is loaded up from mavenLocal
@yschimke i think that kotlin scripting is ready enough for that kind of usecase.. especially if you keep your scrift-host and your scripts in seperate repositories
whati i do is i have a not included samples folder (seperate gradle project) and then do a
GradleBuild
task pointing to the parent folder that invokes
publishToMavenLocal shadowJar
which makes it available to the IDE and then i copy the shadowJar over to have it available, similar to here: https://github.com/NikkyAI/MinimalScriptingExample/blob/6524d05610c2c71aa34cf26e7de431f52100cd68/build.gradle.kts#L38-L42 (but this one is doing it on a subdirectry instead)
y
I assume the need for separate modules will be fixed. Also extension association and highlighting was working for me. But really I want Coroutines support before I upgrade. I don’t want runBlocking in my scripts
n
i wonder if you can make your Script class extend Job or somehow other wrap the code to accept suspending functions
i think it might just be possile already but i don't relly know that much about how you can use coroutines in all kinds of ways
either way what you can already to is assign a suspending function a variable that can then be called llater.. its working somewhat well if you want to set multiple generators.. like for avtions you want delayed and/or repeated but for other usecases its ugly
i think you might need to open a issue for the suspend functionality.. even if just to keep track of it
y
I have one from 11 months ago 🙂 https://youtrack.jetbrains.com/issue/KT-23212
n
and starred..
from the KEEP:
scriptBodyTarget - the generation into method body is not yet supported, so this parameter is ignored
so.. this seems like it will be possible to set the target to a suspend function
i
Yes, the suspend support in scripts, as far as we imagine it now, depends on implementation of generating script into a method (instead of a constructor + initializers). The issue - https://youtrack.jetbrains.com/issue/KT-28140 At the moment it is not clear how long it will take, the previous attempt to implement it was blocked by various technical issues.
❤️ 1
👍 1
y
Great that you are working on this, this seems to vastly simplify a typical shell script use, while having clear semantics for the coroutine scope.