Introduce suppressSbtShellNotification

This requires moving the notification to after LoadProject, so much
later in time, sadly..

Refs #3091
This commit is contained in:
Dale Wijnand
2017-04-27 16:34:32 +01:00
parent a6af8c50c8
commit 1c1be9a597
2 changed files with 6 additions and 3 deletions
+1
View File
@@ -64,6 +64,7 @@ object Keys {
val shellPrompt = SettingKey(BasicKeys.shellPrompt) val shellPrompt = SettingKey(BasicKeys.shellPrompt)
val analysis = AttributeKey[inc.Analysis]("analysis", "Analysis of compilation, including dependencies and generated outputs.", DSetting) val analysis = AttributeKey[inc.Analysis]("analysis", "Analysis of compilation, including dependencies and generated outputs.", DSetting)
val watch = SettingKey(BasicKeys.watch) val watch = SettingKey(BasicKeys.watch)
val suppressSbtShellNotification = SettingKey[Boolean]("suppressSbtShellNotification", """True to suppress the "Executing in batch mode.." message.""", CSetting)
val pollInterval = SettingKey[Int]("poll-interval", "Interval between checks for modified sources by the continuous execution command.", BMinusSetting) val pollInterval = SettingKey[Int]("poll-interval", "Interval between checks for modified sources by the continuous execution command.", BMinusSetting)
val watchSources = TaskKey[Seq[File]]("watch-sources", "Defines the sources in this project for continuous execution to watch for changes.", BMinusSetting) val watchSources = TaskKey[Seq[File]]("watch-sources", "Defines the sources in this project for continuous execution to watch for changes.", BMinusSetting)
val watchTransitiveSources = TaskKey[Seq[File]]("watch-transitive-sources", "Defines the sources in all projects for continuous execution to watch.", CSetting) val watchTransitiveSources = TaskKey[Seq[File]]("watch-transitive-sources", "Defines the sources in all projects for continuous execution to watch.", CSetting)
+5 -3
View File
@@ -99,7 +99,7 @@ object BuiltinCommands {
ifLast, multi, shell, continuous, eval, alias, append, last, lastGrep, export, boot, nop, call, exit, early, initialize, act) ++ ifLast, multi, shell, continuous, eval, alias, append, last, lastGrep, export, boot, nop, call, exit, early, initialize, act) ++
compatCommands compatCommands
def DefaultBootCommands: Seq[String] = def DefaultBootCommands: Seq[String] =
WriteSbtVersion :: NotifyUsersAboutShell :: LoadProject :: s"$IfLast $Shell" :: Nil WriteSbtVersion :: LoadProject :: NotifyUsersAboutShell :: s"$IfLast $Shell" :: Nil
def boot = Command.make(BootCommand)(bootParser) def boot = Command.make(BootCommand)(bootParser)
@@ -576,9 +576,11 @@ object BuiltinCommands {
(state.remainingCommands contains Shell) || (state.remainingCommands contains Shell) ||
(state.remainingCommands.lastOption exists (_ == s"$IfLast $Shell")) (state.remainingCommands.lastOption exists (_ == s"$IfLast $Shell"))
private def notifyUsersAboutShell(state: State) = private def notifyUsersAboutShell(state: State): Unit = {
if (isInteractive && !intendsToInvokeShell(state) && !intendsToInvokeNew(state)) val suppress = Project extract state getOpt Keys.suppressSbtShellNotification getOrElse false
if (!suppress && isInteractive && !intendsToInvokeShell(state) && !intendsToInvokeNew(state))
state.log info "Executing in batch mode. For better performance use sbt's shell; hit [ENTER] to do so now" state.log info "Executing in batch mode. For better performance use sbt's shell; hit [ENTER] to do so now"
}
private def NotifyUsersAboutShell = "notify-users-about-shell" private def NotifyUsersAboutShell = "notify-users-about-shell"