Hey, has anyone had any experience with a compiler...
# compiler
d
Hey, has anyone had any experience with a compiler plugin that works for both JVM and native? I've got a JVM plugin working but having some trouble getting plugins to work for native. I've been compiling against
kotlin-compiler-embeddable
(which has been working great for JVM) but it seems to have a bunch of dependencies remapped under
org.jetbrains.kotlin
. The problem is
konanc
, even when run from gradle just like I'm doing for JVM, doesn't seem to have those packages remapped so my plugin doesn't load since it's referencing the wrong classes. Is it possible to write a plugin that works for both JVM/native at the moment?
f
Hi, i wrote a plugin library that can be used in both plugins. AFAIK you can't have one plugin for both. Because Native needs "org.jetbrains.kotlin:kotlin-compiler" and JMV/JS needs "org.jetbrains.kotlin:kotlin-compiler-embeddable". I also had problems with "wrong" classes. My problem was that the kotlin-compiler is using com.intellij.mock.MockProject but the kotlin-compiler-embeddable is using org.jetbrains.kotlin.com.intellij.mock.MockProject. But i was able to use my extension classes shared for both compilers.
d
Ah yeah that's the same problem I'm having, guess I'll just have to write separate plugins then. Thanks!
s
@Foso how were you able to get the plugin to expect the
intellij.mock.MockProject
rather than org.jetbrains.kotlin.com.intellij.mock.MockProject?
a
probably has a wrapper callback in each version of the plugin that the other code calls that abstracts that.
f
This thread is very old, but in case someone is looking for a current answer: Since a while, you can use one plugin for all targets. I use the embeddable version for my projects.
a
great
thanks Jens