Am I right that a plugin forked from <https://gith...
# compiler
t
Am I right that a plugin forked from https://github.com/demiurg906/kotlin-compiler-plugin-template would need a compiler version of 1.9+ for the project that uses the plugin? Also, for FIR to work in the editor, should I use an EAP IDEA? These are not problems for me, I just want to figure out how to proceed.
f
Newbie here: fir means that those APIs are used by the front end and so the editor also uses them? So that if I generate extra classes or methods the editor will not complain that they do not exist?
t
Yes. Here is some very useful information about it: https://kotlinlang.slack.com/archives/C7L3JB43G/p1622478266038500
d
Am I right that a plugin forked from ... would need a compiler version of 1.9+? for the project that uses the plugin?
No, you can use any stable compiler to compile plugin itself But it's better to depend on
kotlin-compiler-embedable
of most recent dev version, because atm compiler API changes quite often (not the extensions API, but compiler internals itself)
Also, for FIR to work in the editor, should I use an EAP IDEA? These are not problems for me, I just want to figure out how to proceed.
There is a prototype of out-of-box plugin support (plugins automatically loaded into IDE from gradle configuration) in K2 IDE plugin. But K2 IDE itself is not avaliable anywhere except
master
IDEA branch. So if you want to play with it you need to build IDEA from sources (there is a prepared
IDEA Community (K2 Kotlin)
run configuration for that. Also you will need to set
kotlin.k2.only.bundled.compiler.plugins.enabled
registry key to
true
in the IDE you built to enable plugins loading (there are not solved questions about binary compatibility, so by default only official plugins are loaded)
j
@dmitriy.novozhilov I am testing the IDE support and I am 100% sure the plugin is registered and the FIR part is picked up as if I hardcode throwing an exception on, for example,
getTopLevelCallableIds
function, I get the popup with the exception. But looks like the
generateFunctions
is not called at all, same code is working on the test framework tests, but not in the sandbox project. Any idea what can be happening?
running the main function works so FIR is working but not directly on the IDE
d
@Roman Golyshev can you help with this problem?
r
Hi Javier! Please try setting
kotlin.k2.only.bundled.compiler.plugins.enabled
to
false
and reimport the project
j
Yeah, I did that, I tried both, true/false, and restarting the IDE
IDE compiled yesterday at 5PM or so
r
Is it possible for you to zip your project together with the plugin’s jar and send it to us?
j
yep, let me a few minutes/hours, after doing more tries, now Gradle is failing with
Protocol message contained an invalid tag (zero).
I think it was the issue related to using 2.0 and Gradle embedded using 1.8.10.