`Kotlinc` supports the option `-script`, but I can...
# announcements
s
Kotlinc
supports the option
-script
, but I can’t find detailed information about it. Where can I find the relevant documentation about kotlin script?
b
You basically need to name entry file as *.main.kts and invoke it via
kotlinc -script *.main.kts
Then you have
@file:Repository
and
@file:Depndency
or
@file:DependsOn
file level anotations to manage dependencies.
Other than that it's a regular JVM project.
g
The most comperhenisve description of Kotlin Scripting you can find in related KEEP (not all parts of which are implemented): https://github.com/Kotlin/KEEP/blob/master/proposals/scripting-support.md
btw instead of
kotlinc -script some.kts
there is also
kotlin some.kts
(available from 1.4 probably, or late 1.3)
☝️ 1
s
Thank you!
h
Also see https://github.com/holgerbrandl/kscript for an alternative runner.
v
And there is a brand new parameter to run scripts as if they were named bla.main.kts without the need to have that name.