sbt/launch/Boot.scala

43 lines
1.0 KiB
Scala
Raw Normal View History

2009-08-21 14:12:43 +02:00
/* sbt -- Simple Build Tool
* Copyright 2009 Mark Harrah
*/
package xsbt.boot
import java.io.File
// The entry point to the launcher
object Boot
{
def main(args: Array[String])
{
System.clearProperty("scala.home") // avoid errors from mixing Scala versions in the same JVM
2009-08-21 14:12:43 +02:00
CheckProxy()
run(args)
}
// this arrangement is because Scala 2.7.7 does not properly optimize away
// the tail recursion in a catch statement
final def run(args: Array[String]): Unit = run(runImpl(args))
private def runImpl(args: Array[String]): Array[String] =
{
try
{
Launch(args.toList)
System.exit(0).asInstanceOf[Nothing]
}
2009-08-21 14:12:43 +02:00
catch
{
2009-12-11 03:04:51 +01:00
case b: BootException => errorAndExit(b.toString)
case r: xsbti.RetrieveException =>errorAndExit("Error: " + r.getMessage)
case r: xsbti.FullReload => r.arguments
2009-08-21 14:12:43 +02:00
case e =>
e.printStackTrace
2009-12-11 03:04:51 +01:00
errorAndExit(Pre.prefixError(e.toString))
2009-08-21 14:12:43 +02:00
}
}
private def errorAndExit(msg: String): Nothing =
2009-08-21 14:12:43 +02:00
{
2009-12-11 03:04:51 +01:00
System.out.println(msg)
System.exit(1).asInstanceOf[Nothing]
2009-08-21 14:12:43 +02:00
}
}