I am trying to migrate beakerx kotlin evaluator to...
# scripting
a
I am trying to migrate beakerx kotlin evaluator to scripting from REPL engine. So I will probably have a lot of questions. First one: is there a way to determine current kotlin compiler version from inside the program?
i
Do you need to check from a script a language version the script is being compiled with? Or actual runtime/stdlib version the script is being run on? Or you need to get the compiler jar version from your host? Please, explain your use case.
a
I need just some number to show in kernel information for user to know the language level. It is actually pre-compiled in kernel. Previously guys just used the constant from scrip-runtime. I wonder if scripting host has a similar constant.
i
Show from the host or from the script (like having a function/constant accessible from the script itself)?
a
i
the
org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION
constant should still be available, as far as I see. And I’m not sure that we can offer better mechanism for your case (provided that I understood it correctly).
a
Thanks. Probably I just do not see the library from current configuration.
i
Runtime is now packed into stdlib, so you can try to use it instead.
a
does it have the same path? Because I did use stdlib 1.3.30 and did not find
KotlinCompilerVersion
i
Hmm, let me check…
Oh, I see. This is not part of stdlib, indeed. But it is available in the kotlin-compiler.jar instead. Are you using it as a dependency?
a
Nope, I use jvm-host. I am not sure I understand the difference, but it works.
i
kotlin-scripting-jvm-host
?
a
yes, I think...
Copy code
compile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: '1.3.30'
    compile group: 'org.jetbrains.kotlin', name: 'kotlin-scripting-jvm', version: '1.3.30'
    compile group: 'org.jetbrains.kotlin', name: 'kotlin-scripting-jvm-host-embeddable', version: '1.3.30'
i
it depends on the
kotlin-compiler
(
-embeddable
) in your case, so the constant should be available. So I guess it should work if you just drop runtime.
It maybe not nice to use transitive dependency though. So probably we need an explicit API for that in the host or elsewhere in the scripting infrastructure.