mirror of https://github.com/sbt/sbt.git
Merge pull request #288 from bigwheel/fix-287
[Fix #287] Eviction warning summary shows only binary incompatible
This commit is contained in:
commit
3edf839192
|
|
@ -195,8 +195,16 @@ final class EvictionWarning private[sbt] (
|
|||
val scalaEvictions: Seq[EvictionPair],
|
||||
val directEvictions: Seq[EvictionPair],
|
||||
val transitiveEvictions: Seq[EvictionPair],
|
||||
val allEvictions: Seq[EvictionPair]
|
||||
val allEvictions: Seq[EvictionPair],
|
||||
val binaryIncompatibleEvictionExists: Boolean
|
||||
) {
|
||||
private[sbt] def this(
|
||||
options: EvictionWarningOptions,
|
||||
scalaEvictions: Seq[EvictionPair],
|
||||
directEvictions: Seq[EvictionPair],
|
||||
transitiveEvictions: Seq[EvictionPair],
|
||||
allEvictions: Seq[EvictionPair]
|
||||
) = this(options, scalaEvictions, directEvictions, transitiveEvictions, allEvictions, false)
|
||||
def reportedEvictions: Seq[EvictionPair] =
|
||||
scalaEvictions ++ directEvictions ++ transitiveEvictions
|
||||
private[sbt] def infoAllTheThings: List[String] = EvictionWarning.infoAllTheThings(this)
|
||||
|
|
@ -279,6 +287,7 @@ object EvictionWarning {
|
|||
val scalaEvictions: mutable.ListBuffer[EvictionPair] = mutable.ListBuffer()
|
||||
val directEvictions: mutable.ListBuffer[EvictionPair] = mutable.ListBuffer()
|
||||
val transitiveEvictions: mutable.ListBuffer[EvictionPair] = mutable.ListBuffer()
|
||||
var binaryIncompatibleEvictionExists = false
|
||||
def guessCompatible(p: EvictionPair): Boolean =
|
||||
p.evicteds forall { r =>
|
||||
options.guessCompatible(
|
||||
|
|
@ -288,18 +297,26 @@ object EvictionWarning {
|
|||
pairs foreach {
|
||||
case p if isScalaArtifact(module, p.organization, p.name) =>
|
||||
(module.scalaModuleInfo, p.winner) match {
|
||||
case (Some(s), Some(winner))
|
||||
if (s.scalaFullVersion != winner.module.revision) && options.warnScalaVersionEviction =>
|
||||
scalaEvictions += p
|
||||
case (Some(s), Some(winner)) if (s.scalaFullVersion != winner.module.revision) =>
|
||||
if (options.warnScalaVersionEviction)
|
||||
scalaEvictions += p
|
||||
if (options.warnEvictionSummary)
|
||||
binaryIncompatibleEvictionExists = true
|
||||
case _ =>
|
||||
}
|
||||
case p if p.includesDirect =>
|
||||
if (!guessCompatible(p) && options.warnDirectEvictions) {
|
||||
directEvictions += p
|
||||
if (!guessCompatible(p)) {
|
||||
if (options.warnDirectEvictions)
|
||||
directEvictions += p
|
||||
if (options.warnEvictionSummary)
|
||||
binaryIncompatibleEvictionExists = true
|
||||
}
|
||||
case p =>
|
||||
if (!guessCompatible(p) && options.warnTransitiveEvictions) {
|
||||
transitiveEvictions += p
|
||||
if (!guessCompatible(p)) {
|
||||
if (options.warnTransitiveEvictions)
|
||||
transitiveEvictions += p
|
||||
if (options.warnEvictionSummary)
|
||||
binaryIncompatibleEvictionExists = true
|
||||
}
|
||||
}
|
||||
new EvictionWarning(
|
||||
|
|
@ -307,14 +324,15 @@ object EvictionWarning {
|
|||
scalaEvictions.toList,
|
||||
directEvictions.toList,
|
||||
transitiveEvictions.toList,
|
||||
pairs
|
||||
pairs,
|
||||
binaryIncompatibleEvictionExists
|
||||
)
|
||||
}
|
||||
|
||||
implicit val evictionWarningLines: ShowLines[EvictionWarning] = ShowLines { a: EvictionWarning =>
|
||||
import ShowLines._
|
||||
val out: mutable.ListBuffer[String] = mutable.ListBuffer()
|
||||
if ((a.options.warnEvictionSummary || a.reportedEvictions.nonEmpty) && a.allEvictions.nonEmpty) {
|
||||
if (a.options.warnEvictionSummary && a.binaryIncompatibleEvictionExists) {
|
||||
out += "There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings."
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
|
||||
"""Including two (suspect) binary compatible Java libraries to direct dependencies
|
||||
""" should "not be detected as eviction" in javaLibNoWarn1()
|
||||
it should "print out message about the eviction" in javaLibNoWarn2()
|
||||
it should "not print out message about the eviction" in javaLibNoWarn2()
|
||||
|
||||
"""Including two (suspect) transitively binary incompatible Java libraries to direct dependencies
|
||||
""" should "be detected as eviction" in javaLibTransitiveWarn2()
|
||||
|
|
@ -41,7 +41,8 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
|
||||
"""Including two (suspect) binary compatible Scala libraries to direct dependencies
|
||||
""" should "not be detected as eviction" in scalaLibNoWarn1()
|
||||
it should "print out message about the eviction" in scalaLibNoWarn2()
|
||||
it should "not print out message about the eviction" in scalaLibNoWarn2()
|
||||
it should "not print out summary about the eviction even if warn eviction summary enabled" in scalaLibNoWarn3()
|
||||
|
||||
"""Including two (suspect) transitively binary incompatible Scala libraries to direct dependencies
|
||||
""" should "be detected as eviction" in scalaLibTransitiveWarn2()
|
||||
|
|
@ -111,7 +112,6 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, fullOptions.withShowCallers(false), report).lines shouldBe
|
||||
List(
|
||||
"There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.",
|
||||
"Scala version was updated by one of library dependencies:",
|
||||
"\t* org.scala-lang:scala-library:2.10.3 is selected over 2.10.2",
|
||||
"",
|
||||
|
|
@ -125,7 +125,6 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, fullOptions, report).lines shouldBe
|
||||
List(
|
||||
"There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.",
|
||||
"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 +- com.typesafe.akka:akka-actor_2.10:2.3.0 (depends on 2.10.3)",
|
||||
|
|
@ -182,7 +181,6 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, fullOptions, report).lines shouldBe
|
||||
List(
|
||||
"There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.",
|
||||
"Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:",
|
||||
"",
|
||||
"\t* commons-io:commons-io:2.4 is selected over 1.4",
|
||||
|
|
@ -196,7 +194,6 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, fullOptions.withShowCallers(true), report).lines shouldBe
|
||||
List(
|
||||
"There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.",
|
||||
"Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:",
|
||||
"",
|
||||
"\t* commons-io:commons-io:2.4 is selected over 1.4",
|
||||
|
|
@ -260,7 +257,6 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, fullOptions, report).lines shouldBe
|
||||
List(
|
||||
"There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.",
|
||||
"Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:",
|
||||
"",
|
||||
"\t* com.typesafe.akka:akka-actor_2.10:2.3.4 is selected over 2.1.4",
|
||||
|
|
@ -293,6 +289,13 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
EvictionWarning(m, fullOptions, report).lines shouldBe Nil
|
||||
}
|
||||
|
||||
def scalaLibNoWarn3() = {
|
||||
val deps = Vector(scala2104, akkaActor230, akkaActor234)
|
||||
val m = module(defaultModuleId, deps, Some("2.10.4"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, EvictionWarningOptions.summary, report).lines shouldBe Nil
|
||||
}
|
||||
|
||||
def scalaLibTransitiveDeps = Vector(scala2104, bananaSesame04, akkaRemote234)
|
||||
|
||||
def scalaLibTransitiveWarn2() = {
|
||||
|
|
@ -306,7 +309,6 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, fullOptions, report).lines shouldBe
|
||||
List(
|
||||
"There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.",
|
||||
"Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:",
|
||||
"",
|
||||
"\t* com.typesafe.akka:akka-actor_2.10:2.3.4 is selected over 2.1.4",
|
||||
|
|
|
|||
Loading…
Reference in New Issue