I know there’s no official compiler plugin API (so I understand if there’s nothing that can really be done about this) but I’ve been enjoying looking at the existing ones and attempting to make my own. I have a basic compiler plugin working for the JVM and I’m hoping to get it working for native as well but I’m running into issues getting it to work with both at the same time.
From my understanding it seems like the
kotlin-compiler-embeddable artifact (which the gradle plugin runs for JVM projects) remaps the packages of dependencies under
org.jetbrains.kotlin, but if you install kotlin yourself and just run
konanc it does not have those packages remapped.
So I built my plugin against the
kotlin-compiler-embeddable artifact (and therefore referencing the remapped classes) since that works for JVM, but it seems like
konanc does not have those remapped classes and therefore my plugin fails to load.
Is there any reason why, within the same gradle project, one method of compilation uses the remapped classes but another does not? How is it possible to build a plugin that works for both types without including it directly in the compiler project so it gets remapped as necessary?