Remove a bunch of compilation warnings

This commit is contained in:
Dale Wijnand 2018-02-15 08:28:22 +00:00
parent 42dccdf82c
commit 60b9c7dacb
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
16 changed files with 107 additions and 109 deletions

View File

@ -1,6 +1,5 @@
import Dependencies._ import Dependencies._
import Path._ import Path._
//import com.typesafe.tools.mima.core._, ProblemFilters._
def commonSettings: Seq[Setting[_]] = Seq( def commonSettings: Seq[Setting[_]] = Seq(
scalaVersion := scala212, scalaVersion := scala212,
@ -35,15 +34,6 @@ val mimaSettings = Def settings (
organization.value %% moduleName.value % version organization.value %% moduleName.value % version
cross (if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled) cross (if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled)
), ),
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._
import com.typesafe.tools.mima.core.ProblemFilters._
Seq(
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.ivyint.GigahorseUrlHandler#SbtUrlInfo.this"),
exclude[IncompatibleMethTypeProblem]("sbt.internal.librarymanagement.ivyint.GigahorseUrlHandler#SbtUrlInfo.this"),
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.ivyint.GigahorseUrlHandler.checkStatusCode")
)
}
) )
lazy val lmRoot = (project in file(".")) lazy val lmRoot = (project in file("."))
@ -143,6 +133,24 @@ lazy val lmIvy = (project in file("ivy"))
scalacOptions in (Compile, console) --= scalacOptions in (Compile, console) --=
Vector("-Ywarn-unused-import", "-Ywarn-unused", "-Xlint"), Vector("-Ywarn-unused-import", "-Ywarn-unused", "-Xlint"),
mimaSettings, mimaSettings,
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._, ProblemFilters._
Seq(
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.ivyint.GigahorseUrlHandler#SbtUrlInfo.this"),
exclude[IncompatibleMethTypeProblem]("sbt.internal.librarymanagement.ivyint.GigahorseUrlHandler#SbtUrlInfo.this"),
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.ivyint.GigahorseUrlHandler.checkStatusCode"),
// sbt.internal methods that changed type signatures and aren't used elsewhere in production code
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.IvySbt#ParallelCachedResolutionResolveEngine.mergeErrors"),
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.IvySbt.cleanCachedResolutionCache"),
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.IvyRetrieve.artifacts"),
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.IvyScalaUtil.checkModule"),
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.ivyint.CachedResolutionResolveEngine.mergeErrors"),
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.ivyint.CachedResolutionResolveCache.buildArtificialModuleDescriptor"),
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.ivyint.CachedResolutionResolveCache.buildArtificialModuleDescriptors"),
exclude[ReversedMissingMethodProblem]("sbt.internal.librarymanagement.ivyint.CachedResolutionResolveEngine.mergeErrors")
)
},
) )
def customCommands: Seq[Setting[_]] = Seq( def customCommands: Seq[Setting[_]] = Seq(

View File

@ -17,5 +17,5 @@ abstract class AbstractEngineSpec extends UnitSpec {
case Left(w) => throw w.resolveException case Left(w) => throw w.resolveException
} }
def cleanCachedResolutionCache(module: ModuleDescriptor): Unit = () def cleanCachedResolutionCache(@deprecated("unused", "") module: ModuleDescriptor): Unit = ()
} }

View File

