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 13:26:17 +01:00
parent a6af8c50c8
commit 1c1be9a597
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
2 changed files with 6 additions and 3 deletions

View File

@ -64,6 +64,7 @@ object Keys {
val shellPrompt = SettingKey(BasicKeys.shellPrompt)
val analysis = AttributeKey[inc.Analysis]("analysis", "Analysis of compilation, including dependencies and generated outputs.", DSetting)
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 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)

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) ++
compatCommands
def DefaultBootCommands: Seq[String] =
WriteSbtVersion :: NotifyUsersAboutShell :: LoadProject :: s"$IfLast $Shell" :: Nil
WriteSbtVersion :: LoadProject :: NotifyUsersAboutShell :: s"$IfLast $Shell" :: Nil
def boot = Command.make(BootCommand)(bootParser)
@ -576,9 +576,11 @@ object BuiltinCommands {
(state.remainingCommands contains Shell) ||
(state.remainingCommands.lastOption exists (_ == s"$IfLast $Shell"))
private def notifyUsersAboutShell(state: State) =
if (isInteractive && !intendsToInvokeShell(state) && !intendsToInvokeNew(state))
private def notifyUsersAboutShell(state: State): Unit = {
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"
}
private def NotifyUsersAboutShell = "notify-users-about-shell"