@@ -3,13 +3,14 @@ package dotty.tools.dotc.quoted
3
3
import dotty .tools .dotc .ast .tpd
4
4
import dotty .tools .dotc .Driver
5
5
import dotty .tools .dotc .core .Contexts .Context
6
- import dotty .tools .dotc .core .StdNames ._
7
6
import dotty .tools .io .{AbstractFile , Directory , PlainDirectory , VirtualDirectory }
8
7
import dotty .tools .repl .AbstractFileClassLoader
9
8
import dotty .tools .dotc .printing .DecompilerPrinter
10
9
11
10
import scala .quoted .Expr
12
11
12
+ import java .net .URLClassLoader
13
+
13
14
class QuoteDriver extends Driver {
14
15
import tpd ._
15
16
@@ -61,7 +62,15 @@ class QuoteDriver extends Driver {
61
62
62
63
override def initCtx : Context = {
63
64
val ictx = super .initCtx.fresh
64
- val classpath = System .getProperty(" java.class.path" )
65
+ var classpath = System .getProperty(" java.class.path" )
66
+ this .getClass.getClassLoader match {
67
+ case cl : URLClassLoader =>
68
+ // Loads the classes loaded by this class loader
69
+ // When executing `run` or `test` in sbt the classpath is not in the property java.class.path
70
+ val newClasspath = cl.getURLs.map(_.getFile())
71
+ classpath = newClasspath.mkString(" " , " :" , if (classpath == " " ) " " else " :" + classpath)
72
+ case _ =>
73
+ }
65
74
ictx.settings.classpath.update(classpath)(ictx)
66
75
ictx
67
76
}
0 commit comments