Skip to content
Snippets Groups Projects
Commit 8291f8f7 authored by Emmanouil (Manos) Koukoutos's avatar Emmanouil (Manos) Koukoutos Committed by Manos Koukoutos
Browse files

Make Leon find scala lib in Eclipse

parent f513ef07
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ import purescala.Common.FreshIdentifier ...@@ -9,6 +9,7 @@ import purescala.Common.FreshIdentifier
import utils._ import utils._
import scala.tools.nsc.{Settings=>NSCSettings,CompilerCommand} import scala.tools.nsc.{Settings=>NSCSettings,CompilerCommand}
import java.io.File
object ExtractionPhase extends LeonPhase[List[String], Program] { object ExtractionPhase extends LeonPhase[List[String], Program] {
...@@ -22,15 +23,19 @@ object ExtractionPhase extends LeonPhase[List[String], Program] { ...@@ -22,15 +23,19 @@ object ExtractionPhase extends LeonPhase[List[String], Program] {
val settings = new NSCSettings val settings = new NSCSettings
val neededClasses = List[Class[_]]( val scalaLib = Option(
scala.Predef.getClass scala.Predef.getClass.getProtectionDomain.getCodeSource()
) ) map { _.getLocation.getPath } getOrElse {
// We are in Eclipse. Look in Eclipse plugins to find scala lib
val urls = neededClasses.map{ _.getProtectionDomain().getCodeSource().getLocation() } val eclipsePlugins = System.getenv("ECLIPSE_HOME") + "/plugins"
new File(eclipsePlugins).listFiles().map{ _.getAbsolutePath }.find{ _ contains "scala-library"}.
val classpath = urls.map(_.getPath).mkString(":") getOrElse(ctx.reporter.fatalError("No Scala library found. " +
"If you are working in Eclipse, make sure to set the ECLIPSE_HOME environment variable."
settings.classpath.value = classpath )
)
}
settings.classpath.value = scalaLib
settings.usejavacp.value = false settings.usejavacp.value = false
settings.Yrangepos.value = true settings.Yrangepos.value = true
settings.skip.value = List("patmat") settings.skip.value = List("patmat")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment