<@U0CHHN4F4> who would i talk to about very specif...
# scripting
n
@ilya.chernikov who would i talk to about very specifically the available libraries and everonment of the idea kotlin plugin executing the refinment blocks ? it seems like some classes can not be loaded in them, possibly deliberately or how i can look at and enable a debug log of idea when it executes the aforementioned refinement blocks or any way to obtain type information from other script files that i could refence from a kts script my current code is in this project and branch: https://github.com/DaemonicLabs/KNote/tree/nikky/dev (execute publishTOMavenLocal and then import
sample/
as a gradle project (or open it in separate idea window, i never do that though, not sure how well it works)
i
The refinement callbacks are called in the environment defined by the script definition classpath, depending o how you configure it. If it is inside source roots, then the module’s classpath is used, if you’re using the fallback solution in the IDEA settings, then the explicit classpath is used.
As of the log, you can check the regular idea log -- Help -> Show log in … — and search lines with
[kts]
prefix there.
🙏 1
n
it is actually in neither.. i think? i configured it with
ide.acceptedLocations.append(ScriptAcceptedLocation.Project)
and the thing is just added as a dependency by gradle i would have thought it would use the fat-jar completely, i am sure it contains the class that is failing, because it works out running by itself
i
I looked at your project. This is not going to work like this, unfortunately. You need to either follow one of the ways I mentioned above, or write (a simple) IDEA plugin that will supply a classpath for your script definition code.
This seems the problem people stumbling on quite often, so we are considering some other ways to do it, but it is not easily solvable, we have to play according to the certain rules when we are handling things in IDEA.
n
ah, thats unfortunate about putting the script into a sourceRoot, if i define one in gradle.. then gradle tries to compile all .kts files
and i seem to be unable to use gradle to configure just idea sourceFolders, it just has no effect on the generated project or .iml files, unless it is also defined as a gradle sourceSet, not sure if its a bug or how to report it
well fow NOW, i do not need to do this, its a difference between writing
@file:FromPage("data")
and
val data: DataFrame by inject()
i would have lked to have a shortcut for generating the code to skip users from typoing on the slightly more complicated DI-like line
i
There is an
idea gradle plugin
- https://docs.gradle.org/current/userguide/idea_plugin.html that may help you to setup source roots, but I’m not familiar with it myself. Or maybe there is a way to skip certain source roots in the gradle compile tasks. In any case, the best approach would be an IDEA plugin. For a moment we are considering either some lightweight way to make plugins from a gradle build (e.g. via buildSrc) or some way to help users to discover a plugin by e.g. script filename extension.
n
thats what i tried, it seems to not have any effect when configuring
idea { module { sourceDirs.append(...)  }}
i think i may have seen a way to evade the restrictions though.. via invoking a process builder instead of calling the function directly it might be possible.. although ... wasteful, but if i can start some sort of daemon that the script configuration can interface with... i might be able to get some other features i wanted anyways