Stan van der Bend
09/25/2023, 12:18 AM:scripting:script-definition:b
depends on :scripting:script-definition:a
which in turn depends on :core
.
What I want is that when I make a change to any of these modules, intellij will always pick up on the changes I made (after I execute some gradle task to recompile the changed modules).
I know people often ask for example projects, but I cannot recreate the issue in example projects because it's not consistent behavior. It has happened in various projects over the last 3 years or so, I have tried so many different approaches, but I can never get Intellij to just consistently pick up on them.
Sometimes the scripts work perfectly and Intellij picks up on them with no issues for days, I simply have to rebuild the specific module containing the script definition, and poof intellij will auto-reload it and all is good.
But then sometimes it just stops working out of nowhere (tho I suspect it has to do with me switching to different projects within intellij, like closing the one I am working on and then opening a different one).
When that happens I try to clean the project, rebuild it, delete the gradle project, reload it, delete intellij cache/indexes but very rarely do any of these steps solve the issue. Then if I rage quit and come back to it the next day, it often does work again magically.
I LOVE KTS, but the IDE support is so flaky, that it's turning my team off from it.
I have read the KEEP document and have considered writing a custom IDE plugin, the issue with that is that the script definitions we use are very subject to change, and from my understanding, the IDE plugin approach means that when I make a change to the script definitions, I would have to rebuild the IntelliJ plugin, which does not work out well for my team.
Anyway, my question is, is there a way to ENSURE that when someone clones the project, IntelliJ will always discover the script definitions? I don't care if I have to hardcode in static paths anywhere or provide some hacky script that will update the intellij project settings, I just want a robust way for Intellij to detect them. Ideally, some kind of gradle task that runs on build and generates the right files for Intellij to pick up on the script definitions.
(I hoped kotlinScriptDef
dependency notation would achieve this but when I try to define those in my root build.gradle.kts, the build
task hangs on`:compileKotlin` however if this is the appropriate way to do this in gradle, I will look into that issue more, so far I wasn't sure if this would actually fix it so didn't spend too much time on it yet.)
OR if there is a way to create an IntelliJ plugin that will automatically pick up on changes made to script definitions and reload them without having to rebuild the plugin, and someone has an example of this, that would be much appreciated too.