Fix compilation warnings

This commit is contained in:
Alexandre Archambault 2017-05-02 22:15:40 +02:00
parent 67b9ab0a68
commit 3b111fa1eb
9 changed files with 22 additions and 18 deletions

View File

@ -455,7 +455,7 @@ class TermDisplay(
/** /**
* *
* @return: whether any message was printed by this `TermDisplay` * @return whether any message was printed by this `TermDisplay`
*/ */
def stopDidPrintSomething(): Boolean = { def stopDidPrintSomething(): Boolean = {
scheduler.shutdown() scheduler.shutdown()

View File

@ -163,6 +163,9 @@ class Helper(
} }
val loggerFallbackMode =
!progress && TermDisplay.defaultFallbackMode
val (scaladexRawDependencies, otherRawDependencies) = val (scaladexRawDependencies, otherRawDependencies) =
rawDependencies.partition(s => s.contains("/") || !s.contains(":")) rawDependencies.partition(s => s.contains("/") || !s.contains(":"))
@ -364,9 +367,6 @@ class Helper(
mapDependencies = if (typelevel) Some(Typelevel.swap(_)) else None mapDependencies = if (typelevel) Some(Typelevel.swap(_)) else None
) )
val loggerFallbackMode =
!progress && TermDisplay.defaultFallbackMode
val logger = val logger =
if (verbosityLevel >= 0) if (verbosityLevel >= 0)
Some(new TermDisplay( Some(new TermDisplay(
@ -465,7 +465,7 @@ class Helper(
iterationCounter, iterationCounter,
0 0
) )
).run ).unsafePerformSync
Console.err.println(s"Overhead: ${resolutionCounter.value - iterationCounter.value} ms") Console.err.println(s"Overhead: ${resolutionCounter.value - iterationCounter.value} ms")
@ -491,7 +491,7 @@ class Helper(
val res0 = startRes val res0 = startRes
.process .process
.run(fetch0, maxIterations) .run(fetch0, maxIterations)
.run .unsafePerformSync
val end = System.currentTimeMillis() val end = System.currentTimeMillis()
Console.err.println(s"Resolution ${index + 1} / ${-benchmark}: ${end - start} ms") Console.err.println(s"Resolution ${index + 1} / ${-benchmark}: ${end - start} ms")
@ -515,7 +515,7 @@ class Helper(
startRes startRes
.process .process
.run(fetch0, maxIterations) .run(fetch0, maxIterations)
.run .unsafePerformSync
logger.foreach(_.stop()) logger.foreach(_.stop())
@ -674,7 +674,7 @@ class Helper(
val task = Task.gatherUnordered(tasks) val task = Task.gatherUnordered(tasks)
val results = task.run val results = task.unsafePerformSync
val errors = results.collect{case (artifact, -\/(err)) => artifact -> err } val errors = results.collect{case (artifact, -\/(err)) => artifact -> err }
val files0 = results.collect{case (artifact, \/-(f)) => f } val files0 = results.collect{case (artifact, \/-(f)) => f }

View File

@ -8,6 +8,7 @@ import argonaut._, Argonaut._, ArgonautShapeless._
import coursier.core.{ Artifact, Attributes } import coursier.core.{ Artifact, Attributes }
import coursier.{ Fetch, Module } import coursier.{ Fetch, Module }
import scala.language.higherKinds
import scalaz.{ -\/, EitherT, Monad, Nondeterminism, \/, \/- } import scalaz.{ -\/, EitherT, Monad, Nondeterminism, \/, \/- }
import scalaz.Scalaz.ToEitherOps import scalaz.Scalaz.ToEitherOps
import scalaz.Scalaz.ToEitherOpsFromEither import scalaz.Scalaz.ToEitherOpsFromEither

View File

@ -43,7 +43,7 @@ object ResolutionError {
final case class UnknownDownloadException(ex: Throwable) extends ResolutionError final case class UnknownDownloadException(ex: Throwable) extends ResolutionError
final case class Conflicts(description: String) extends ResolutionError final case class Conflicts(description: String) extends ResolutionError
final case class MetadataDownloadErrors(errors: Seq[(Dependency, Seq[String])]) extends ResolutionError { final case class MetadataDownloadErrors(errors: Seq[((Module, String), Seq[String])]) extends ResolutionError {
def description(): String = { def description(): String = {
def grouped(errs: Seq[String]) = def grouped(errs: Seq[String]) =
@ -64,8 +64,8 @@ object ResolutionError {
lines += s"Encountered ${errors.length} error(s) in dependency resolution:" lines += s"Encountered ${errors.length} error(s) in dependency resolution:"
for ((dep, errs) <- errors) { for (((mod, ver), errs) <- errors) {
lines += s" ${dep.module}:${dep.version}:" lines += s" $mod:$ver:"
for ((type0, errs0) <- grouped(errs)) for ((type0, errs0) <- grouped(errs))
if (type0.isEmpty) if (type0.isEmpty)

View File

@ -677,7 +677,7 @@ object Tasks {
startRes startRes
.process .process
.run(fetch, maxIterations) .run(fetch, maxIterations)
.attemptRun .unsafePerformSyncAttempt
.leftMap(ex => .leftMap(ex =>
ResolutionError.UnknownException(ex) ResolutionError.UnknownException(ex)
.throwException() .throwException()
@ -704,17 +704,17 @@ object Tasks {
).throwException() ).throwException()
} }
if (res.errors.nonEmpty) { if (res.metadataErrors.nonEmpty) {
val internalRepositoriesLen = internalRepositories.length val internalRepositoriesLen = internalRepositories.length
val errors = val errors =
if (repositories.length > internalRepositoriesLen) if (repositories.length > internalRepositoriesLen)
// drop internal repository errors // drop internal repository errors
res.errors.map { res.metadataErrors.map {
case (dep, errs) => case (dep, errs) =>
dep -> errs.drop(internalRepositoriesLen) dep -> errs.drop(internalRepositoriesLen)
} }
else else
res.errors res.metadataErrors
ResolutionError.MetadataDownloadErrors(errors) ResolutionError.MetadataDownloadErrors(errors)
.throwException() .throwException()
@ -823,7 +823,7 @@ object Tasks {
artifactsLogger.init(if (printOptionalMessage) log.info(artifactInitialMessage)) artifactsLogger.init(if (printOptionalMessage) log.info(artifactInitialMessage))
Task.gatherUnordered(artifactFileOrErrorTasks).attemptRun match { Task.gatherUnordered(artifactFileOrErrorTasks).unsafePerformSyncAttempt match {
case -\/(ex) => case -\/(ex) =>
ResolutionError.UnknownDownloadException(ex) ResolutionError.UnknownDownloadException(ex)
.throwException() .throwException()

View File

@ -2,6 +2,8 @@ package coursier.sbtlauncher
import java.io.File import java.io.File
import scala.language.existentials
final case class AppProvider( final case class AppProvider(
scalaProvider: xsbti.ScalaProvider, scalaProvider: xsbti.ScalaProvider,
id: xsbti.ApplicationID, id: xsbti.ApplicationID,

View File

@ -10,6 +10,7 @@ import coursier.ivy.IvyRepository
import coursier.maven.MavenSource import coursier.maven.MavenSource
import scala.annotation.tailrec import scala.annotation.tailrec
import scala.language.reflectiveCalls
import scalaz.{-\/, \/-} import scalaz.{-\/, \/-}
import scalaz.concurrent.Task import scalaz.concurrent.Task

View File

@ -59,7 +59,7 @@ object ChecksumTests extends TestSuite {
sumType, sumType,
cache, cache,
Strategy.DefaultExecutorService Strategy.DefaultExecutorService
).run.run ).run.unsafePerformSync
def artifact(url: String) = Artifact( def artifact(url: String) = Artifact(
url, url,

View File

@ -10,7 +10,7 @@ package object compatibility {
implicit val executionContext = scala.concurrent.ExecutionContext.global implicit val executionContext = scala.concurrent.ExecutionContext.global
implicit class TaskExtensions[T](val underlying: Task[T]) extends AnyVal { implicit class TaskExtensions[T](val underlying: Task[T]) extends AnyVal {
def runF: Future[T] = Future.successful(underlying.run) def runF: Future[T] = Future.successful(underlying.unsafePerformSync)
} }
def textResource(path: String)(implicit ec: ExecutionContext): Future[String] = Future { def textResource(path: String)(implicit ec: ExecutionContext): Future[String] = Future {