From ecb0375de20a0a28862c460f7d8cdd2177d209bc Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Tue, 20 Aug 2019 13:56:52 -0400 Subject: [PATCH] reimplement stack trace suppression Fixes #4964 Together with https://github.com/sbt/util/pull/211, this brings back stack trace supression for custom tasks by default. Debug levels logs are available in `last`, and this prints a message informing the user of the fact. BLUE on dark background is difficult to read, so I am chaning the color hilight to MAGENTA. --- main/src/main/scala/sbt/internal/LogManager.scala | 12 ++++++++---- project/Dependencies.scala | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/main/src/main/scala/sbt/internal/LogManager.scala b/main/src/main/scala/sbt/internal/LogManager.scala index 95ebcab7a..178dd97f9 100644 --- a/main/src/main/scala/sbt/internal/LogManager.scala +++ b/main/src/main/scala/sbt/internal/LogManager.scala @@ -12,7 +12,6 @@ import java.io.PrintWriter import Def.ScopedKey import Scope.GlobalScope import Keys.{ logLevel, logManager, persistLogLevel, persistTraceLevel, sLog, traceLevel } -import scala.Console.{ BLUE, RESET } import sbt.internal.util.{ AttributeKey, ConsoleAppender, @@ -177,9 +176,14 @@ object LogManager { val display = Project.showContextKey(state) def commandBase = "last " + display.show(unwrapStreamsKey(key)) def command(useFormat: Boolean) = - if (useFormat) BLUE + commandBase + RESET else s"'$commandBase'" - context => - Some("Stack trace suppressed: run %s for the full output.".format(command(context.useFormat))) + if (useFormat) s"${scala.Console.MAGENTA}$commandBase${scala.Console.RESET}" + else s"'$commandBase'" + + { context => + Some( + s"stack trace is suppressed; run ${command(context.useFormat)} for the full output" + ) + } } def unwrapStreamsKey(key: ScopedKey[_]): ScopedKey[_] = key.scope.task match { diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 3dffa0ba1..72fccbb53 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -11,7 +11,7 @@ object Dependencies { // sbt modules private val ioVersion = nightlyVersion.getOrElse("1.3.0-M16") - private val utilVersion = nightlyVersion.getOrElse("1.3.0-M9") + private val utilVersion = nightlyVersion.getOrElse("1.3.0-M10") private val lmVersion = sys.props.get("sbt.build.lm.version") match { case Some(version) => version