Remove deprecated stuff

This commit is contained in:
Alexandre Archambault 2018-02-27 22:54:49 +01:00
parent c037dbaeeb
commit 838a340b89
10 changed files with 22 additions and 60 deletions

View File

@ -320,11 +320,9 @@ object Cache {
private def contentLength( private def contentLength(
url: String, url: String,
authentication: Option[Authentication], authentication: Option[Authentication],
logger0: Option[Logger] logger: Option[Logger]
): Either[FileError, Option[Long]] = { ): Either[FileError, Option[Long]] = {
val logger = logger0.map(Logger.Extended(_))
var conn: URLConnection = null var conn: URLConnection = null
try { try {
@ -367,14 +365,12 @@ object Cache {
checksums: Set[String], checksums: Set[String],
cachePolicy: CachePolicy, cachePolicy: CachePolicy,
pool: ExecutorService, pool: ExecutorService,
logger0: Option[Logger] = None, logger: Option[Logger] = None,
ttl: Option[Duration] = defaultTtl ttl: Option[Duration] = defaultTtl
): Task[Seq[((File, String), Either[FileError, Unit])]] = { ): Task[Seq[((File, String), Either[FileError, Unit])]] = {
implicit val pool0 = pool implicit val pool0 = pool
val logger = logger0.map(Logger.Extended(_))
// Reference file - if it exists, and we get not found errors on some URLs, we assume // Reference file - if it exists, and we get not found errors on some URLs, we assume
// we can keep track of these missing, and not try to get them again later. // we can keep track of these missing, and not try to get them again later.
val referenceFileOpt = artifact val referenceFileOpt = artifact
@ -960,7 +956,7 @@ object Cache {
checksums = checksums0.collect { case Some(c) => c }.toSet, checksums = checksums0.collect { case Some(c) => c }.toSet,
cachePolicy, cachePolicy,
pool, pool,
logger0 = logger, logger = logger,
ttl = ttl ttl = ttl
).map { results => ).map { results =>
val checksum = checksums0.find { val checksum = checksums0.find {
@ -1134,43 +1130,11 @@ object Cache {
def downloadedArtifact(url: String, success: Boolean): Unit = {} def downloadedArtifact(url: String, success: Boolean): Unit = {}
def checkingUpdates(url: String, currentTimeOpt: Option[Long]): Unit = {} def checkingUpdates(url: String, currentTimeOpt: Option[Long]): Unit = {}
def checkingUpdatesResult(url: String, currentTimeOpt: Option[Long], remoteTimeOpt: Option[Long]): Unit = {} def checkingUpdatesResult(url: String, currentTimeOpt: Option[Long], remoteTimeOpt: Option[Long]): Unit = {}
}
object Logger { def downloadLength(url: String, totalLength: Long, alreadyDownloaded: Long, watching: Boolean): Unit = {}
// adding new methods to this one, not to break bin compat in 2.10 / 2.11
abstract class Extended extends Logger {
def downloadLength(url: String, totalLength: Long, alreadyDownloaded: Long, watching: Boolean): Unit = {
downloadLength(url, totalLength, 0L, watching)
}
def gettingLength(url: String): Unit = {} def gettingLength(url: String): Unit = {}
def gettingLengthResult(url: String, length: Option[Long]): Unit = {} def gettingLengthResult(url: String, length: Option[Long]): Unit = {}
}
object Extended {
def apply(logger: Logger): Extended =
logger match {
case e: Extended => e
case _ =>
new Extended {
override def foundLocally(url: String, f: File) =
logger.foundLocally(url, f)
override def downloadingArtifact(url: String, file: File) =
logger.downloadingArtifact(url, file)
override def downloadProgress(url: String, downloaded: Long) =
logger.downloadProgress(url, downloaded)
override def downloadedArtifact(url: String, success: Boolean) =
logger.downloadedArtifact(url, success)
override def checkingUpdates(url: String, currentTimeOpt: Option[Long]) =
logger.checkingUpdates(url, currentTimeOpt)
override def checkingUpdatesResult(url: String, currentTimeOpt: Option[Long], remoteTimeOpt: Option[Long]) =
logger.checkingUpdatesResult(url, currentTimeOpt, remoteTimeOpt)
}
}
}
} }
var bufferSize = 1024*1024 var bufferSize = 1024*1024

View File

@ -374,7 +374,7 @@ object TermDisplay {
class TermDisplay( class TermDisplay(
out: Writer, out: Writer,
val fallbackMode: Boolean = TermDisplay.defaultFallbackMode val fallbackMode: Boolean = TermDisplay.defaultFallbackMode
) extends Cache.Logger.Extended { ) extends Cache.Logger {
import TermDisplay._ import TermDisplay._

View File

@ -515,11 +515,11 @@ class Helper(
errPrintln("\nMaximum number of iterations reached!") errPrintln("\nMaximum number of iterations reached!")
} }
if (res.metadataErrors.nonEmpty) { if (res.errors.nonEmpty) {
anyError = true anyError = true
errPrintln( errPrintln(
"\nError:\n" + "\nError:\n" +
res.metadataErrors.map { res.errors.map {
case ((module, version), errors) => case ((module, version), errors) =>
s" $module:$version\n${errors.map(" " + _.replace("\n", " \n")).mkString("\n")}" s" $module:$version\n${errors.map(" " + _.replace("\n", " \n")).mkString("\n")}"
}.mkString("\n") }.mkString("\n")

View File

@ -1085,7 +1085,10 @@ final case class Resolution(
* Returns errors on dependencies * Returns errors on dependencies
* @return errors * @return errors
*/ */
def metadataErrors: Seq[(ModuleVersion, Seq[String])] = errorCache.toSeq def errors: Seq[(ModuleVersion, Seq[String])] = errorCache.toSeq
@deprecated("Use errors instead", "1.1.0")
def metadataErrors: Seq[(ModuleVersion, Seq[String])] = errors
/** /**
* Removes from this `Resolution` dependencies that are not in `dependencies` neither brought * Removes from this `Resolution` dependencies that are not in `dependencies` neither brought

View File

@ -41,9 +41,6 @@ object CoursierPlugin extends AutoPlugin {
val coursierParentProjectCache = Keys.coursierParentProjectCache val coursierParentProjectCache = Keys.coursierParentProjectCache
val coursierResolutions = Keys.coursierResolutions val coursierResolutions = Keys.coursierResolutions
@deprecated("Use coursierResolutions instead", "1.0.0-RC4")
val coursierResolution = Keys.actualCoursierResolution
val coursierSbtClassifiersResolution = Keys.coursierSbtClassifiersResolution val coursierSbtClassifiersResolution = Keys.coursierSbtClassifiersResolution
val coursierDependencyTree = Keys.coursierDependencyTree val coursierDependencyTree = Keys.coursierDependencyTree

View File

@ -51,8 +51,6 @@ object Keys {
private[coursier] val actualCoursierResolution = TaskKey[Resolution]("coursier-resolution") private[coursier] val actualCoursierResolution = TaskKey[Resolution]("coursier-resolution")
@deprecated("Use coursierResolutions instead", "1.0.0-RC4")
val coursierResolution = actualCoursierResolution
val coursierSbtClassifiersResolution = TaskKey[Resolution]("coursier-sbt-classifiers-resolution") val coursierSbtClassifiersResolution = TaskKey[Resolution]("coursier-sbt-classifiers-resolution")
val coursierDependencyTree = TaskKey[Unit]( val coursierDependencyTree = TaskKey[Unit](

View File

@ -781,17 +781,17 @@ object Tasks {
).throwException() ).throwException()
} }
if (res.metadataErrors.nonEmpty) { if (res.errors.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.metadataErrors.map { res.errors.map {
case (dep, errs) => case (dep, errs) =>
dep -> errs.drop(internalRepositoriesLen) dep -> errs.drop(internalRepositoriesLen)
} }
else else
res.metadataErrors res.errors
ResolutionError.MetadataDownloadErrors(errors) ResolutionError.MetadataDownloadErrors(errors)
.throwException() .throwException()

View File

@ -54,7 +54,7 @@ object CacheFetchTests extends TestSuite {
cleanTmpDir() cleanTmpDir()
} }
val errors = res.metadataErrors val errors = res.errors
assert(errors.isEmpty) assert(errors.isEmpty)
} }

View File

@ -45,7 +45,7 @@ abstract class CentralTests extends TestSuite {
.run(fetch0) .run(fetch0)
.map { res => .map { res =>
val metadataErrors = res.metadataErrors val metadataErrors = res.errors
val conflicts = res.conflicts val conflicts = res.conflicts
val isDone = res.isDone val isDone = res.isDone
assert(metadataErrors.isEmpty) assert(metadataErrors.isEmpty)
@ -183,7 +183,7 @@ abstract class CentralTests extends TestSuite {
): Future[T] = async { ): Future[T] = async {
val res = await(resolve(deps, extraRepos = extraRepos)) val res = await(resolve(deps, extraRepos = extraRepos))
val metadataErrors = res.metadataErrors val metadataErrors = res.errors
val conflicts = res.conflicts val conflicts = res.conflicts
val isDone = res.isDone val isDone = res.isDone
assert(metadataErrors.isEmpty) assert(metadataErrors.isEmpty)
@ -581,7 +581,7 @@ abstract class CentralTests extends TestSuite {
val res = await(resolve(deps)) val res = await(resolve(deps))
val metadataErrors = res.metadataErrors val metadataErrors = res.errors
val conflicts = res.conflicts val conflicts = res.conflicts
val isDone = res.isDone val isDone = res.isDone
assert(metadataErrors.isEmpty) assert(metadataErrors.isEmpty)
@ -619,7 +619,7 @@ abstract class CentralTests extends TestSuite {
val res = await(resolve(deps)) val res = await(resolve(deps))
val metadataErrors = res.metadataErrors val metadataErrors = res.errors
val conflicts = res.conflicts val conflicts = res.conflicts
val isDone = res.isDone val isDone = res.isDone
assert(metadataErrors.isEmpty) assert(metadataErrors.isEmpty)

View File

@ -251,7 +251,7 @@ object ResolutionTests extends TestSuite {
assert(directDependencyErrors.isEmpty) assert(directDependencyErrors.isEmpty)
// metadataErrors have that // metadataErrors have that
assert(res.metadataErrors == Seq((Module("acme", "missing-pom"), "1.0.0") -> List("Not found"))) assert(res.errors == Seq((Module("acme", "missing-pom"), "1.0.0") -> List("Not found")))
} }
} }
'single{ 'single{