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])
|
|
|
|
|
{
|
2009-10-02 04:59:02 +02:00
|
|
|
System.clearProperty("scala.home") // avoid errors from mixing Scala versions in the same JVM
|
2009-08-21 14:12:43 +02:00
|
|
|
CheckProxy()
|
2010-01-13 00:52:14 +01:00
|
|
|
run(args)
|
|
|
|
|
}
|
2010-01-27 00:41:03 +01:00
|
|
|
// 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] =
|
2010-01-13 00:52:14 +01:00
|
|
|
{
|
2010-01-27 00:41:03 +01:00
|
|
|
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)
|
2009-12-18 15:46:04 +01:00
|
|
|
case r: xsbti.RetrieveException =>errorAndExit("Error: " + r.getMessage)
|
2010-01-27 00:41:03 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|
2010-01-27 00:41:03 +01: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)
|
2010-01-27 00:41:03 +01:00
|
|
|
System.exit(1).asInstanceOf[Nothing]
|
2009-08-21 14:12:43 +02:00
|
|
|
}
|
|
|
|
|
}
|