Hi, everyone! Are there any plans to load "local" ...
# kotlin-toolchain
g
Hi, everyone! Are there any plans to load "local" Kotlin compiler plugins? My use case is that I have multimodule project where several modules contain compiler plugins that are needed for other modules. In Gradle, I use
Copy code
dependencies {
    add(PLUGIN_CLASSPATH_CONFIGURATION_NAME, project("..."))
}
for compiler dependency declarations. So it would be cool to declare such compiler dependencies in Kotlin Toolchain as well. If it's strange, then it would be cool to at least let compiler plugins be loaded from JAR files. But I didn't find any tickets about the issue. Should I create one?
j
Indeed this case was never brought up before, and I don't think we have a ticket for it. Don't hesitate to create one 🙏🏼
One question, does IDE support work for your local compiler plugins in Gradle projects? That would be the trickiest part
g
Yes, IDEA loads them. But there are 2 conditions: 1) enable non-official compiler plugins loading in IDEA (via flag and so on) and 2) compile the compiler plugin and then resync the project again.
Created the ticket. Let a link to it be here: KTC-5839
🙏 1
j
I see. The problem with the special flag for 3rd party compiler plugins in the IDE is that it doesn't really work properly. Your plugins must be for the exact Kotlin compiler version that is embedded in the IDE for it to work, otherwise you might face strange exceptions. Did it work smoothly for you so far? I'm not sure that flag will eventually become the way to go. There is also the KEFS initiative as an alternative.
I don't see big blockers for such a feature in the CLI, but without official IDE support, only a certain class of plugins will be usable.
So I can't promise this will be in the short term plans
FYI, at the moment, the Kotlin Toolchain doesn't support that special IDE flag, only built-in plugins or plugins provided by KEFS (which I think require maven coordinates). Adding support for that requires some rework (not a redo-the-world task, but definitely no small task). Hence my doubts
Thanks a lot for the ticket!
❤️ 1
g
Did it work smoothly for you so far?
Yeah, I didn't use IDEA's Kotlin version. But last release/RC/Beta compiler version instead. And everything works fine. Well. actually there is an issue with one of my plugins. But it's Analysis API issue (filed on YouTrack). All other things wok very smoothly.
FYI, at the moment, the Kotlin Toolchain doesn't support that special IDE flag, only built-in plugins or plugins provided by KEFS (which I think require maven coordinates).
Got it. Thank you for the remark! Also, I didn't take look at KEFS, but I'll do it soon. Maybe, I'll use this way as well.
So I can't promise this will be in the short term plans
That's OK! I just wanted to know if it's OK to file this unusual case 🙂
j
> That's OK! I just wanted to know if it's OK to file this unusual case Oh it's always no problem to file cases, we can always triage stuff and see. Sometimes opening ticket brings a surprising amount of upvotes, and it's less unusual than we thought 😄 Well in this case, I think compiler plugins are rather hardcore, and the public API is not even really clear yet, so only a handful of people actually dare write them. So yeah it might be a bit unusual, but for the compiler plugin authors, it might actually be reasonable to test their plugin in a sibling module, even if temporarily.
Regarding KEFS, I think it will likely not work for you. The whole idea is to provision a different version of the plugin than the one that's on the real compiler classpath, to match the exact version (possibly development version) of the compiler that's in the IDE. So I don't think it can work for local plugins