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(
url: String,
authentication: Option[Authentication],
logger0: Option[Logger]
logger: Option[Logger]
): Either[FileError, Option[Long]] = {
val logger = logger0.map(Logger.Extended(_))
var conn: URLConnection = null
try {
@ -367,14 +365,12 @@ object Cache {
checksums: Set[String],
cachePolicy: CachePolicy,
pool: ExecutorService,
logger0: Option[Logger] = None,
logger: Option[Logger] = None,
ttl: Option[Duration] = defaultTtl
): Task[Seq[((File, String), Either[FileError, Unit])]] = {
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
// we can keep track of these missing, and not try to get them again later.
val referenceFileOpt = artifact
@ -960,7 +956,7 @@ object Cache {
checksums = checksums0.collect { case Some(c) => c }.toSet,
cachePolicy,
pool,
logger0 = logger,
logger = logger,
ttl = ttl
).map { results =>
val checksum = checksums0.find {
@ -1134,43 +1130,11 @@ object Cache {
def downloadedArtifact(url: String, success: Boolean): Unit = {}
def checkingUpdates(url: String, currentTimeOpt: Option[Long]): Unit = {}
def checkingUpdatesResult(url: String, currentTimeOpt: Option[Long], remoteTimeOpt: Option[Long]): Unit = {}
}
object Logger {
// 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 downloadLength(url: String, totalLength: Long, alreadyDownloaded: Long, watching: Boolean): Unit = {}
def gettingLength(url: String): 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)
}
}
}
def gettingLength(url: String): Unit = {}
def gettingLengthResult(url: String, length: Option[Long]): Unit = {}
}
var bufferSize = 1024*1024

View File

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

View File

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

View File

@ -1085,7 +1085,10 @@ final case class Resolution(
* Returns errors on dependencies
* @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

View File

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

View File

@ -51,8 +51,6 @@ object Keys {
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 coursierDependencyTree = TaskKey[Unit](

View File

@ -781,17 +781,17 @@ object Tasks {
).throwException()
}
if (res.metadataErrors.nonEmpty) {
if (res.errors.nonEmpty) {
val internalRepositoriesLen = internalRepositories.length
val errors =
if (repositories.length > internalRepositoriesLen)
// drop internal repository errors
res.metadataErrors.map {
res.errors.map {
case (dep, errs) =>
dep -> errs.drop(internalRepositoriesLen)
}
else
res.metadataErrors
res.errors
ResolutionError.MetadataDownloadErrors(errors)
.throwException()

View File

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

View File

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

View File

@ -251,7 +251,7 @@ object ResolutionTests extends TestSuite {
assert(directDependencyErrors.isEmpty)
// 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{