hello, does anyone can help me with `K2JVMCompiler...
# announcements
t
hello, does anyone can help me with
K2JVMCompiler
?
o
tarlekon: what are you trying to do?
t
Zdravstvuite , mozem po russki ?
n
nyet inachye, bedniye lyudi kak ya nye mogut ponimat
simple smile 2
👍 1
😆 6
t
hello
Problem description in here :
and in here :
I get source code of kotlin kompiller. And see no way how to fix it without writing custom
K2JVMCompiler
o
Did you see this? https://github.com/ligee/kotlin-jupyter cc @ilya.chernikov
t
is "twosigma" linck is visible ?
yes I saw this
n
@orangy was faster than me...
t
Main problem that I do not have Kotlin local
and I have nothing to set in
kotlinHome
I get only java installed on local PC and can operate only with jar files
see "twosigma" link I write some solutions in "How to fix:" section
I described problem in detain in those links
any suggestions ? ideas ?
o
I pinged @ilya.chernikov, he will respond when he has time.
t
ok, thanks, will wait. Ask if something not clear.
i
Hi @tarlekon I see now that there is an answer here: https://discuss.kotlinlang.org/t/k2jvmcompiler/3629/2, that will probably solve your current issue. But you seems trying to use our internal classes to implement the functionality you want. While you’re of course free to do it, there will be problems on that way, since these parts are not designed as a public API. The problem your’e facing right now is exactly because of that:
K2JVMCompiler
is designed for command-line usage in the standard environment. If you’ll choose to “fix”
K2JVMCompiler
, you may meet the compatibility problem right on the next release, since we cannot guarantee compatibility for the internal classes. So, I wouldn’t recommend that. The “official way” (well, still with some reservations) to embed kotlin now is via JSR223 interface (see e.g. an example here - https://github.com/JetBrains/kotlin/tree/master/libraries/examples/kotlin-jsr223-local-example). The alternative would be to adapt aforementioned https://github.com/ligee/kotlin-jupyter for your needs. And while it also uses some compiler internals, these are the same used for the official JSR223 interface and therefore have more chances to remain as is. These variants are suitable for the script/REPL types of usages. We are thinking about providing more general “compiler API”, but there is nothing yet to rely on.
👍 1
t
So can this functionality be implemented not based on
K2JVMCompiler
?
or for now it is only way ?
i
If your usage resembles a script execution or a REPL, then you’ll be better of with JSR-223 - https://github.com/JetBrains/kotlin/tree/master/libraries/examples/kotlin-jsr223-local-example