Intellij IDEA Kotlin Plugin Dependencies

Answered

I've been messing around with the intellij-community version of IntelliJ IDEA as part of my university thesis work, and I've run into something about the build process that I do not understand. I have some understanding of build systems in other languages but have a mostly superficial understanding of Maven/Gradle, so I think I am missing something important.

When building the Kotlin modules, there is a library dependency on "kotlinc.kotlin-compiler-common" which is provided by a JetBrains Maven repository (via coordinate org.jetbrains.kotlin:kotlin-compiler-common-for-ide:X.X.X-XXXX). When I try to build the base intellij-community git repository everything works as expected. When I've lifted parts of the repository piecemeal and tried to replicate the build process however, I am not able to set up an index of the Maven repository that provides this and similar library dependencies. Simply creating local library jar entries pointing to the downloaded .jar files causes compile-time errors where it appears as if the statically compiled libraries are missing class dependencies which are defined in the intellij-community source (Eg. KotlinLanguage extends Language, KtElement extends NavigatablePsiElement). When I navigate the intellij-community repository code using IntelliSense it appears that IntelliJ thinks the static library depends on the source code implementations of the parent classes, which seems strange to me.

How does this work? Are the parent classes of the Kotlin classes being injected somehow during the build process? Is IntelliSense simply confused as to where the parent classes are actually defined? If the static library depends on static definitions of PsiElement, how does changing the source code implementation of PsiElement affect the build?

Thank you for your attention.

0
3 comments

Kotlin plugin module is not meant to be used outside of IJ project. What exactly are you trying to achieve?

1

Thank you for responding to my question. My thesis work centers around methods for improving transpilation from Java to Kotlin. I am trying to isolate code for J2K/NJ2K to create a CLI executable for J2K. I would like to shed implementation concerns that relate to for example GUI (Event threading, ProgressIndicator), Project and Action abstractions. By doing so I hope to have greater freedom to modify and hopefully improve aspects of the transpilation process and result.

0

Kotlin compiler uses intellij-core 213.7172.25 version as a dependency (link), which include base classes like PsiElement or Project. So here is pipeline:

1. Kotlin compiler compiled against intellij-core and don't bundle any classes from it into jars

2. Intellij community compiles those classes from source

3. Kotlin compiler and those core classes are passed to compile classpath of kotlin-ide modules

 

 

1

Please sign in to leave a comment.