From 60b9c7dacba908a8c79f5f25353ba76fb4dd6ecf Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Thu, 15 Feb 2018 08:28:22 +0000 Subject: [PATCH] Remove a bunch of compilation warnings --- build.sbt | 28 +++++--- .../AbstractEngineSpec.scala | 2 +- .../librarymanagement/EvictionWarning.scala | 7 ++ .../librarymanagement/RichUpdateReport.scala | 1 - .../ivy/InlineIvyConfiguration.scala | 1 + ivy/src/main/contraband/lm-ivy.json | 1 + .../librarymanagement/ConvertResolver.scala | 3 +- .../sbt/internal/librarymanagement/Ivy.scala | 20 ++---- .../librarymanagement/IvyActions.scala | 12 ++-- .../librarymanagement/IvyRetrieve.scala | 5 +- .../librarymanagement/IvyScalaUtil.scala | 3 +- .../CachedResolutionResolveEngine.scala | 72 +++++++++---------- .../ivyint/GigahorseUrlHandler.scala | 3 +- .../ivyint/ParallelResolveEngine.scala | 0 .../ivyint/SbtChainResolver.scala | 3 +- .../EvictionWarningSpec.scala | 55 +++++++------- 16 files changed, 107 insertions(+), 109 deletions(-) mode change 100755 => 100644 ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/ParallelResolveEngine.scala diff --git a/build.sbt b/build.sbt index b240ea8f3..40a6424b8 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,5 @@ import Dependencies._ import Path._ -//import com.typesafe.tools.mima.core._, ProblemFilters._ def commonSettings: Seq[Setting[_]] = Seq( scalaVersion := scala212, @@ -35,15 +34,6 @@ val mimaSettings = Def settings ( organization.value %% moduleName.value % version 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(".")) @@ -143,6 +133,24 @@ lazy val lmIvy = (project in file("ivy")) scalacOptions in (Compile, console) --= Vector("-Ywarn-unused-import", "-Ywarn-unused", "-Xlint"), 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( diff --git a/common-test/src/main/scala/sbt/internal/librarymanagement/AbstractEngineSpec.scala b/common-test/src/main/scala/sbt/internal/librarymanagement/AbstractEngineSpec.scala index 614f8d34a..f8b404e9f 100644 --- a/common-test/src/main/scala/sbt/internal/librarymanagement/AbstractEngineSpec.scala +++ b/common-test/src/main/scala/sbt/internal/librarymanagement/AbstractEngineSpec.scala @@ -17,5 +17,5 @@ abstract class AbstractEngineSpec extends UnitSpec { case Left(w) => throw w.resolveException } - def cleanCachedResolutionCache(module: ModuleDescriptor): Unit = () + def cleanCachedResolutionCache(@deprecated("unused", "") module: ModuleDescriptor): Unit = () } diff --git a/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala b/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala index 90de0250f..6b782bf8b 100644 --- a/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala +++ b/core/src/main/scala/sbt/librarymanagement/EvictionWarning.scala @@ -192,11 +192,18 @@ final class EvictionWarning private[sbt] ( } object EvictionWarning { + @deprecated("Use variant that doesn't take an unused logger", "1.2.0") def apply( module: ModuleDescriptor, options: EvictionWarningOptions, report: UpdateReport, log: Logger + ): EvictionWarning = apply(module, options, report) + + def apply( + module: ModuleDescriptor, + options: EvictionWarningOptions, + report: UpdateReport ): EvictionWarning = { val evictions = buildEvictions(options, report) processEvictions(module, options, evictions) diff --git a/core/src/main/scala/sbt/librarymanagement/RichUpdateReport.scala b/core/src/main/scala/sbt/librarymanagement/RichUpdateReport.scala index 97f672faa..c97bf9da1 100644 --- a/core/src/main/scala/sbt/librarymanagement/RichUpdateReport.scala +++ b/core/src/main/scala/sbt/librarymanagement/RichUpdateReport.scala @@ -2,7 +2,6 @@ package sbt package librarymanagement import java.io.File -import java.io.FileNotFoundException import sbt.io.IO /** diff --git a/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/InlineIvyConfiguration.scala b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/InlineIvyConfiguration.scala index 0d781c437..0ec6e904b 100644 --- a/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/InlineIvyConfiguration.scala +++ b/ivy/src/main/contraband-scala/sbt/librarymanagement/ivy/InlineIvyConfiguration.scala @@ -76,6 +76,7 @@ final class InlineIvyConfiguration private ( } object InlineIvyConfiguration { /** Provided for backward compatibility. */ + @deprecated("Use an alternative apply", "1.2.0") def apply( paths: sbt.librarymanagement.ivy.IvyPaths, resolvers: Vector[sbt.librarymanagement.Resolver], diff --git a/ivy/src/main/contraband/lm-ivy.json b/ivy/src/main/contraband/lm-ivy.json index dc239f8d8..383e17549 100644 --- a/ivy/src/main/contraband/lm-ivy.json +++ b/ivy/src/main/contraband/lm-ivy.json @@ -78,6 +78,7 @@ ], "extraCompanion": [ "/** Provided for backward compatibility. */", + "@deprecated(\"Use an alternative apply\", \"1.2.0\")", "def apply(", " paths: sbt.librarymanagement.ivy.IvyPaths,", " resolvers: Vector[sbt.librarymanagement.Resolver],", diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/ConvertResolver.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ConvertResolver.scala index cc13ea745..0cc3bbbe1 100644 --- a/ivy/src/main/scala/sbt/internal/librarymanagement/ConvertResolver.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/ConvertResolver.scala @@ -246,7 +246,6 @@ private[sbt] object ConvertResolver { import sbt.io.syntax._ private def downloadChecksum(resource: Resource, - target: File, targetChecksumFile: File, algorithm: String): Boolean = { if (!ChecksumHelper.isKnownAlgorithm(algorithm)) @@ -278,7 +277,7 @@ private[sbt] object ConvertResolver { // Continue checking until we hit a failure val checksumFile = new File(targetPath.stripSuffix(PartEnd) + s".$algorithm") if (checked) checked - else downloadChecksum(resource, target, checksumFile, algorithm) + else downloadChecksum(resource, checksumFile, algorithm) } // -ivy deviation size diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/Ivy.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/Ivy.scala index cdbfd2ee3..5a257844e 100644 --- a/ivy/src/main/scala/sbt/internal/librarymanagement/Ivy.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/Ivy.scala @@ -207,12 +207,8 @@ final class IvySbt(val configuration: IvyConfiguration) { self => } } - /** - * Cleans cached resolution cache. - * - * @param md - module descriptor of the original Ivy graph. - */ - private[sbt] def cleanCachedResolutionCache(md: ModuleDescriptor, log: Logger): Unit = { + /** Cleans cached resolution cache. */ + private[sbt] def cleanCachedResolutionCache(): Unit = { if (!configuration.updateOptions.cachedResolution) () else IvySbt.cachedResolutionResolveCache.clean() } @@ -260,12 +256,9 @@ final class IvySbt(val configuration: IvyConfiguration) { self => } val configs = configurations - moduleSettings.scalaModuleInfo match { - case Some(is) => - val svc = configs.toVector filter Configurations.underScalaVersion map { _.name } - IvyScalaUtil.checkModule(baseModule, baseConfiguration, svc, getLog(configuration.log))( - is) - case _ => // do nothing + moduleSettings.scalaModuleInfo foreach { is => + val svc = configs filter Configurations.underScalaVersion map { _.name } + IvyScalaUtil.checkModule(baseModule, svc, getLog(configuration.log))(is) } IvySbt.addExtraNamespace(baseModule) (baseModule, baseConfiguration) @@ -278,8 +271,7 @@ final class IvySbt(val configuration: IvyConfiguration) { self => "Default", ModuleDescriptor.DEFAULT_CONFIGURATION) log.debug( - "Using inline dependencies specified in Scala" + (if (ivyXML.isEmpty) "." - else " and XML.") + s"Using inline dependencies specified in Scala${(if (ivyXML.isEmpty) "" else " and XML")}." ) val parser = IvySbt.parseIvyXML( diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/IvyActions.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyActions.scala index e62d7b0ca..e5b31cad4 100644 --- a/ivy/src/main/scala/sbt/internal/librarymanagement/IvyActions.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyActions.scala @@ -51,8 +51,8 @@ object IvyActions { * This is called by clean. */ private[sbt] def cleanCachedResolutionCache(module: IvySbt#Module, log: Logger): Unit = - module.withModule(log) { (ivy, md, default) => - module.owner.cleanCachedResolutionCache(md, log) + module.withModule(log) { (_, _, _) => + module.owner.cleanCachedResolutionCache() } /** Creates a Maven pom from the given Ivy configuration*/ @@ -188,7 +188,7 @@ object IvyActions { log: Logger ): Either[UnresolvedWarning, UpdateReport] = { module.withModule(log) { - case (ivy, moduleDescriptor, defaultConf) => + case (ivy, moduleDescriptor, _) => // Warn about duplicated and inconsistent dependencies val iw = IvySbt.inconsistentDuplicateWarning(moduleDescriptor) iw.foreach(log.warn(_)) @@ -202,7 +202,7 @@ object IvyActions { val cache = metadataDirectory.getOrElse(sys.error("Missing directory for cached resolution.")) cachedResolveAndRetrieve(inputs, cache) - } else resolveAndRetrieve(inputs, defaultConf) + } else resolveAndRetrieve(inputs) } // Convert to unresolved warning or retrieve update report @@ -287,12 +287,10 @@ object IvyActions { * like its counterpart [[CachedResolutionResolveEngine.customResolve]]. * * @param inputs The resolution inputs. - * @param defaultModuleConfiguration The default ivy configuration. * @return The result of the resolution. */ private[this] def resolveAndRetrieve( - inputs: ResolutionInputs, - defaultModuleConfiguration: String + inputs: ResolutionInputs ): Either[ResolveException, UpdateReport] = { // Populate resolve options from the passed arguments val ivyInstance = inputs.ivy diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala index 728ffde1b..e38618ddd 100644 --- a/ivy/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyRetrieve.scala @@ -28,12 +28,11 @@ object IvyRetrieve { @deprecated("Internal only. No longer in use.", "0.13.6") def artifactReports(mid: ModuleID, artReport: Seq[ArtifactDownloadReport]): ModuleReport = { - val (resolved, missing) = artifacts(mid, artReport) + val (resolved, missing) = artifacts(artReport) ModuleReport(mid, resolved, missing) } private[sbt] def artifacts( - mid: ModuleID, artReport: Seq[ArtifactDownloadReport] ): (Vector[(Artifact, File)], Vector[Artifact]) = { val missing = new mutable.ListBuffer[Artifact] @@ -180,7 +179,7 @@ object IvyRetrieve { case _ => Vector.empty } 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( moduleId, diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/IvyScalaUtil.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyScalaUtil.scala index ed21d56ae..bc53f3256 100644 --- a/ivy/src/main/scala/sbt/internal/librarymanagement/IvyScalaUtil.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/IvyScalaUtil.scala @@ -6,7 +6,7 @@ package sbt.internal.librarymanagement import java.util.Collections.emptyMap 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.plugins.matcher.ExactPatternMatcher import org.apache.ivy.plugins.namespace.NamespaceTransformer @@ -19,7 +19,6 @@ object IvyScalaUtil { /** Performs checks/adds filters on Scala dependencies (if enabled in ScalaModuleInfo). */ def checkModule( module: DefaultModuleDescriptor, - conf: String, scalaVersionConfigs: Vector[String], log: Logger )(check: ScalaModuleInfo): Unit = { diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala index 7f751ba3d..d2d8086ba 100644 --- a/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/CachedResolutionResolveEngine.scala @@ -65,10 +65,10 @@ private[sbt] class CachedResolutionResolveCache { def directDependencies(md0: ModuleDescriptor): Vector[DependencyDescriptor] = md0.getDependencies.toVector + // Returns a vector of (module descriptor, changing, dd) def buildArtificialModuleDescriptors( md0: ModuleDescriptor, - data: ResolveData, prOpt: Option[ProjectResolver], log: Logger ): Vector[(DefaultModuleDescriptor, Boolean, DependencyDescriptor)] = { @@ -80,9 +80,10 @@ private[sbt] class CachedResolutionResolveCache { s"""${x.getName}:${x.getType}:${x.getExt}:${x.getExtraAttributes}""" } log.debug(s"::: dd: $dd (artifacts: ${arts.mkString(",")})") - buildArtificialModuleDescriptor(dd, rootModuleConfigs, md0, prOpt, log) + buildArtificialModuleDescriptor(dd, rootModuleConfigs, md0, prOpt) } } + def internalDependency( dd: DependencyDescriptor, prOpt: Option[ProjectResolver] @@ -91,12 +92,12 @@ private[sbt] class CachedResolutionResolveCache { case Some(pr) => pr.getModuleDescriptor(dd.getDependencyRevisionId) case _ => None } + def buildArtificialModuleDescriptor( dd: DependencyDescriptor, rootModuleConfigs: Vector[IvyConfiguration], parent: ModuleDescriptor, - prOpt: Option[ProjectResolver], - log: Logger + prOpt: Option[ProjectResolver] ): (DefaultModuleDescriptor, Boolean, DependencyDescriptor) = { def excludeRuleString(rule: ExcludeRule): String = 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 options1 = new ResolveOptions(options0) val data = new ResolveData(this, options1) - val mds = cache.buildArtificialModuleDescriptors(md0, data, projectResolver, log) + val mds = cache.buildArtificialModuleDescriptors(md0, projectResolver, log) def doWork( md: ModuleDescriptor, @@ -475,15 +476,11 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine { os: Vector[IvyOverride], log: Logger ): Either[ResolveException, UpdateReport] = - if (!missingOk && (results exists { _.isLeft })) Left(mergeErrors(md0, results collect { - case Left(re) => re - }, log)) + if (!missingOk && (results exists { _.isLeft })) + Left(mergeErrors(md0, results collect { case Left(re) => re })) else Right(mergeReports(md0, results collect { case Right(ur) => ur }, resolveTime, os, log)) - def mergeErrors( - md0: ModuleDescriptor, - errors: Vector[ResolveException], - log: Logger - ): ResolveException = { + + def mergeErrors(md0: ModuleDescriptor, errors: Vector[ResolveException]): ResolveException = { val messages = errors flatMap { _.messages } val failed = errors flatMap { _.failed } val failedPaths = errors flatMap { @@ -497,6 +494,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine { } new ResolveException(messages, failed, ListMap(failedPaths: _*)) } + def mergeReports( md0: ModuleDescriptor, reports: Vector[UpdateReport], @@ -524,6 +522,7 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine { } UpdateReport(cachedDescriptor, configReports, stats, Map.empty) } + // memory usage 62%, of which 58% is in mergeOrganizationArtifactReports def mergeConfigurationReports( 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}" ) } - def mergeModuleReports( - org: String, - name: String, - version: String, - xs: Vector[ModuleReport] - ): ModuleReport = { + def mergeModuleReports(xs: Vector[ModuleReport]): ModuleReport = { val completelyEvicted = xs forall { _.evicted } 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. @@ -773,9 +767,9 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine { val merged = (modules groupBy { m => (m.module.organization, m.module.name, m.module.revision) }).toSeq.toVector flatMap { - case ((org, name, version), xs) => + case (_, xs) => if (xs.size < 2) xs - else Vector(mergeModuleReports(org, name, version, xs)) + else Vector(mergeModuleReports(xs)) } val conflicts = merged filter { m => !m.evicted && m.problem.isEmpty @@ -805,26 +799,26 @@ private[sbt] trait CachedResolutionResolveEngine extends ResolveEngine { mr.callers forall { c => em(c.caller) } - val reports - : Seq[((String, String), Vector[OrganizationArtifactReport])] = reports0.toSeq flatMap { - case (k, v) if !(pairs contains k) => Seq() - case ((organization, name), oars0) => - val oars = oars0 map { oar => - val (affected, unaffected) = oar.modules partition { mr => - val x = !mr.evicted && mr.problem.isEmpty && isTransitivelyEvicted(mr) - if (x) { - log.debug(s""":::: transitively evicted $rootModuleConf: ${mr.module}""") + val reports: Seq[((String, String), Vector[OrganizationArtifactReport])] = + reports0.toSeq flatMap { + case (k, _) if !(pairs contains k) => Seq() + case ((organization, name), oars0) => + val oars = oars0 map { oar => + val (affected, unaffected) = oar.modules partition { mr => + val x = !mr.evicted && mr.problem.isEmpty && isTransitivelyEvicted(mr) + if (x) { + 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 { - _.withEvicted(true).withEvictedReason(Some("transitive-evict")) - } - if (affected.isEmpty) oar - else OrganizationArtifactReport(organization, name, unaffected ++ newlyEvicted) - } - Seq(((organization, name), oars)) - } + Seq(((organization, name), oars)) + } Map(reports: _*) } diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/GigahorseUrlHandler.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/GigahorseUrlHandler.scala index 866808c58..6a2e7acba 100644 --- a/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/GigahorseUrlHandler.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/GigahorseUrlHandler.scala @@ -243,7 +243,8 @@ object GigahorseUrlHandler { if (status == 407 /* PROXY_AUTHENTICATION_REQUIRED */ ) { Message.warn("Your proxy requires authentication.") } 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")) { Message.verbose("CLIENT ERROR: " + response.message() + " url=" + url) } else if (String.valueOf(status).startsWith("5")) { diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/ParallelResolveEngine.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/ParallelResolveEngine.scala old mode 100755 new mode 100644 diff --git a/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/SbtChainResolver.scala b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/SbtChainResolver.scala index fb2e9b1d3..d16ec40e3 100644 --- a/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/SbtChainResolver.scala +++ b/ivy/src/main/scala/sbt/internal/librarymanagement/ivyint/SbtChainResolver.scala @@ -219,7 +219,7 @@ private[sbt] case class SbtChainResolver( Message.warn(s"Choosing $resolver for ${resolvedModule.getId}") // Now that we know the real latest revision, let's force Ivy to use it 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. artifactOpt.foreach { artifactRef => val dep = toSystem(descriptor) @@ -385,7 +385,6 @@ private[sbt] case class SbtChainResolver( /** Ported from BasicResolver#findFirstAirfactRef. */ private[this] def findFirstArtifactRef( md: ModuleDescriptor, - dd: DependencyDescriptor, data: ResolveData, resolver: DependencyResolver ): Option[ResolvedResource] = { diff --git a/ivy/src/test/scala/sbt/internal/librarymanagement/EvictionWarningSpec.scala b/ivy/src/test/scala/sbt/internal/librarymanagement/EvictionWarningSpec.scala index 488ead1f3..e2ced784f 100644 --- a/ivy/src/test/scala/sbt/internal/librarymanagement/EvictionWarningSpec.scala +++ b/ivy/src/test/scala/sbt/internal/librarymanagement/EvictionWarningSpec.scala @@ -48,8 +48,8 @@ class EvictionWarningSpec extends BaseIvySpecification { val m1 = "org.scala-sbt" % "util-logging" % "0.13.16" val m2 = "org.scala-sbt" % "util-logging" % "0.13.1" assert( - EvictionWarningOptions - .defaultGuess((m1, Option(m2), Option(dummyScalaModuleInfo("2.10.6")))) == false) + !EvictionWarningOptions.defaultGuess((m1, Option(m2), Option(dummyScalaModuleInfo("2.10.6")))) + ) } "Comparing sbt 1.x" should "use Semantic Versioning semantics" in { @@ -93,19 +93,19 @@ class EvictionWarningSpec extends BaseIvySpecification { def scalaVersionWarn1() = { val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false) 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() = { val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false) 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() = { val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false) val report = ivyUpdate(m) - EvictionWarning(m, defaultOptions.withShowCallers(false), report, log).lines shouldBe + EvictionWarning(m, defaultOptions.withShowCallers(false), report).lines shouldBe List( "Scala version was updated by one of library dependencies:", "\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() = { val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false) val report = ivyUpdate(m) - EvictionWarning(m, defaultOptions, report, log).lines shouldBe + EvictionWarning(m, defaultOptions, report).lines shouldBe List( "Scala version was updated by one of library dependencies:", "\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() = { val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2")) 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() = { val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2")) 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) @@ -149,24 +149,25 @@ class EvictionWarningSpec extends BaseIvySpecification { def javaLibWarn1() = { val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3")) 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() = { val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3")) val report = ivyUpdate(m) - EvictionWarning(m, - defaultOptions - .withWarnDirectEvictions(false) - .withWarnTransitiveEvictions(false), - report, - log).reportedEvictions should have size (0) + EvictionWarning( + m, + defaultOptions + .withWarnDirectEvictions(false) + .withWarnTransitiveEvictions(false), + report + ).reportedEvictions should have size (0) } def javaLibWarn3() = { val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3")) val report = ivyUpdate(m) - EvictionWarning(m, defaultOptions, report, log).lines shouldBe + EvictionWarning(m, defaultOptions, report).lines shouldBe List( "Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:", "", @@ -180,7 +181,7 @@ class EvictionWarningSpec extends BaseIvySpecification { def javaLibWarn4() = { val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3")) val report = ivyUpdate(m) - EvictionWarning(m, defaultOptions.withShowCallers(true), report, log).lines shouldBe + EvictionWarning(m, defaultOptions.withShowCallers(true), report).lines shouldBe List( "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 m = module(defaultModuleId, deps, Some("2.10.3")) 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() = { val deps = Vector(commonsIo14, commonsIo13) val m = module(defaultModuleId, deps, Some("2.10.3")) val report = ivyUpdate(m) - EvictionWarning(m, defaultOptions, report, log).lines shouldBe Nil + EvictionWarning(m, defaultOptions, report).lines shouldBe Nil } def javaLibTransitiveDeps = Vector(unfilteredUploads080, bnfparser10) @@ -210,13 +211,13 @@ class EvictionWarningSpec extends BaseIvySpecification { def javaLibTransitiveWarn2() = { val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3")) 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() = { val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3")) val report = ivyUpdate(m) - EvictionWarning(m, defaultOptions, report, log).lines shouldBe + EvictionWarning(m, defaultOptions, report).lines shouldBe List( "There may be incompatibilities among your library dependencies.", "Here are some of the libraries that were evicted:", @@ -228,14 +229,14 @@ class EvictionWarningSpec extends BaseIvySpecification { val deps = Vector(scala2104, akkaActor214, akkaActor234) val m = module(defaultModuleId, deps, Some("2.10.4")) 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() = { val deps = Vector(scala2104, akkaActor214, akkaActor234) val m = module(defaultModuleId, deps, Some("2.10.4")) val report = ivyUpdate(m) - EvictionWarning(m, defaultOptions, report, log).lines shouldBe + EvictionWarning(m, defaultOptions, report).lines shouldBe List( "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 m = module(defaultModuleId, deps, Some("2.10.4")) 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() = { val deps = Vector(scala2104, akkaActor230, akkaActor234) val m = module(defaultModuleId, deps, Some("2.10.4")) 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) @@ -265,13 +266,13 @@ class EvictionWarningSpec extends BaseIvySpecification { def scalaLibTransitiveWarn2() = { val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4")) 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() = { val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4")) val report = ivyUpdate(m) - EvictionWarning(m, defaultOptions, report, log).lines shouldBe + EvictionWarning(m, defaultOptions, report).lines shouldBe List( "Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:", "",