Fix console-project

This commit is contained in:
Mark Harrah 2010-01-11 20:21:55 -05:00
parent 8516a40ec2
commit 76b31e4fcf
1 changed files with 6 additions and 5 deletions

View File

@ -106,16 +106,17 @@ object Run
{
override def createInterpreter()
{
def urlClassLoader(c: Class[_]) = c.getClassLoader.asInstanceOf[URLClassLoader]
val loader = urlClassLoader(project.getClass)
val urls = List(loader, urlClassLoader(classOf[xsbti.Launcher])).flatMap(_.getURLs) // TODO: this is fragile and should be done better
compilerSettings.classpath.value = urls.flatMap(ClasspathUtilities.asFile).map(_.getAbsolutePath).mkString(File.pathSeparator)
val projectLoader = project.getClass.getClassLoader
val launcherJar = FileUtilities.classLocationFile[xsbti.Launcher]
val app = project.info.app
val classpathFiles = app.mainClasspath ++ app.scalaProvider.jars ++ Array(launcherJar)
compilerSettings.classpath.value = classpathFiles.map(_.getAbsolutePath).mkString(File.pathSeparator)
project.log.debug(" Compiler classpath: " + compilerSettings.classpath.value)
in = InteractiveReader.createDefault()
interpreter = new Interpreter(settings)
{
override protected def parentClassLoader = loader
override protected def parentClassLoader = projectLoader
override protected def newCompiler(settings: Settings, reporter: Reporter) = super.newCompiler(compilerSettings, reporter)
}
interpreter.setContextClassLoader()