https://kotlinlang.org logo
t

tapchicoma

03/24/2019, 12:48 PM
https://github.com/Tapchicoma/ktsexec-gradle -
KtxExec
task that, for now, supports only simple scripts (jcenter approval is pending)
3
n

Nikky

03/24/2019, 1:19 PM
so why not on the gradle plugin repo ?
t

tapchicoma

03/24/2019, 1:21 PM
it is just a task - plugin is not required in this case
n

Nikky

03/24/2019, 1:29 PM
then it should be possible to add it as dependency of buildSrc right ?
t

tapchicoma

03/24/2019, 1:29 PM
theoretically - yes
n

Nikky

03/24/2019, 1:30 PM
also whats the ScriptDef used and how can i use a custom one ?
t

tapchicoma

03/24/2019, 1:30 PM
it is just a quick hack over yesterday evening - for now just a simple script without external dependencies or special script annotation is supported
if you want something more - open issue/PR 🙂
n

Nikky

03/24/2019, 1:32 PM
it seems liek this: https://github.com/Tapchicoma/ktsexec-gradle/blob/master/host/src/main/kotlin/by/egorr/gradle/ktsexec/host/KtsExecKotlinScriptHost.kt#L14-L15 has no arguments ? i could recommend a
val vararg args: String
i like the gradle task idea
i can see quite a few usecases to aid gradle-kts
t

tapchicoma

03/24/2019, 1:32 PM
yes, next that I want to add is passing arguments to script
n

Nikky

03/24/2019, 1:34 PM
thats 5-6 lines i think, heh
what i want to try is make this work with custom ScriptDefinitions
t

tapchicoma

03/24/2019, 1:35 PM
but how you will pass it to host? 🤔
n

Nikky

03/24/2019, 1:35 PM
inline reified function should be able to pass the type through
and then its up to the user that they do not mess up the arguments
also could add custom
script${name}
gradle dependencies.. i have the skeleton for that already laying around
but that might be better to solve with file annotations that alreadyx exist in main-kts
e

eskatos

03/26/2019, 9:18 AM
you could publish it to the portal as a no-op plugin, this would make it possible to bring it into build scripts using the plugins block
t

tapchicoma

03/26/2019, 9:19 AM
plugin with empty
apply()
?
e

eskatos

03/26/2019, 9:19 AM
yup
t

tapchicoma

03/26/2019, 9:19 AM
mm, ok
e

eskatos

03/26/2019, 9:20 AM
the
KtsExec.script
input is a simple string it should be a
RegularFileProperty
instead so Gradle can track the changes in the script
t

tapchicoma

03/26/2019, 9:20 AM
thank you for input 🙂
will try to update it later this week
e

eskatos

03/26/2019, 9:23 AM
The other thing that comes to mind is managing the Kotlin version. It could come from the applied kotlin plugin by convention or be set explicitely.
Good stuff @tapchicoma
👍 2
2 Views