From 8bd522511da896e742184eb0ff7ed901fe008540 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Fri, 15 Dec 2017 08:55:53 +0000 Subject: [PATCH] Make CaffeineCache a lazy val This is to avoid it initialising Log4J2 (via SLF4J), which we initialise ourselves programmatically in LogExchange. Also there's no need to removeAll in initialState. Fixes #3787 --- main/src/main/scala/sbt/Main.scala | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/main/src/main/scala/sbt/Main.scala b/main/src/main/scala/sbt/Main.scala index 09d668c4b..6c605056e 100644 --- a/main/src/main/scala/sbt/Main.scala +++ b/main/src/main/scala/sbt/Main.scala @@ -103,7 +103,7 @@ object StandardMain { private[sbt] lazy val exchange = new CommandExchange() import scalacache._ import scalacache.caffeine._ - private[sbt] val cache: Cache[Any] = CaffeineCache[Any] + private[sbt] lazy val cache: Cache[Any] = CaffeineCache[Any] def runManaged(s: State): xsbti.MainResult = { val previous = TrapExit.installManager() @@ -135,9 +135,6 @@ object StandardMain { Exec(x, None) } val initAttrs = BuiltinCommands.initialAttributes - import scalacache.modes.scalaFuture._ - import scala.concurrent.ExecutionContext.Implicits.global - cache.removeAll() val s = State( configuration, initialDefinitions,