diff --git a/src/main/scala/sbt/Main.scala b/src/main/scala/sbt/Main.scala index ef1133661..8c2375b0f 100755 --- a/src/main/scala/sbt/Main.scala +++ b/src/main/scala/sbt/Main.scala @@ -6,17 +6,6 @@ package sbt import java.io.File import scala.collection.immutable.TreeSet -private case class Exit(code: Int) extends xsbti.Exit -{ - require(code >= 0) -} -private case class Reboot(val scalaVersion: String, argsList: List[String], configuration: xsbti.AppConfiguration) extends xsbti.Reboot -{ - def app = configuration.provider.id - def arguments = argsList.toArray - def baseDirectory = configuration.baseDirectory -} - /** This class is the entry point for sbt. If it is given any arguments, it interprets them * as actions, executes the corresponding actions, and exits. If there were no arguments provided, * sbt enters interactive mode.*/ @@ -152,7 +141,9 @@ class xMain extends xsbti.AppMain { case "" :: tail => continue(project, tail, failAction) case (ExitCommand | QuitCommand) :: _ => result( Exit(NormalExitCode) ) - case RebootCommand :: tail => throw new xsbti.FullReload(rememberCurrent(tail).toArray) + case RebootCommand :: tail => + val newID = new ApplicationID(configuration.provider.id, baseProject.sbtVersion.value) + result( new Reboot(project.defScalaVersion.value, rememberCurrent(tail), newID, configuration.baseDirectory) ) case InteractiveCommand :: _ => continue(project, prompt(baseProject, project) :: arguments, interactiveContinue) case SpecificBuild(version, action) :: tail => if(Some(version) != baseProject.info.buildScalaVersion) @@ -704,8 +695,4 @@ class xMain extends xsbti.AppMain private def setProjectError(log: Logger) = logError(log)("Invalid arguments for 'project': expected project name.") private def logError(log: Logger)(s: String) = { log.error(s); false } - private final class ReloadException(val remainingArguments: List[String], val buildScalaVersion: Option[String]) extends RuntimeException - { - override def fillInStackTrace = this - } -} \ No newline at end of file +} diff --git a/src/main/scala/sbt/MainControl.scala b/src/main/scala/sbt/MainControl.scala new file mode 100644 index 000000000..bd74859eb --- /dev/null +++ b/src/main/scala/sbt/MainControl.scala @@ -0,0 +1,31 @@ +/* sbt -- Simple Build Tool + * Copyright 2009, 2010 Mark Harrah + */ +package sbt + +import java.io.File + +private case class Exit(code: Int) extends xsbti.Exit +{ + require(code >= 0) +} +private class Reboot(val scalaVersion: String, argsList: List[String], val app: xsbti.ApplicationID, val baseDirectory: File) extends xsbti.Reboot +{ + def arguments = argsList.toArray +} +private class ApplicationID(delegate: xsbti.ApplicationID, newVersion: String) extends xsbti.ApplicationID +{ + def groupID = delegate.groupID + def name = delegate.name + def version = newVersion + + def mainClass = delegate.mainClass + def mainComponents = delegate.mainComponents + def crossVersioned = delegate.crossVersioned + + def classpathExtra = delegate.classpathExtra +} +private final class ReloadException(val remainingArguments: List[String], val buildScalaVersion: Option[String]) extends RuntimeException +{ + override def fillInStackTrace = this +} \ No newline at end of file