mirror of https://github.com/sbt/sbt.git
Merge pull request #4926 from eatkins/auto-reload-fix
Improve auto-reload
This commit is contained in:
commit
8365e4b189
|
|
@ -200,26 +200,25 @@ object MainLoop {
|
|||
}
|
||||
newState
|
||||
}
|
||||
val checkCommand = state.currentCommand match {
|
||||
// If the user runs reload directly, we want to be sure that we update the previous
|
||||
// cache for checkBuildSources / changedInputFiles but we don't want to display any
|
||||
// warnings. Without filling the previous cache, it's possible for the user to run
|
||||
// reload and be prompted with a warning in spite of reload having just run and no build
|
||||
// sources having changed.
|
||||
case Some(exec) if exec.commandLine == "reload" => "checkBuildSources / changedInputFiles"
|
||||
case _ => "checkBuildSources"
|
||||
}
|
||||
Parser.parse(
|
||||
checkCommand,
|
||||
state.copy(remainingCommands = Nil).put(Aggregation.suppressShow, true).combinedParser
|
||||
) match {
|
||||
// The split on space is to handle 'reboot full' and 'reboot'.
|
||||
state.currentCommand.flatMap(_.commandLine.trim.split(" ").headOption) match {
|
||||
case Some("reload") =>
|
||||
// Reset the hasCheckedMetaBuild parameter so that the next call to checkBuildSources
|
||||
// updates the previous cache for checkBuildSources / fileInputStamps but doesn't log.
|
||||
state.get(hasCheckedMetaBuild).foreach(_.set(false))
|
||||
process()
|
||||
case Some("exit") | Some("reboot") => process()
|
||||
case _ =>
|
||||
val emptyState = state.copy(remainingCommands = Nil).put(Aggregation.suppressShow, true)
|
||||
Parser.parse("checkBuildSources", emptyState.combinedParser) match {
|
||||
case Right(cmd) =>
|
||||
cmd() match {
|
||||
case s if s.remainingCommands.headOption.map(_.commandLine).contains("reload") =>
|
||||
Exec("reload", None, None) +: exec +: state
|
||||
case _ => process()
|
||||
}
|
||||
case Left(_) => process()
|
||||
case _ => process()
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
case err: Throwable =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue