Can the kotiln compiler use a classloader for its classpath?


#1

I’m working on a Jenkins plugin to allow kotlin to be used for the admin scripting console. I was able to get things working using the kotlin-compiler-embeddable (I used the embeddable because of guava version conflict issues). Right now I have things working by doing some funky introspection to find the locations of the jars and other class files loaded by jenkins, and then passing those locations as a string to the K2JVMCompiler args. It works well enough, but is a little slow due to loading a large number of classes, and it might not work for all Jenkins installations.

Is it possible to pass a classloader to the compiler (well, the byte code generator), instead of a class path. I’ve been poking around and it seems like you might be able to somehow map a URLClassloader to a set of VirtualFile, but I’m not sure.

Anybody know if it’s possible?