Notify users about shell only if compile is present

This is a change in strategy.

The motivation is the need to find a good balance between:

  + informing the uninformed that would benefit from this information, &
  + not spamming the already informed

Making it dependent on "compile" being present in remainingCommands will
probably make it trigger for, for example, Maven users who are used to
running "mvn compile" and always run "sbt compile", and who therefore
are unneccesarily suffering terribly slow compile speeds by starting up
the jvm and sbt every time.

Fixes #3091
This commit is contained in:
Dale Wijnand 2017-04-27 15:37:07 +01:00
parent 1c1be9a597
commit 54055835be
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
1 changed files with 2 additions and 4 deletions

View File

@ -572,13 +572,11 @@ object BuiltinCommands {
private def isInteractive = System.console() != null
private def intendsToInvokeShell(state: State) =
(state.remainingCommands contains Shell) ||
(state.remainingCommands.lastOption exists (_ == s"$IfLast $Shell"))
private def intendsToInvokeCompile(state: State) = state.remainingCommands contains Keys.compile.key.label
private def notifyUsersAboutShell(state: State): Unit = {
val suppress = Project extract state getOpt Keys.suppressSbtShellNotification getOrElse false
if (!suppress && isInteractive && !intendsToInvokeShell(state) && !intendsToInvokeNew(state))
if (!suppress && isInteractive && intendsToInvokeCompile(state))
state.log info "Executing in batch mode. For better performance use sbt's shell; hit [ENTER] to do so now"
}