File tree 1 file changed +10
-1
lines changed
compiler/src/dotty/tools/dotc/quoted 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import dotty.tools.repl.AbstractFileClassLoader
9
9
import scala .quoted .Expr
10
10
import java .io .ByteArrayOutputStream
11
11
import java .io .PrintStream
12
+ import java .net .URLClassLoader
12
13
import java .nio .charset .StandardCharsets
13
14
14
15
class QuoteDriver extends Driver {
@@ -55,7 +56,15 @@ class QuoteDriver extends Driver {
55
56
56
57
override def initCtx : Context = {
57
58
val ictx = super .initCtx.fresh
58
- val classpath = System .getProperty(" java.class.path" )
59
+ var classpath = System .getProperty(" java.class.path" )
60
+ this .getClass.getClassLoader match {
61
+ case cl : URLClassLoader =>
62
+ // Loads the classes load by this class loader
63
+ // When executing `run` or `test` in sbt the classpath is not in th property java.class.path
64
+ val newClasspath = cl.getURLs.map(_.getFile())
65
+ classpath = newClasspath.mkString(" " , " :" , if (classpath == " " ) " " else " :" + classpath)
66
+ case _ =>
67
+ }
59
68
ictx.settings.classpath.update(classpath)(ictx)
60
69
ictx
61
70
}
You can’t perform that action at this time.
0 commit comments