mirror of https://github.com/sbt/sbt.git
update EvictionWarningSpec
This commit is contained in:
parent
a50f96c7c4
commit
182a07402a
|
|
@ -59,28 +59,32 @@ final class EvictionWarningOptions private[sbt] (
|
|||
object EvictionWarningOptions {
|
||||
def empty: EvictionWarningOptions =
|
||||
new EvictionWarningOptions(Vector(),
|
||||
warnScalaVersionEviction = false,
|
||||
warnDirectEvictions = false,
|
||||
warnTransitiveEvictions = false,
|
||||
infoAllEvictions = false,
|
||||
showCallers = false,
|
||||
defaultGuess)
|
||||
warnScalaVersionEviction = false,
|
||||
warnDirectEvictions = false,
|
||||
warnTransitiveEvictions = false,
|
||||
infoAllEvictions = false,
|
||||
showCallers = false,
|
||||
defaultGuess)
|
||||
def default: EvictionWarningOptions =
|
||||
new EvictionWarningOptions(Vector(Compile),
|
||||
new EvictionWarningOptions(
|
||||
Vector(Compile),
|
||||
warnScalaVersionEviction = true,
|
||||
warnDirectEvictions = true,
|
||||
warnTransitiveEvictions = true,
|
||||
infoAllEvictions = false,
|
||||
showCallers = true,
|
||||
defaultGuess)
|
||||
defaultGuess
|
||||
)
|
||||
def full: EvictionWarningOptions =
|
||||
new EvictionWarningOptions(Vector(Compile),
|
||||
new EvictionWarningOptions(
|
||||
Vector(Compile),
|
||||
warnScalaVersionEviction = true,
|
||||
warnDirectEvictions = true,
|
||||
warnTransitiveEvictions = true,
|
||||
infoAllEvictions = true,
|
||||
showCallers = true,
|
||||
defaultGuess)
|
||||
defaultGuess
|
||||
)
|
||||
|
||||
lazy val defaultGuess: Function1[(ModuleID, Option[ModuleID], Option[IvyScala]), Boolean] =
|
||||
guessSecondSegment orElse guessSemVer orElse guessFalse
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
it should "print out message about the eviction" in javaLibNoWarn2()
|
||||
|
||||
"""Including two (suspect) transitively binary incompatible Java libraries to direct dependencies
|
||||
""" should "be not detected as eviction" in javaLibTransitiveWarn1()
|
||||
it should "be detected if it's enabled" in javaLibTransitiveWarn2()
|
||||
""" should "be detected as eviction" in javaLibTransitiveWarn2()
|
||||
|
||||
//it should "print out message about the eviction if it's enabled" in javaLibTransitiveWarn3()
|
||||
|
||||
|
|
@ -40,8 +39,7 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
it should "print out message about the eviction" in scalaLibNoWarn2()
|
||||
|
||||
"""Including two (suspect) transitively binary incompatible Scala libraries to direct dependencies
|
||||
""" should "be not detected as eviction" in scalaLibTransitiveWarn1()
|
||||
it should "be detected if it's enabled" in scalaLibTransitiveWarn2()
|
||||
""" should "be detected as eviction" in scalaLibTransitiveWarn2()
|
||||
it should "print out message about the eviction if it's enabled" in scalaLibTransitiveWarn3()
|
||||
|
||||
def akkaActor214 =
|
||||
|
|
@ -89,7 +87,7 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
def scalaVersionWarn3() = {
|
||||
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.withShowCallers(false), report, log).lines shouldBe
|
||||
List(
|
||||
"Scala version was updated by one of library dependencies:",
|
||||
"\t* org.scala-lang:scala-library:2.10.2 -> 2.10.3",
|
||||
|
|
@ -102,7 +100,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.withShowCallers(true), report, log).lines shouldBe
|
||||
EvictionWarning(m, defaultOptions, report, log).lines shouldBe
|
||||
List(
|
||||
"Scala version was updated by one of library dependencies:",
|
||||
"\t* org.scala-lang:scala-library:2.10.2 -> 2.10.3 (caller: com.typesafe.akka:akka-actor_2.10:2.3.0, com.example:foo:0.1.0)",
|
||||
|
|
@ -134,7 +132,12 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
def javaLibWarn2() = {
|
||||
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions.withWarnDirectEvictions(false), report, log).reportedEvictions should have size (0)
|
||||
EvictionWarning(m,
|
||||
defaultOptions
|
||||
.withWarnDirectEvictions(false)
|
||||
.withWarnTransitiveEvictions(false),
|
||||
report,
|
||||
log).reportedEvictions should have size (0)
|
||||
}
|
||||
|
||||
def javaLibWarn3() = {
|
||||
|
|
@ -144,8 +147,7 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
List(
|
||||
"There may be incompatibilities among your library dependencies.",
|
||||
"Here are some of the libraries that were evicted:",
|
||||
"\t* commons-io:commons-io:1.4 -> 2.4",
|
||||
"Run 'evicted' to see detailed eviction warnings"
|
||||
"\t* commons-io:commons-io:1.4 -> 2.4 (caller: com.example:foo:0.1.0)"
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -176,25 +178,16 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
|
||||
def javaLibTransitiveDeps = Vector(unfilteredUploads080, bnfparser10)
|
||||
|
||||
def javaLibTransitiveWarn1() = {
|
||||
val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (0)
|
||||
}
|
||||
|
||||
def javaLibTransitiveWarn2() = {
|
||||
val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true), report, log).reportedEvictions should have size (1)
|
||||
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (1)
|
||||
}
|
||||
|
||||
def javaLibTransitiveWarn3() = {
|
||||
val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m,
|
||||
defaultOptions.withWarnTransitiveEvictions(true).withShowCallers(true),
|
||||
report,
|
||||
log).lines shouldBe
|
||||
EvictionWarning(m, defaultOptions, report, log).lines shouldBe
|
||||
List(
|
||||
"There may be incompatibilities among your library dependencies.",
|
||||
"Here are some of the libraries that were evicted:",
|
||||
|
|
@ -217,8 +210,7 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
List(
|
||||
"There may be incompatibilities among your library dependencies.",
|
||||
"Here are some of the libraries that were evicted:",
|
||||
"\t* com.typesafe.akka:akka-actor_2.10:2.1.4 -> 2.3.4",
|
||||
"Run 'evicted' to see detailed eviction warnings"
|
||||
"\t* com.typesafe.akka:akka-actor_2.10:2.1.4 -> 2.3.4 (caller: com.example:foo:0.1.0)"
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -238,25 +230,16 @@ class EvictionWarningSpec extends BaseIvySpecification {
|
|||
|
||||
def scalaLibTransitiveDeps = Vector(scala2104, bananaSesame04, akkaRemote234)
|
||||
|
||||
def scalaLibTransitiveWarn1() = {
|
||||
val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (0)
|
||||
}
|
||||
|
||||
def scalaLibTransitiveWarn2() = {
|
||||
val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true), report, log).reportedEvictions should have size (1)
|
||||
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (1)
|
||||
}
|
||||
|
||||
def scalaLibTransitiveWarn3() = {
|
||||
val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4"))
|
||||
val report = ivyUpdate(m)
|
||||
EvictionWarning(m,
|
||||
defaultOptions.withWarnTransitiveEvictions(true).withShowCallers(true),
|
||||
report,
|
||||
log).lines shouldBe
|
||||
EvictionWarning(m, defaultOptions, report, log).lines shouldBe
|
||||
List(
|
||||
"There may be incompatibilities among your library dependencies.",
|
||||
"Here are some of the libraries that were evicted:",
|
||||
|
|
|
|||
Loading…
Reference in New Issue