I figured out that I need to add `implicitReceiver...
# scripting
I figured out that I need to add
both in compilation configuration and evaluation configuration, but now I have
java.lang.IllegalArgumentException: Unknown key Key(baseClass)
when i tried that .. i could not get it to work.. so what i instead did was make my script class extend the Builder,
in your case and passed the constructor args
for just a single implicit receiver this works better and idea deals with it very well
tbf, i did not try to get implicitReceivers working for very long
I guess that I can do that as workaround. But for that I need the
to be open which is not always convenient.
Script compilation needs
- a superclass for script code generation - in the compilation configuration. (Maybe this is a non-necessary limitation and we’ll drop it in the future) It should be either put there manually, or, preferably, by annotating base class with a
and then creating a(n extendable) configuration from it. See e.g. here - https://github.com/JetBrains/kotlin/blob/1.3.20/libraries/examples/scripting/jvm-simple-script/host/src/org/jetbrains/kotlin/script/examples/jvm/simple/host/host.kt#L19
I've tried to use
as a base class. The script compiles, but does not affect the receiver state.
That’s quite strange. If you have a repro, please let me have a look.
I am not sure that the problem is with receiver, because it does not display the message from script
OK, I think I see the problem now, I assumed that all diagnostic messages come with throwables, but they are not. It says it can't see receiver
Ah, yes. The proper docs/tutorials are still missing, sorry about it. So do you know why it can’t see the receiver too?
It seems that only JDK classpath is passed to the script context. My classes are missing
Fixed it! I needed to use
dependenciesFromCurrentContext(wholeClasspath = true)
. Thanks a lot
You figured out almost everything yourself, so nothing really to thank about. 🙂 Congrats!
I will finish the debug and post a reference to the channel. I needed your word that it should work 🙂