silence coursier log when supershell is off

This commit is contained in:
Eugene Yokota 2019-05-11 00:56:40 -04:00
parent 1ba195a4f5
commit 9137e21028
2 changed files with 15 additions and 2 deletions

View File

@ -242,7 +242,7 @@ object Defaults extends BuildCommon {
forceUpdatePeriod :== None,
// coursier settings
csrExtraCredentials :== Nil,
csrLogger :== None,
csrLogger := LMCoursier.coursierLoggerTask.value,
csrCachePath :== LMCoursier.defaultCacheLocation,
csrMavenProfiles :== Set.empty,
)

View File

@ -9,11 +9,12 @@ package sbt
package internal
import java.io.File
import lmcoursier.definitions.{ Classifier, Configuration => CConfiguration }
import lmcoursier.definitions.{ Classifier, Configuration => CConfiguration, CacheLogger }
import lmcoursier._
import sbt.librarymanagement._
import Keys._
import sbt.internal.librarymanagement.{ CoursierArtifactsTasks, CoursierInputsTasks }
import sbt.util.Logger
private[sbt] object LMCoursier {
def defaultCacheLocation: File = CoursierDependencyResolution.defaultCacheLocation
@ -89,6 +90,18 @@ private[sbt] object LMCoursier {
}
}
def coursierLoggerTask: Def.Initialize[Task[Option[CacheLogger]]] = Def.task {
val st = Keys.streams.value
val progress = useSuperShell.value
if (progress) None
else Some(new CoursierLogger(st.log))
}
private[sbt] class CoursierLogger(logger: Logger) extends CacheLogger {
override def downloadedArtifact(url: String, success: Boolean): Unit =
logger.debug(s"downloaded $url")
}
def publicationsSetting(packageConfigs: Seq[(Configuration, CConfiguration)]): Def.Setting[_] = {
csrPublications := CoursierArtifactsTasks.coursierPublicationsTask(packageConfigs: _*).value
}