https://kotlinlang.org logo
#build-tools
Title
# build-tools
t

Tom Dyas

04/19/2022, 1:25 PM
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

tapchicoma

04/19/2022, 1:32 PM
tl;dr Kotlin relocates intellij dependencies for embeddable compiler artifact
and parameter type for
registerProjectComponent
changes
Check this line
t

Tom Dyas

04/19/2022, 1:40 PM
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

tapchicoma

04/19/2022, 1:43 PM
you could follow this issue, though not sure when or will it be resolved
t

Tom Dyas

04/19/2022, 1:45 PM
Are there any downsides to using the
-embeddable
artifacts?
t

tapchicoma

04/19/2022, 1:47 PM
right now - no
t

Tom Dyas

04/19/2022, 1:52 PM
I’ll switch Pants to use the
-embeddable
artifacts then.
6 Views