@ -192,11 +192,18 @@ final class EvictionWarning private[sbt] (
} }
object EvictionWarning { object EvictionWarning {
@deprecated("Use variant that doesn't take an unused logger", "1.2.0")
def apply( def apply(
module: ModuleDescriptor, module: ModuleDescriptor,
options: EvictionWarningOptions, options: EvictionWarningOptions,
report: UpdateReport, report: UpdateReport,
log: Logger log: Logger
): EvictionWarning = apply(module, options, report)
def apply(
module: ModuleDescriptor,
options: EvictionWarningOptions,
report: UpdateReport
): EvictionWarning = { ): EvictionWarning = {
val evictions = buildEvictions(options, report) val evictions = buildEvictions(options, report)
processEvictions(module, options, evictions) processEvictions(module, options, evictions)

View File

@ -2,7 +2,6 @@ package sbt
package librarymanagement package librarymanagement
import java.io.File import java.io.File
import java.io.FileNotFoundException
import sbt.io.IO import sbt.io.IO
/** /**

View File

@ -76,6 +76,7 @@ final class InlineIvyConfiguration private (
} }
object InlineIvyConfiguration { object InlineIvyConfiguration {
/** Provided for backward compatibility. */ /** Provided for backward compatibility. */
@deprecated("Use an alternative apply", "1.2.0")
def apply( def apply(
paths: sbt.librarymanagement.ivy.IvyPaths, paths: sbt.librarymanagement.ivy.IvyPaths,
resolvers: Vector[sbt.librarymanagement.Resolver], resolvers: Vector[sbt.librarymanagement.Resolver],

View File

@ -78,6 +78,7 @@
], ],
"extraCompanion": [ "extraCompanion": [
"/** Provided for backward compatibility. */", "/** Provided for backward compatibility. */",
"@deprecated(\"Use an alternative apply\", \"1.2.0\")",
"def apply(", "def apply(",
" paths: sbt.librarymanagement.ivy.IvyPaths,", " paths: sbt.librarymanagement.ivy.IvyPaths,",
" resolvers: Vector[sbt.librarymanagement.Resolver],", " resolvers: Vector[sbt.librarymanagement.Resolver],",

View File

@ -246,7 +246,6 @@ private[sbt] object ConvertResolver {
import sbt.io.syntax._ import sbt.io.syntax._
private def downloadChecksum(resource: Resource, private def downloadChecksum(resource: Resource,
target: File,
targetChecksumFile: File, targetChecksumFile: File,
algorithm: String): Boolean = { algorithm: String): Boolean = {
if (!ChecksumHelper.isKnownAlgorithm(algorithm)) if (!ChecksumHelper.isKnownAlgorithm(algorithm))
@ -278,7 +277,7 @@ private[sbt] object ConvertResolver {
// Continue checking until we hit a failure // Continue checking until we hit a failure
val checksumFile = new File(targetPath.stripSuffix(PartEnd) + s".$algorithm") val checksumFile = new File(targetPath.stripSuffix(PartEnd) + s".$algorithm")
if (checked) checked if (checked) checked
else downloadChecksum(resource, target, checksumFile, algorithm) else downloadChecksum(resource, checksumFile, algorithm)
} }
// -ivy deviation // -ivy deviation
size size

View File

@ -207,12 +207,8 @@ final class IvySbt(val configuration: IvyConfiguration) { self =>
} }
} }
/** /** Cleans cached resolution cache. */
* Cleans cached resolution cache. private[sbt] def cleanCachedResolutionCache(): Unit = {
*
* @param md - module descriptor of the original Ivy graph.
*/
private[sbt] def cleanCachedResolutionCache(md: ModuleDescriptor, log: Logger): Unit = {
if (!configuration.updateOptions.cachedResolution) () if (!configuration.updateOptions.cachedResolution) ()
else IvySbt.cachedResolutionResolveCache.clean() else IvySbt.cachedResolutionResolveCache.clean()
} }
@ -260,12 +256,9 @@ final class IvySbt(val configuration: IvyConfiguration) { self =>
} }
val configs = configurations val configs = configurations
moduleSettings.scalaModuleInfo match { moduleSettings.scalaModuleInfo foreach { is =>
case Some(is) => val svc = configs filter Configurations.underScalaVersion map { _.name }
val svc = configs.toVector filter Configurations.underScalaVersion map { _.name } IvyScalaUtil.checkModule(baseModule, svc, getLog(configuration.log))(is)
IvyScalaUtil.checkModule(baseModule, baseConfiguration, svc, getLog(configuration.log))(
is)
case _ => // do nothing
} }
IvySbt.addExtraNamespace(baseModule) IvySbt.addExtraNamespace(baseModule)
(baseModule, baseConfiguration) (baseModule, baseConfiguration)
@ -278,8 +271,7 @@ final class IvySbt(val configuration: IvyConfiguration) { self =>
"Default", "Default",
ModuleDescriptor.DEFAULT_CONFIGURATION) ModuleDescriptor.DEFAULT_CONFIGURATION)
log.debug( log.debug(
"Using inline dependencies specified in Scala" + (if (ivyXML.isEmpty) "." s"Using inline dependencies specified in Scala${(if (ivyXML.isEmpty) "" else " and XML")}."
else " and XML.")
) )
val parser = IvySbt.parseIvyXML( val parser = IvySbt.parseIvyXML(

View File

@ -51,8 +51,8 @@ object IvyActions {
* This is called by clean. * This is called by clean.
*/ */
private[sbt] def cleanCachedResolutionCache(module: IvySbt#Module, log: Logger): Unit = private[sbt] def cleanCachedResolutionCache(module: IvySbt#Module, log: Logger): Unit =
module.withModule(log) { (ivy, md, default) => module.withModule(log) { (_, _, _) =>
module.owner.cleanCachedResolutionCache(md, log) module.owner.cleanCachedResolutionCache()
} }
/** Creates a Maven pom from the given Ivy configuration*/ /** Creates a Maven pom from the given Ivy configuration*/
@ -188,7 +188,7 @@ object IvyActions {
log: Logger log: Logger
): Either[UnresolvedWarning, UpdateReport] = { ): Either[UnresolvedWarning, UpdateReport] = {
module.withModule(log) { module.withModule(log) {
case (ivy, moduleDescriptor, defaultConf) => case (ivy, moduleDescriptor, _) =>
// Warn about duplicated and inconsistent dependencies // Warn about duplicated and inconsistent dependencies
val iw = IvySbt.inconsistentDuplicateWarning(moduleDescriptor) val iw = IvySbt.inconsistentDuplicateWarning(moduleDescriptor)
iw.foreach(log.warn(_)) iw.foreach(log.warn(_))
@ -202,7 +202,7 @@ object IvyActions {
val cache = val cache =
metadataDirectory.getOrElse(sys.error("Missing directory for cached resolution.")) metadataDirectory.getOrElse(sys.error("Missing directory for cached resolution."))
cachedResolveAndRetrieve(inputs, cache) cachedResolveAndRetrieve(inputs, cache)
} else resolveAndRetrieve(inputs, defaultConf) } else resolveAndRetrieve(inputs)
} }
// Convert to unresolved warning or retrieve update report // Convert to unresolved warning or retrieve update report
@ -287,12 +287,10 @@ object IvyActions {
* like its counterpart [[CachedResolutionResolveEngine.customResolve]]. * like its counterpart [[CachedResolutionResolveEngine.customResolve]].
* *
* @param inputs The resolution inputs. * @param inputs The resolution inputs.
* @param defaultModuleConfiguration The default ivy configuration.
* @return The result of the resolution. * @return The result of the resolution.
*/ */
private[this] def resolveAndRetrieve( private[this] def resolveAndRetrieve(
inputs: ResolutionInputs, inputs: ResolutionInputs
defaultModuleConfiguration: String
): Either[ResolveException, UpdateReport] = { ): Either[ResolveException, UpdateReport] = {
// Populate resolve options from the passed arguments // Populate resolve options from the passed arguments
val ivyInstance = inputs.ivy val ivyInstance = inputs.ivy

View File

@ -28,12 +28,11 @@ object IvyRetrieve {
@deprecated("Internal only. No longer in use.", "0.13.6") @deprecated("Internal only. No longer in use.", "0.13.6")
def artifactReports(mid: ModuleID, artReport: Seq[ArtifactDownloadReport]): ModuleReport = { def artifactReports(mid: ModuleID, artReport: Seq[ArtifactDownloadReport]): ModuleReport = {
val (resolved, missing) = artifacts(mid, artReport) val (resolved, missing) = artifacts(artReport)
ModuleReport(mid, resolved, missing) ModuleReport(mid, resolved, missing)
} }
private[sbt] def artifacts( private[sbt] def artifacts(
mid: ModuleID,
artReport: Seq[ArtifactDownloadReport] artReport: Seq[ArtifactDownloadReport]
): (Vector[(Artifact, File)], Vector[Artifact]) = { ): (Vector[(Artifact, File)], Vector[Artifact]) = {
val missing = new mutable.ListBuffer[Artifact] val missing = new mutable.ListBuffer[Artifact]
@ -180,7 +179,7 @@ object IvyRetrieve {
case _ => Vector.empty case _ => Vector.empty
} }
val callers = dep.getCallers(confReport.getConfiguration).toVector map { toCaller } val callers = dep.getCallers(confReport.getConfiguration).toVector map { toCaller }
val (resolved, missing) = artifacts(moduleId, confReport getDownloadReports revId) val (resolved, missing) = artifacts(confReport getDownloadReports revId)
ModuleReport( ModuleReport(
moduleId, moduleId,

View File

@ -6,7 +6,7 @@ package sbt.internal.librarymanagement
import java.util.Collections.emptyMap import java.util.Collections.emptyMap
import scala.collection.mutable.HashSet import scala.collection.mutable.HashSet
import org.apache.ivy.core.module.descriptor.{ Configuration => _, _ } import org.apache.ivy.core.module.descriptor._
import org.apache.ivy.core.module.id.{ ArtifactId, ModuleId, ModuleRevisionId } import org.apache.ivy.core.module.id.{ ArtifactId, ModuleId, ModuleRevisionId }
import org.apache.ivy.plugins.matcher.ExactPatternMatcher import org.apache.ivy.plugins.matcher.ExactPatternMatcher
import org.apache.ivy.plugins.namespace.NamespaceTransformer import org.apache.ivy.plugins.namespace.NamespaceTransformer
@ -19,7 +19,6 @@ object IvyScalaUtil {
/** Performs checks/adds filters on Scala dependencies (if enabled in ScalaModuleInfo). */ /** Performs checks/adds filters on Scala dependencies (if enabled in ScalaModuleInfo). */
def checkModule( def checkModule(
module: DefaultModuleDescriptor, module: DefaultModuleDescriptor,
conf: String,
scalaVersionConfigs: Vector[String], scalaVersionConfigs: Vector[String],
log: Logger log: Logger
)(check: ScalaModuleInfo): Unit = { )(check: ScalaModuleInfo): Unit = {

View File

@ -65,10 +65,10 @@ private[sbt] class CachedResolutionResolveCache {
def directDependencies(md0: ModuleDescriptor): Vector[DependencyDescriptor] = def directDependencies(md0: ModuleDescriptor): Vector[DependencyDescriptor] =
md0.getDependencies.toVector md0.getDependencies.toVector
// Returns a vector of (module descriptor, changing, dd) // Returns a vector of (module descriptor, changing, dd)
def buildArtificialModuleDescriptors( def buildArtificialModuleDescriptors(
md0: ModuleDescriptor, md0: ModuleDescriptor,
data: ResolveData,
prOpt: Option[ProjectResolver], prOpt: Option[ProjectResolver],
log: Logger log: Logger
): Vector[(DefaultModuleDescriptor, Boolean, DependencyDescriptor)] = { ): Vector[(DefaultModuleDescriptor, Boolean, DependencyDescriptor)] = {
@ -80,9 +80,10 @@ private[sbt] class CachedResolutionResolveCache {
s"""${x.getName}:${x.getType}:${x.getExt}:${x.getExtraAttributes}""" s"""${x.getName}:${x.getType}:${x.getExt}:${x.getExtraAttributes}"""
} }
log.debug(s"::: dd: $dd (artifacts: ${arts.mkString(",")})") log.debug(s"::: dd: $dd (artifacts: ${arts.mkString(",")})")
buildArtificialModuleDescriptor(dd, rootModuleConfigs, md0, prOpt, log) buildArtificialModuleDescriptor(dd, rootModuleConfigs, md0, prOpt)
} }
} }
def internalDependency( def internalDependency(
dd: DependencyDescriptor, dd: DependencyDescriptor,
prOpt: Option[ProjectResolver] prOpt: Option[ProjectResolver]
@ -91,12 +92,12 @@ private[sbt] class CachedResolutionResolveCache {
case Some(pr) => pr.getModuleDescriptor(dd.getDependencyRevisionId) case Some(pr) => pr.getModuleDescriptor(dd.getDependencyRevisionId)
case _ => None case _ => None
} }
def buildArtificialModuleDescriptor( def buildArtificialModuleDescriptor(
dd: DependencyDescriptor, dd: DependencyDescriptor,
rootModuleConfigs: Vector[IvyConfiguration], rootModuleConfigs: Vector[IvyConfiguration],
parent: ModuleDescriptor, parent: ModuleDescriptor,
prOpt: Option[ProjectResolver], prOpt: Option[ProjectResolver]
log: Logger
): (DefaultModuleDescriptor, Boolean, DependencyDescriptor) = { ): (DefaultModuleDescriptor, Boolean, DependencyDescriptor) = {
def excludeRuleString(rule: ExcludeRule): String = def excludeRuleString(rule: ExcludeRule): String =
s"""Exclude(${rule.getId},${rule.getConfigurations.mkString(",")},${rule.getMatcher})""" s"""Exclude(${rule.getId},${rule.getConfigurations.mkString(",")},${rule.getMatcher})"""
@ -363,7 +364,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
val os = cache.extractOverrides(md0) val os = cache.extractOverrides(md0)
val options1 = new ResolveOptions(options0) val options1 = new ResolveOptions(options0)
val data = new ResolveData(this, options1) val data = new ResolveData(this, options1)
val mds = cache.buildArtificialModuleDescriptors(md0, data, projectResolver, log) val mds = cache.buildArtificialModuleDescriptors(md0, projectResolver, log)
def doWork( def doWork(
md: ModuleDescriptor, md: ModuleDescriptor,
@ -475,15 +476,11 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
os: Vector[IvyOverride], os: Vector[IvyOverride],
log: Logger log: Logger
): Either[ResolveException, UpdateReport] = ): Either[ResolveException, UpdateReport] =
if (!missingOk && (results exists { _.isLeft })) Left(mergeErrors(md0, results collect { if (!missingOk && (results exists { _.isLeft }))
case Left(re) => re Left(mergeErrors(md0, results collect { case Left(re) => re }))
}, log))
else Right(mergeReports(md0, results collect { case Right(ur) => ur }, resolveTime, os, log)) else Right(mergeReports(md0, results collect { case Right(ur) => ur }, resolveTime, os, log))
def mergeErrors(
md0: ModuleDescriptor, def mergeErrors(md0: ModuleDescriptor, errors: Vector[ResolveException]): ResolveException = {
errors: Vector[ResolveException],
log: Logger
): ResolveException = {
val messages = errors flatMap { _.messages } val messages = errors flatMap { _.messages }
val failed = errors flatMap { _.failed } val failed = errors flatMap { _.failed }
val failedPaths = errors flatMap { val failedPaths = errors flatMap {
@ -497,6 +494,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
} }
new ResolveException(messages, failed, ListMap(failedPaths: _*)) new ResolveException(messages, failed, ListMap(failedPaths: _*))
} }
def mergeReports( def mergeReports(
md0: ModuleDescriptor, md0: ModuleDescriptor,
reports: Vector[UpdateReport], reports: Vector[UpdateReport],
@ -524,6 +522,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
} }
UpdateReport(cachedDescriptor, configReports, stats, Map.empty) UpdateReport(cachedDescriptor, configReports, stats, Map.empty)
} }
// memory usage 62%, of which 58% is in mergeOrganizationArtifactReports // memory usage 62%, of which 58% is in mergeOrganizationArtifactReports
def mergeConfigurationReports( def mergeConfigurationReports(
rootModuleConf: ConfigRef, rootModuleConf: ConfigRef,
@ -752,12 +751,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
s":: merging module reports for $rootModuleConf: ${modules.head.module.organization}:${modules.head.module.name}" s":: merging module reports for $rootModuleConf: ${modules.head.module.organization}:${modules.head.module.name}"
) )
} }
def mergeModuleReports( def mergeModuleReports(xs: Vector[ModuleReport]): ModuleReport = {
org: String,
name: String,
version: String,
xs: Vector[ModuleReport]
): ModuleReport = {
val completelyEvicted = xs forall { _.evicted } val completelyEvicted = xs forall { _.evicted }
val allCallers = xs flatMap { _.callers } val allCallers = xs flatMap { _.callers }
// Caller info is often repeated across the subprojects. We only need ModuleID info for later, so xs.head is ok. // Caller info is often repeated across the subprojects. We only need ModuleID info for later, so xs.head is ok.
@ -773,9 +767,9 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
val merged = (modules groupBy { m => val merged = (modules groupBy { m =>
(m.module.organization, m.module.name, m.module.revision) (m.module.organization, m.module.name, m.module.revision)
}).toSeq.toVector flatMap { }).toSeq.toVector flatMap {
case ((org, name, version), xs) => case (_, xs) =>
if (xs.size < 2) xs if (xs.size < 2) xs
else Vector(mergeModuleReports(org, name, version, xs)) else Vector(mergeModuleReports(xs))
} }
val conflicts = merged filter { m => val conflicts = merged filter { m =>
!m.evicted && m.problem.isEmpty !m.evicted && m.problem.isEmpty
@ -805,26 +799,26 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine {
mr.callers forall { c => mr.callers forall { c =>
em(c.caller) em(c.caller)
} }
val reports val reports: Seq[((String, String), Vector[OrganizationArtifactReport])] =
: Seq[((String, String), Vector[OrganizationArtifactReport])] = reports0.toSeq flatMap { reports0.toSeq flatMap {
case (k, v) if !(pairs contains k) => Seq() case (k, _) if !(pairs contains k) => Seq()
case ((organization, name), oars0) => case ((organization, name), oars0) =>
val oars = oars0 map { oar => val oars = oars0 map { oar =>
val (affected, unaffected) = oar.modules partition { mr => val (affected, unaffected) = oar.modules partition { mr =>
val x = !mr.evicted && mr.problem.isEmpty && isTransitivelyEvicted(mr) val x = !mr.evicted && mr.problem.isEmpty && isTransitivelyEvicted(mr)
if (x) { if (x) {
log.debug(s""":::: transitively evicted $rootModuleConf: ${mr.module}""") log.debug(s""":::: transitively evicted $rootModuleConf: ${mr.module}""")
}
x
} }
x val newlyEvicted = affected map {
_.withEvicted(true).withEvictedReason(Some("transitive-evict"))
}
if (affected.isEmpty) oar
else OrganizationArtifactReport(organization, name, unaffected ++ newlyEvicted)
} }
val newlyEvicted = affected map { Seq(((organization, name), oars))
_.withEvicted(true).withEvictedReason(Some("transitive-evict")) }
}
if (affected.isEmpty) oar
else OrganizationArtifactReport(organization, name, unaffected ++ newlyEvicted)
}
Seq(((organization, name), oars))
}
Map(reports: _*) Map(reports: _*)
} }

View File

@ -243,7 +243,8 @@ object GigahorseUrlHandler {
if (status == 407 /* PROXY_AUTHENTICATION_REQUIRED */ ) { if (status == 407 /* PROXY_AUTHENTICATION_REQUIRED */ ) {
Message.warn("Your proxy requires authentication.") Message.warn("Your proxy requires authentication.")
} else if (status == 401) { } else if (status == 401) {
Message.warn("CLIENT ERROR: 401 Unauthorized. Check your resolvers username and password.") Message.warn(
"CLIENT ERROR: 401 Unauthorized. Check your resolvers username and password.")
} else if (String.valueOf(status).startsWith("4")) { } else if (String.valueOf(status).startsWith("4")) {
Message.verbose("CLIENT ERROR: " + response.message() + " url=" + url) Message.verbose("CLIENT ERROR: " + response.message() + " url=" + url)
} else if (String.valueOf(status).startsWith("5")) { } else if (String.valueOf(status).startsWith("5")) {

View File

@ -219,7 +219,7 @@ private[sbt] case class SbtChainResolver(
Message.warn(s"Choosing $resolver for ${resolvedModule.getId}") Message.warn(s"Choosing $resolver for ${resolvedModule.getId}")
// Now that we know the real latest revision, let's force Ivy to use it // Now that we know the real latest revision, let's force Ivy to use it
val resolvedDescriptor = resolvedModule.getDescriptor val resolvedDescriptor = resolvedModule.getDescriptor
val artifactOpt = findFirstArtifactRef(resolvedDescriptor, descriptor, data, resolver) val artifactOpt = findFirstArtifactRef(resolvedDescriptor, data, resolver)
// If `None` do nothing -- modules without artifacts. Otherwise cache. // If `None` do nothing -- modules without artifacts. Otherwise cache.
artifactOpt.foreach { artifactRef => artifactOpt.foreach { artifactRef =>
val dep = toSystem(descriptor) val dep = toSystem(descriptor)
@ -385,7 +385,6 @@ private[sbt] case class SbtChainResolver(
/** Ported from BasicResolver#findFirstAirfactRef. */ /** Ported from BasicResolver#findFirstAirfactRef. */
private[this] def findFirstArtifactRef( private[this] def findFirstArtifactRef(
md: ModuleDescriptor, md: ModuleDescriptor,
dd: DependencyDescriptor,
data: ResolveData, data: ResolveData,
resolver: DependencyResolver resolver: DependencyResolver
): Option[ResolvedResource] = { ): Option[ResolvedResource] = {

View File

@ -48,8 +48,8 @@ class EvictionWarningSpec extends BaseIvySpecification {
val m1 = "org.scala-sbt" % "util-logging" % "0.13.16" val m1 = "org.scala-sbt" % "util-logging" % "0.13.16"
val m2 = "org.scala-sbt" % "util-logging" % "0.13.1" val m2 = "org.scala-sbt" % "util-logging" % "0.13.1"
assert( assert(
EvictionWarningOptions !EvictionWarningOptions.defaultGuess((m1, Option(m2), Option(dummyScalaModuleInfo("2.10.6"))))
.defaultGuess((m1, Option(m2), Option(dummyScalaModuleInfo("2.10.6")))) == false) )
} }
"Comparing sbt 1.x" should "use Semantic Versioning semantics" in { "Comparing sbt 1.x" should "use Semantic Versioning semantics" in {
@ -93,19 +93,19 @@ class EvictionWarningSpec extends BaseIvySpecification {
def scalaVersionWarn1() = { def scalaVersionWarn1() = {
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false) val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false)
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).scalaEvictions should have size (1) EvictionWarning(m, defaultOptions, report).scalaEvictions should have size (1)
} }
def scalaVersionWarn2() = { def scalaVersionWarn2() = {
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false) val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false)
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withWarnScalaVersionEviction(false), report, log).scalaEvictions should have size (0) EvictionWarning(m, defaultOptions.withWarnScalaVersionEviction(false), report).scalaEvictions should have size (0)
} }
def scalaVersionWarn3() = { def scalaVersionWarn3() = {
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false) val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false)
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withShowCallers(false), report, log).lines shouldBe EvictionWarning(m, defaultOptions.withShowCallers(false), report).lines shouldBe
List( List(
"Scala version was updated by one of library dependencies:", "Scala version was updated by one of library dependencies:",
"\t* org.scala-lang:scala-library:2.10.3 is selected over 2.10.2", "\t* org.scala-lang:scala-library:2.10.3 is selected over 2.10.2",
@ -119,7 +119,7 @@ class EvictionWarningSpec extends BaseIvySpecification {
def scalaVersionWarn4() = { def scalaVersionWarn4() = {
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false) val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false)
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).lines shouldBe EvictionWarning(m, defaultOptions, report).lines shouldBe
List( List(
"Scala version was updated by one of library dependencies:", "Scala version was updated by one of library dependencies:",
"\t* org.scala-lang:scala-library:2.10.3 is selected over 2.10.2", "\t* org.scala-lang:scala-library:2.10.3 is selected over 2.10.2",
@ -135,13 +135,13 @@ class EvictionWarningSpec extends BaseIvySpecification {
def scalaVersionWarn5() = { def scalaVersionWarn5() = {
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2")) val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).scalaEvictions should have size (0) EvictionWarning(m, defaultOptions, report).scalaEvictions should have size (0)
} }
def scalaVersionWarn6() = { def scalaVersionWarn6() = {
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2")) val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withWarnScalaVersionEviction(false), report, log).scalaEvictions should have size (0) EvictionWarning(m, defaultOptions.withWarnScalaVersionEviction(false), report).scalaEvictions should have size (0)
} }
def javaLibDirectDeps = Vector(commonsIo14, commonsIo24) def javaLibDirectDeps = Vector(commonsIo14, commonsIo24)
@ -149,24 +149,25 @@ class EvictionWarningSpec extends BaseIvySpecification {
def javaLibWarn1() = { def javaLibWarn1() = {
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3")) val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (1) EvictionWarning(m, defaultOptions, report).reportedEvictions should have size (1)
} }
def javaLibWarn2() = { def javaLibWarn2() = {
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3")) val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, EvictionWarning(
defaultOptions m,
.withWarnDirectEvictions(false) defaultOptions
.withWarnTransitiveEvictions(false), .withWarnDirectEvictions(false)
report, .withWarnTransitiveEvictions(false),
log).reportedEvictions should have size (0) report
).reportedEvictions should have size (0)
} }
def javaLibWarn3() = { def javaLibWarn3() = {
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3")) val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).lines shouldBe EvictionWarning(m, defaultOptions, report).lines shouldBe
List( List(
"Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:", "Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:",
"", "",
@ -180,7 +181,7 @@ class EvictionWarningSpec extends BaseIvySpecification {
def javaLibWarn4() = { def javaLibWarn4() = {
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3")) val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions.withShowCallers(true), report, log).lines shouldBe EvictionWarning(m, defaultOptions.withShowCallers(true), report).lines shouldBe
List( List(
"Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:", "Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:",
"", "",
@ -195,14 +196,14 @@ class EvictionWarningSpec extends BaseIvySpecification {
val deps = Vector(commonsIo14, commonsIo13) val deps = Vector(commonsIo14, commonsIo13)
val m = module(defaultModuleId, deps, Some("2.10.3")) val m = module(defaultModuleId, deps, Some("2.10.3"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (0) EvictionWarning(m, defaultOptions, report).reportedEvictions should have size (0)
} }
def javaLibNoWarn2() = { def javaLibNoWarn2() = {
val deps = Vector(commonsIo14, commonsIo13) val deps = Vector(commonsIo14, commonsIo13)
val m = module(defaultModuleId, deps, Some("2.10.3")) val m = module(defaultModuleId, deps, Some("2.10.3"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).lines shouldBe Nil EvictionWarning(m, defaultOptions, report).lines shouldBe Nil
} }
def javaLibTransitiveDeps = Vector(unfilteredUploads080, bnfparser10) def javaLibTransitiveDeps = Vector(unfilteredUploads080, bnfparser10)
@ -210,13 +211,13 @@ class EvictionWarningSpec extends BaseIvySpecification {
def javaLibTransitiveWarn2() = { def javaLibTransitiveWarn2() = {
val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3")) val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (1) EvictionWarning(m, defaultOptions, report).reportedEvictions should have size (1)
} }
def javaLibTransitiveWarn3() = { def javaLibTransitiveWarn3() = {
val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3")) val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).lines shouldBe EvictionWarning(m, defaultOptions, report).lines shouldBe
List( List(
"There may be incompatibilities among your library dependencies.", "There may be incompatibilities among your library dependencies.",
"Here are some of the libraries that were evicted:", "Here are some of the libraries that were evicted:",
@ -228,14 +229,14 @@ class EvictionWarningSpec extends BaseIvySpecification {
val deps = Vector(scala2104, akkaActor214, akkaActor234) val deps = Vector(scala2104, akkaActor214, akkaActor234)
val m = module(defaultModuleId, deps, Some("2.10.4")) val m = module(defaultModuleId, deps, Some("2.10.4"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (1) EvictionWarning(m, defaultOptions, report).reportedEvictions should have size (1)
} }
def scalaLibWarn2() = { def scalaLibWarn2() = {
val deps = Vector(scala2104, akkaActor214, akkaActor234) val deps = Vector(scala2104, akkaActor214, akkaActor234)
val m = module(defaultModuleId, deps, Some("2.10.4")) val m = module(defaultModuleId, deps, Some("2.10.4"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).lines shouldBe EvictionWarning(m, defaultOptions, report).lines shouldBe
List( List(
"Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:", "Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:",
"", "",
@ -250,14 +251,14 @@ class EvictionWarningSpec extends BaseIvySpecification {
val deps = Vector(scala2104, akkaActor230, akkaActor234) val deps = Vector(scala2104, akkaActor230, akkaActor234)
val m = module(defaultModuleId, deps, Some("2.10.4")) val m = module(defaultModuleId, deps, Some("2.10.4"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (0) EvictionWarning(m, defaultOptions, report).reportedEvictions should have size (0)
} }
def scalaLibNoWarn2() = { def scalaLibNoWarn2() = {
val deps = Vector(scala2104, akkaActor230, akkaActor234) val deps = Vector(scala2104, akkaActor230, akkaActor234)
val m = module(defaultModuleId, deps, Some("2.10.4")) val m = module(defaultModuleId, deps, Some("2.10.4"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).lines shouldBe Nil EvictionWarning(m, defaultOptions, report).lines shouldBe Nil
} }
def scalaLibTransitiveDeps = Vector(scala2104, bananaSesame04, akkaRemote234) def scalaLibTransitiveDeps = Vector(scala2104, bananaSesame04, akkaRemote234)
@ -265,13 +266,13 @@ class EvictionWarningSpec extends BaseIvySpecification {
def scalaLibTransitiveWarn2() = { def scalaLibTransitiveWarn2() = {
val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4")) val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (1) EvictionWarning(m, defaultOptions, report).reportedEvictions should have size (1)
} }
def scalaLibTransitiveWarn3() = { def scalaLibTransitiveWarn3() = {
val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4")) val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4"))
val report = ivyUpdate(m) val report = ivyUpdate(m)
EvictionWarning(m, defaultOptions, report, log).lines shouldBe EvictionWarning(m, defaultOptions, report).lines shouldBe
List( List(
"Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:", "Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:",
"", "",