darkmoon_uk
06/29/2025, 1:17 AM.kts
scripts instead of `.sh`; keeping more complex scripts in a powerful, familiar language.
Unfortunately the usefulness of kts
is unduly limited by IntelliJ IDE's failure to resolve symbols across @file:Import
dependencies - this is an essential feature for composing scripts together e.g. importing some library functions from a common.kts
- meanwhile the scripts still run fine, it's just IDE support that's lacking.
This problem has only become more impactful with junie Junie; as the agent sees 'unresolved' false positives and erroneously act upon them, struggling for a fix that never comes.
kodee sad This limitation is very sad, given it's been hanging for over 2 years...
KTIJ-16352 Scripts / IDE: unresolved reference when trying to import file in main.kts scripts with @Import annotation
Any insights into this issue in or outside of JB? Is scripting just abandoned beyond what's needed for Gradle? Such a shame, it's a killer feature in my book.mbonnin
06/29/2025, 10:57 AMImport
support would be quite important to organize scripts a bit bettermbonnin
06/29/2025, 10:59 AMImport
IDE support) and a bit of education, main.kts
could become quite big.darkmoon_uk
06/29/2025, 10:22 PM.main.kts
use-case would continue to be supported (implying that should include support for things like `Import`s in said main
scripts?).
I'm in a bit of a dilemma with it now - I like your suggestion of a single Clikt based script, but at 1,700 lines on the first cut, that's getting a bit unwieldy for man or machine.
My use case is total of 5 operations that prepare AWS at an org level then orchestrate Terraform operations at an App level within the org. It's mostly invoking other tools but I wanted to add in some safety for scoping out what objects already exist in the environment - hence the increased level of logic and draw towards kts
. Maybe I'll just recognise it as a full blown JVM project(!?)
...or just reluctantly go back to .sh
scripts. Once again, sad that @file:Import
breakage in the IDE is my nail in the coffin for kts
usage. I don't have the time to dig into the IDE integration source - that'd be a whole new area for me.mbonnin
06/29/2025, 10:34 PMit seems to suggest that at least theThis is what I understand as well, despite the relatively not engaging post. I wrote a follow up there: https://mbonnin.net/2024-11-21_state-of-kotlin-scripting/use-case would continue to be supported.main.kts
1,700 lines on the first cut, that's getting a bit unwieldy for man or machine.At that stage, another solution is to start pulling Gradle and make it a "real" project with
run
JavaExec task. Sure, it's a bit more boilerplate but doesn't take that long to setup.
Don't get me wrong, I'd still love to get support for @file:Import
but until this is supported, I'd rather have extra build.gradle
files than going back to .sh
filesdarkmoon_uk
06/29/2025, 10:36 PMdarkmoon_uk
06/29/2025, 10:37 PMkts
would be anyway; just without its sugar.mbonnin
06/29/2025, 10:40 PMsrc/main/kotlin
and build.gradle.kts
ceremony 🤷darkmoon_uk
06/29/2025, 10:49 PM./infra.main.kts org bootstrap
etc.darkmoon_uk
06/29/2025, 10:50 PMkts
🙃 🐢mbonnin
06/29/2025, 10:54 PMThere's a qualitative difference between saying 'go and compile this project, now invoke a JAR file buried in some output folder',Yea... Would be really cool to have
kotlinc
become as ubiquitous as sh
darkmoon_uk
06/29/2025, 10:55 PMdarkmoon_uk
06/29/2025, 10:55 PM