smallshen
08/18/2024, 10:11 AMhfhbd
08/18/2024, 10:21 AMsmallshen
08/18/2024, 11:22 AMdmitriy.novozhilov
08/19/2024, 7:49 AMThe Kotlin compiler heavily uses IntelliJs code baseNot entirely true. There are quite few things from intellij which are actually used by the compiler: • parser abstraction (
LighterASTNode
)
• PSI interfaces for implementation of `KtElement`s (mostly used by the IDE plugin, the compiler works without PSI)
• java analysis for java source files (the biggest part, which we want to implement by ourselves)
• some infrastructure like filesystem IO for searching in classpathdmitriy.novozhilov
08/19/2024, 7:55 AMorg.jetbrains.kotlin:kotlin-compiler
and org.jetbrains.kotlin:kotlin-compiler-embeddable
jars, so you can depend on one of them and reuse everything from the compiler programmatically
AFAIR those jars don't include only Native backend, which is included into org.jetbrains.kotlin:kotlin-native-compiler-embeddable
(some classes probably duplicated between compiler
and native-compiler
)
The difference between ...compiler
and ...compiler-embeddable
is that the embeddable
jar contains shaded dependencies: almost all classes not from org.jetbrains.kotlin
package are repackaged (so a.b.Some
class becomes org.jetbrains.kotlin.a.b.Some
). This is needed to avoid potential problems with dependencies versions in projects which depend both on kotlin compiler and some of its (separately, probably transitive)