2015-09-07 10:33:45 +02:00
|
|
|
package sbt.librarymanagement
|
|
|
|
|
|
|
|
|
|
import sbt.internal.librarymanagement.BaseIvySpecification
|
2014-07-27 18:26:12 +02:00
|
|
|
|
|
|
|
|
class EvictionWarningSpec extends BaseIvySpecification {
|
2015-09-05 11:32:07 +02:00
|
|
|
// This is a specification to check the eviction warnings
|
|
|
|
|
|
2016-06-02 23:15:06 +02:00
|
|
|
"""Eviction of non-overridden scala-library whose scalaVersion
|
2016-01-16 16:44:55 +01:00
|
|
|
""" should "be detected" in scalaVersionWarn1()
|
2016-06-02 23:15:06 +02:00
|
|
|
it should "not be detected if it's disabled" in scalaVersionWarn2()
|
2015-08-31 17:13:19 +02:00
|
|
|
it should "print out message about the eviction" in scalaVersionWarn3()
|
|
|
|
|
it should "print out message about the eviction with callers" in scalaVersionWarn4()
|
2015-09-05 11:32:07 +02:00
|
|
|
|
2016-06-02 23:15:06 +02:00
|
|
|
"""Non-eviction of overridden scala-library whose scalaVersion
|
|
|
|
|
""" should "not be detected if it's enabled" in scalaVersionWarn5()
|
|
|
|
|
it should "not be detected if it's disabled" in scalaVersionWarn6()
|
|
|
|
|
|
2016-01-16 16:44:55 +01:00
|
|
|
"""Including two (suspect) binary incompatible Java libraries to direct dependencies
|
|
|
|
|
""" should "be detected as eviction" in javaLibWarn1()
|
2015-08-31 17:13:19 +02:00
|
|
|
it should "not be detected if it's disabled" in javaLibWarn2()
|
|
|
|
|
it should "print out message about the eviction" in javaLibWarn3()
|
|
|
|
|
it should "print out message about the eviction with callers" in javaLibWarn4()
|
2015-09-05 11:32:07 +02:00
|
|
|
|
2016-01-16 16:44:55 +01:00
|
|
|
"""Including two (suspect) binary compatible Java libraries to direct dependencies
|
|
|
|
|
""" should "not be detected as eviction" in javaLibNoWarn1()
|
2015-08-31 17:13:19 +02:00
|
|
|
it should "print out message about the eviction" in javaLibNoWarn2()
|
2015-09-05 11:32:07 +02:00
|
|
|
|
2016-01-16 16:44:55 +01:00
|
|
|
"""Including two (suspect) transitively binary incompatible Java libraries to direct dependencies
|
|
|
|
|
""" should "be not detected as eviction" in javaLibTransitiveWarn1()
|
2015-08-31 17:13:19 +02:00
|
|
|
it should "be detected if it's enabled" in javaLibTransitiveWarn2()
|
2015-09-05 11:32:07 +02:00
|
|
|
|
2016-01-16 16:44:55 +01:00
|
|
|
//it should "print out message about the eviction if it's enabled" in javaLibTransitiveWarn3()
|
|
|
|
|
|
|
|
|
|
"""Including two (suspect) binary incompatible Scala libraries to direct dependencies
|
|
|
|
|
""" should "be detected as eviction" in scalaLibWarn1()
|
2015-08-31 17:13:19 +02:00
|
|
|
it should "print out message about the eviction" in scalaLibWarn2()
|
2015-09-05 11:32:07 +02:00
|
|
|
|
2016-01-16 16:44:55 +01:00
|
|
|
"""Including two (suspect) binary compatible Scala libraries to direct dependencies
|
|
|
|
|
""" should "not be detected as eviction" in scalaLibNoWarn1()
|
2015-08-31 17:13:19 +02:00
|
|
|
it should "print out message about the eviction" in scalaLibNoWarn2()
|
2015-09-05 11:32:07 +02:00
|
|
|
|
2016-01-16 16:44:55 +01:00
|
|
|
"""Including two (suspect) transitively binary incompatible Scala libraries to direct dependencies
|
|
|
|
|
""" should "be not detected as eviction" in scalaLibTransitiveWarn1()
|
2015-08-31 17:13:19 +02:00
|
|
|
it should "be detected if it's enabled" in scalaLibTransitiveWarn2()
|
|
|
|
|
it should "print out message about the eviction if it's enabled" in scalaLibTransitiveWarn3()
|
2014-07-27 18:26:12 +02:00
|
|
|
|
2016-11-02 16:22:55 +01:00
|
|
|
def akkaActor214 = ModuleID("com.typesafe.akka", "akka-actor", "2.1.4").withConfigurations(Some("compile")) cross CrossVersion.binary
|
|
|
|
|
def akkaActor230 = ModuleID("com.typesafe.akka", "akka-actor", "2.3.0").withConfigurations(Some("compile")) cross CrossVersion.binary
|
|
|
|
|
def akkaActor234 = ModuleID("com.typesafe.akka", "akka-actor", "2.3.4").withConfigurations(Some("compile")) cross CrossVersion.binary
|
|
|
|
|
def scala2102 = ModuleID("org.scala-lang", "scala-library", "2.10.2").withConfigurations(Some("compile"))
|
|
|
|
|
def scala2103 = ModuleID("org.scala-lang", "scala-library", "2.10.3").withConfigurations(Some("compile"))
|
|
|
|
|
def scala2104 = ModuleID("org.scala-lang", "scala-library", "2.10.4").withConfigurations(Some("compile"))
|
|
|
|
|
def commonsIo13 = ModuleID("commons-io", "commons-io", "1.3").withConfigurations(Some("compile"))
|
|
|
|
|
def commonsIo14 = ModuleID("commons-io", "commons-io", "1.4").withConfigurations(Some("compile"))
|
|
|
|
|
def commonsIo24 = ModuleID("commons-io", "commons-io", "2.4").withConfigurations(Some("compile"))
|
|
|
|
|
def bnfparser10 = ModuleID("ca.gobits.bnf", "bnfparser", "1.0").withConfigurations(Some("compile")) // uses commons-io 2.4
|
|
|
|
|
def unfilteredUploads080 = ModuleID("net.databinder", "unfiltered-uploads", "0.8.0").withConfigurations(Some("compile")) cross CrossVersion.binary // uses commons-io 1.4
|
|
|
|
|
def bananaSesame04 = ModuleID("org.w3", "banana-sesame", "0.4").withConfigurations(Some("compile")) cross CrossVersion.binary // uses akka-actor 2.1.4
|
|
|
|
|
def akkaRemote234 = ModuleID("com.typesafe.akka", "akka-remote", "2.3.4").withConfigurations(Some("compile")) cross CrossVersion.binary // uses akka-actor 2.3.4
|
2014-07-27 18:26:12 +02:00
|
|
|
|
|
|
|
|
def defaultOptions = EvictionWarningOptions.default
|
|
|
|
|
|
2015-09-05 11:32:07 +02:00
|
|
|
import sbt.internal.util.ShowLines._
|
2014-07-27 18:26:12 +02:00
|
|
|
|
2016-11-02 16:22:55 +01:00
|
|
|
def scalaVersionDeps = Vector(scala2102, akkaActor230)
|
2014-07-27 18:26:12 +02:00
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def scalaVersionWarn1() = {
|
2016-06-02 23:15:06 +02:00
|
|
|
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false)
|
2014-07-27 18:26:12 +02:00
|
|
|
val report = ivyUpdate(m)
|
2015-08-31 17:13:19 +02:00
|
|
|
EvictionWarning(m, defaultOptions, report, log).scalaEvictions should have size (1)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def scalaVersionWarn2() = {
|
2016-06-02 23:15:06 +02:00
|
|
|
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false)
|
2014-07-27 18:26:12 +02:00
|
|
|
val report = ivyUpdate(m)
|
2015-08-31 17:13:19 +02:00
|
|
|
EvictionWarning(m, defaultOptions.withWarnScalaVersionEviction(false), report, log).scalaEvictions should have size (0)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def scalaVersionWarn3() = {
|
2016-06-02 23:15:06 +02:00
|
|
|
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false)
|
2014-07-27 18:26:12 +02:00
|
|
|
val report = ivyUpdate(m)
|
2015-09-05 11:32:07 +02:00
|
|
|
EvictionWarning(m, defaultOptions, report, log).lines shouldBe
|
2015-09-16 14:57:00 +02:00
|
|
|
List(
|
|
|
|
|
"Scala version was updated by one of library dependencies:",
|
2014-07-27 18:26:12 +02:00
|
|
|
"\t* org.scala-lang:scala-library:2.10.2 -> 2.10.3",
|
2014-08-18 06:54:19 +02:00
|
|
|
"To force scalaVersion, add the following:",
|
|
|
|
|
"\tivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }",
|
2015-09-16 14:57:00 +02:00
|
|
|
"Run 'evicted' to see detailed eviction warnings"
|
|
|
|
|
)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def scalaVersionWarn4() = {
|
2016-06-02 23:15:06 +02:00
|
|
|
val m = module(defaultModuleId, scalaVersionDeps, Some("2.10.2"), overrideScalaVersion = false)
|
2014-07-27 18:26:12 +02:00
|
|
|
val report = ivyUpdate(m)
|
2015-09-05 11:32:07 +02:00
|
|
|
EvictionWarning(m, defaultOptions.withShowCallers(true), report, log).lines shouldBe
|
2015-09-16 14:57:00 +02:00
|
|
|
List(
|
|
|
|
|
"Scala version was updated by one of library dependencies:",
|
2014-08-18 06:54:19 +02:00
|
|
|
"\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)",
|
|
|
|
|
"To force scalaVersion, add the following:",
|
2015-09-16 14:57:00 +02:00
|
|
|
"\tivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }"
|
|
|
|
|
)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2016-06-02 23:15:06 +02:00
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-02 16:22:55 +01:00
|
|
|
def javaLibDirectDeps = Vector(commonsIo14, commonsIo24)
|
2014-07-27 18:26:12 +02:00
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def javaLibWarn1() = {
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-08-31 17:13:19 +02:00
|
|
|
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (1)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def javaLibWarn2() = {
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-08-31 17:13:19 +02:00
|
|
|
EvictionWarning(m, defaultOptions.withWarnDirectEvictions(false), report, log).reportedEvictions should have size (0)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def javaLibWarn3() = {
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-09-05 11:32:07 +02:00
|
|
|
EvictionWarning(m, defaultOptions, report, log).lines shouldBe
|
2015-09-16 14:57:00 +02:00
|
|
|
List(
|
|
|
|
|
"There may be incompatibilities among your library dependencies.",
|
2014-07-27 18:26:12 +02:00
|
|
|
"Here are some of the libraries that were evicted:",
|
|
|
|
|
"\t* commons-io:commons-io:1.4 -> 2.4",
|
2015-09-16 14:57:00 +02:00
|
|
|
"Run 'evicted' to see detailed eviction warnings"
|
|
|
|
|
)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def javaLibWarn4() = {
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, javaLibDirectDeps, Some("2.10.3"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-09-05 11:32:07 +02:00
|
|
|
EvictionWarning(m, defaultOptions.withShowCallers(true), report, log).lines shouldBe
|
2015-09-16 14:57:00 +02:00
|
|
|
List(
|
|
|
|
|
"There may be incompatibilities among your library dependencies.",
|
2014-07-27 18:26:12 +02:00
|
|
|
"Here are some of the libraries that were evicted:",
|
2015-09-16 14:57:00 +02:00
|
|
|
"\t* commons-io:commons-io:1.4 -> 2.4 (caller: com.example:foo:0.1.0)"
|
|
|
|
|
)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def javaLibNoWarn1() = {
|
2016-11-02 16:22:55 +01:00
|
|
|
val deps = Vector(commonsIo14, commonsIo13)
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, deps, Some("2.10.3"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-08-31 17:13:19 +02:00
|
|
|
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (0)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def javaLibNoWarn2() = {
|
2016-11-02 16:22:55 +01:00
|
|
|
val deps = Vector(commonsIo14, commonsIo13)
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, deps, Some("2.10.3"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-09-05 11:32:07 +02:00
|
|
|
EvictionWarning(m, defaultOptions, report, log).lines shouldBe Nil
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2016-11-02 16:22:55 +01:00
|
|
|
def javaLibTransitiveDeps = Vector(unfilteredUploads080, bnfparser10)
|
2014-07-27 18:26:12 +02:00
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def javaLibTransitiveWarn1() = {
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-08-31 17:13:19 +02:00
|
|
|
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (0)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def javaLibTransitiveWarn2() = {
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-08-31 17:13:19 +02:00
|
|
|
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true), report, log).reportedEvictions should have size (1)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def javaLibTransitiveWarn3() = {
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, javaLibTransitiveDeps, Some("2.10.3"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-09-05 11:32:07 +02:00
|
|
|
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true).withShowCallers(true), report, log).lines shouldBe
|
2015-09-16 14:57:00 +02:00
|
|
|
List(
|
|
|
|
|
"There may be incompatibilities among your library dependencies.",
|
2014-07-27 18:26:12 +02:00
|
|
|
"Here are some of the libraries that were evicted:",
|
2015-09-16 14:57:00 +02:00
|
|
|
"\t* commons-io:commons-io:1.4 -> 2.4 (caller: ca.gobits.bnf:bnfparser:1.0, net.databinder:unfiltered-uploads_2.10:0.8.0)"
|
|
|
|
|
)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def scalaLibWarn1() = {
|
2016-11-02 16:22:55 +01:00
|
|
|
val deps = Vector(scala2104, akkaActor214, akkaActor234)
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, deps, Some("2.10.4"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-08-31 17:13:19 +02:00
|
|
|
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (1)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def scalaLibWarn2() = {
|
2016-11-02 16:22:55 +01:00
|
|
|
val deps = Vector(scala2104, akkaActor214, akkaActor234)
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, deps, Some("2.10.4"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-09-05 11:32:07 +02:00
|
|
|
EvictionWarning(m, defaultOptions, report, log).lines shouldBe
|
2015-09-16 14:57:00 +02:00
|
|
|
List(
|
|
|
|
|
"There may be incompatibilities among your library dependencies.",
|
2014-07-27 18:26:12 +02:00
|
|
|
"Here are some of the libraries that were evicted:",
|
|
|
|
|
"\t* com.typesafe.akka:akka-actor_2.10:2.1.4 -> 2.3.4",
|
2015-09-16 14:57:00 +02:00
|
|
|
"Run 'evicted' to see detailed eviction warnings"
|
|
|
|
|
)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def scalaLibNoWarn1() = {
|
2016-11-02 16:22:55 +01:00
|
|
|
val deps = Vector(scala2104, akkaActor230, akkaActor234)
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, deps, Some("2.10.4"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-08-31 17:13:19 +02:00
|
|
|
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (0)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def scalaLibNoWarn2() = {
|
2016-11-02 16:22:55 +01:00
|
|
|
val deps = Vector(scala2104, akkaActor230, akkaActor234)
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, deps, Some("2.10.4"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-09-05 11:32:07 +02:00
|
|
|
EvictionWarning(m, defaultOptions, report, log).lines shouldBe Nil
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2016-11-02 16:22:55 +01:00
|
|
|
def scalaLibTransitiveDeps = Vector(scala2104, bananaSesame04, akkaRemote234)
|
2014-07-27 18:26:12 +02:00
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def scalaLibTransitiveWarn1() = {
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-08-31 17:13:19 +02:00
|
|
|
EvictionWarning(m, defaultOptions, report, log).reportedEvictions should have size (0)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def scalaLibTransitiveWarn2() = {
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-08-31 17:13:19 +02:00
|
|
|
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true), report, log).reportedEvictions should have size (1)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
2015-08-31 17:13:19 +02:00
|
|
|
def scalaLibTransitiveWarn3() = {
|
2014-07-27 18:26:12 +02:00
|
|
|
val m = module(defaultModuleId, scalaLibTransitiveDeps, Some("2.10.4"))
|
|
|
|
|
val report = ivyUpdate(m)
|
2015-09-05 11:32:07 +02:00
|
|
|
EvictionWarning(m, defaultOptions.withWarnTransitiveEvictions(true).withShowCallers(true), report, log).lines shouldBe
|
2015-09-16 14:57:00 +02:00
|
|
|
List(
|
|
|
|
|
"There may be incompatibilities among your library dependencies.",
|
2014-07-27 18:26:12 +02:00
|
|
|
"Here are some of the libraries that were evicted:",
|
2015-09-16 14:57:00 +02:00
|
|
|
"\t* com.typesafe.akka:akka-actor_2.10:2.1.4 -> 2.3.4 (caller: com.typesafe.akka:akka-remote_2.10:2.3.4, org.w3:banana-sesame_2.10:0.4, org.w3:banana-rdf_2.10:0.4)"
|
|
|
|
|
)
|
2014-07-27 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
}
|