I’m trying to integrate `kotlinc` compiler plugins...
# build-tools
t
I’m trying to integrate
kotlinc
compiler plugins into the Pants build tool’s experimental Kotlin backend. I am getting an
AbstractMethodError
in an integration test using the
allopen
plugin. Details in thread.
This is the exception message.
The test command is
./pants test src/python/pants/backend/kotlin/compile/kotlinc_test.py -- -vv -k test_compile_with_kotlinc_plugin
The integration is not using a Kotlin distribution, but rather is resolving jars with Coursier. In this test, the allopen plugin came from resolving
org.jetbrains.kotlin:kotlin-allopen:1.6.20
and then passing the resulting jars via
-Xplugin
The compiler’s classpath was obtained by resolving
org.jetbrains.kotlin:kotlin-compiler:1.6.20
and
org.jetbrains.kotlin:kotlin-scripting-compler:1.6.20
Is the approach of using Coursier-resolved jars a problem?
t
tl;dr Kotlin relocates intellij dependencies for embeddable compiler artifact
and parameter type for
registerProjectComponent
changes
Check this line
t
hmm. So I just switched the Pants kotlin backend to use
kotlin-compiler-embeddable
for the compiler classpath and now the test passes. That jar shading is confusing!
and thanks for the advice!
👍 1
t
you could follow this issue, though not sure when or will it be resolved
t
Are there any downsides to using the
-embeddable
artifacts?
t
right now - no
t
I’ll switch Pants to use the
-embeddable
artifacts then.