@@ -3,13 +3,14 @@ package dotty.tools.dotc.quoted
33import dotty .tools .dotc .ast .tpd
44import dotty .tools .dotc .Driver
55import dotty .tools .dotc .core .Contexts .Context
6- import dotty .tools .dotc .core .StdNames ._
76import dotty .tools .io .{AbstractFile , Directory , PlainDirectory , VirtualDirectory }
87import dotty .tools .repl .AbstractFileClassLoader
98import dotty .tools .dotc .printing .DecompilerPrinter
109
1110import scala .quoted .Expr
1211
12+ import java .net .URLClassLoader
13+
1314class QuoteDriver extends Driver {
1415 import tpd ._
1516
@@ -61,7 +62,15 @@ class QuoteDriver extends Driver {
6162
6263 override def initCtx : Context = {
6364 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+ }
6574 ictx.settings.classpath.update(classpath)(ictx)
6675 ictx
6776 }
0 commit comments