This commit is contained in:
Eugene Yokota 2015-07-09 01:52:00 -04:00
parent 6e1a797896
commit 2bc3b88434
2 changed files with 37 additions and 3 deletions

View File

@ -59,6 +59,11 @@ trait BaseIvySpecification extends Specification {
IvyActions.updateEither(module, config, UnresolvedWarningConfiguration(), LogicalClock.unknown, Some(currentDependency), log)
}
def cleanCachedResolutionCache(module: IvySbt#Module): Unit =
{
IvyActions.cleanCachedResolutionCache(module, log)
}
def ivyUpdate(module: IvySbt#Module) =
ivyUpdateEither(module) match {
case Right(r) => r

View File

@ -12,27 +12,38 @@ class CachedResolutionSpec extends BaseIvySpecification {
Resolving the unsolvable module should
not work $e2
Resolving a module with a pseudo-conflict should
work $e3
"""
def commonsIo13 = ModuleID("commons-io", "commons-io", "1.3", Some("compile"))
def mavenCayennePlugin302 = ModuleID("org.apache.cayenne.plugins", "maven-cayenne-plugin", "3.0.2", Some("compile"))
def avro177 = ModuleID("org.apache.avro", "avro", "1.7.7", Some("compile"))
def dataAvro1940 = ModuleID("com.linkedin.pegasus", "data-avro", "1.9.40", Some("compile"))
def netty320 = ModuleID("org.jboss.netty", "netty", "3.2.0.Final", Some("compile"))
def defaultOptions = EvictionWarningOptions.default
import ShowLines._
def e1 = {
val m = module(ModuleID("com.example", "foo", "0.1.0", Some("compile")), Seq(commonsIo13), Some("2.10.2"), UpdateOptions().withCachedResolution(true))
val m = module(ModuleID("com.example", "foo", "0.1.0", Some("compile")),
Seq(commonsIo13), Some("2.10.2"), UpdateOptions().withCachedResolution(true))
val report = ivyUpdate(m)
cleanCachedResolutionCache(m)
val report2 = ivyUpdate(m)
// first resolution creates the minigraph
println(report)
// second resolution reads from the minigraph
println(report.configurations.head.modules.head.artifacts)
report.configurations.size must_== 3
}
def e2 = {
log.setLevel(Level.Debug)
val m = module(ModuleID("com.example", "foo", "0.2.0", Some("compile")), Seq(mavenCayennePlugin302), Some("2.10.2"), UpdateOptions().withCachedResolution(true))
// log.setLevel(Level.Debug)
val m = module(ModuleID("com.example", "foo", "0.2.0", Some("compile")),
Seq(mavenCayennePlugin302), Some("2.10.2"), UpdateOptions().withCachedResolution(true))
ivyUpdateEither(m) match {
case Right(_) => sys.error("this should've failed")
case Left(uw) =>
@ -48,4 +59,22 @@ class CachedResolutionSpec extends BaseIvySpecification {
"\t\t +- com.example:foo:0.2.0"))
}
}
// https://github.com/sbt/sbt/issues/2046
// data-avro:1.9.40 depends on avro:1.4.0, which depends on netty:3.2.1.Final.
// avro:1.4.0 will be evicted by avro:1.7.7.
// #2046 says that netty:3.2.0.Final is incorrectly evicted by netty:3.2.1.Final
def e3 = {
log.setLevel(Level.Debug)
val m = module(ModuleID("com.example", "foo", "0.3.0", Some("compile")),
Seq(avro177, dataAvro1940, netty320),
Some("2.10.2"), UpdateOptions().withCachedResolution(true))
// first resolution creates the minigraph
val report0 = ivyUpdate(m)
cleanCachedResolutionCache(m)
// second resolution reads from the minigraph
val report = ivyUpdate(m)
val modules = report.configurations.head.modules
modules must containMatch("""org\.jboss\.netty:netty:3\.2\.0.Final""")
}
}