Vampire
06/26/2022, 8:57 PM.main.kts
script.
I guess it uses whatever Kotlin version you are running it with.
But how to make sure it is at least version X?
Do you have to manually check that if necessary?
Actually more important, how does IntelliJ know which stdlib to use for navigation and completion?
I have a script that I intend to run only with Kotlin 1.7.0, so I could use Kotlin 1.7.0 API.
But even if I add a @file:DependsOn
on 1.7.0 stdlib-jdk8, it still navigates to 1.3.72 Kotlin stdlib.
The installed plugin is 1.7.0 and the complier settings have "latest stable (1.7)" for language and api version.ilya.chernikov
06/27/2022, 9:54 AMAndrei Klunnyi
06/27/2022, 9:57 AMVladimir Dolzhenko
06/27/2022, 2:17 PMVampire
06/27/2022, 2:44 PMVladimir Dolzhenko
06/27/2022, 2:50 PMmbonnin
06/27/2022, 2:54 PMkotlin
binary used to run the script?
2. Use the stdlib resolved from the @DependsOn
annotations?Vampire
06/27/2022, 2:54 PMVladimir Dolzhenko
06/27/2022, 2:56 PMmbonnin
06/27/2022, 2:57 PMVladimir Dolzhenko
06/27/2022, 2:58 PM.gradle.kts
filesmbonnin
06/27/2022, 3:00 PM*.main.kts
:
#!/usr/bin/env kotlin
@file:DependsOn("org.jetbrains.kotlin:kotlin-stdlib:1.7.0")
println(KotlinVersion.CURRENT.toString())
And then running it:
$ kotlin -version
Kotlin version 1.6.20-release-275 (JRE 17.0.2+8)
$ ./scripts/test.main.kts
1.6.20
Vladimir Dolzhenko
06/27/2022, 3:01 PMVampire
06/27/2022, 3:02 PMDependsOn
😕Vladimir Dolzhenko
06/27/2022, 3:03 PM@DependsOn
support is not implemented cc: @ilya.chernikovilya.chernikov
06/28/2022, 9:12 AM@DependsOn
used to work just fine, but appears to be broken now (in IntelliJ, I mean). Let's discuss it.@DependsOn
doesn't have any effect. If you want to supply specific version, you need to pass -no-stdlib
to compiler somehow.mbonnin
06/28/2022, 9:21 AM@file:KotlinOpts("-J-Xmx5g") @file:KotlinOpts("-J-server") @file:CompilerOpts("-jvm-target 1.8")
but I can see how that's a 🐔 -🥚 problem