Skip to content

Commit

Permalink
Reproduce #2046
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Jul 9, 2015
1 parent a9f0a16 commit 5256e64
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ivy/src/test/scala/BaseIvySpecification.scala
Expand Up @@ -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
Expand Down
35 changes: 32 additions & 3 deletions ivy/src/test/scala/CachedResolutionSpec.scala
Expand Up @@ -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) =>
Expand All @@ -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""")
}
}

0 comments on commit 5256e64

Please sign in to comment.