From 54055835be32cd8c34f2b40e99d8b3614b3c7ddc Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Thu, 27 Apr 2017 15:37:07 +0100 Subject: [PATCH] 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 --- main/src/main/scala/sbt/Main.scala | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/main/src/main/scala/sbt/Main.scala b/main/src/main/scala/sbt/Main.scala index 43f5de17f..cffeb90d1 100644 --- a/main/src/main/scala/sbt/Main.scala +++ b/main/src/main/scala/sbt/Main.scala @@ -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" }