fix #27: don't require caller[@rev] to be equal to outside revision

Since the `caller` is already nested in a particular called module this
should be sufficient.
This commit is contained in:
Johannes Rudolph 2013-03-02 12:32:57 +01:00
parent 23b6dc8644
commit 093b4782ad
7 changed files with 36 additions and 4 deletions

5
notes/0.7.2.markdown Normal file
View File

@ -0,0 +1,5 @@
This is a maintenance release. Following issues have been fixed:
* [#27](https://github.com/jrudolph/sbt-dependency-graph/issues/27): A dependency configured with
a version range was not properly associated with its dependant.

View File

@ -70,9 +70,9 @@ object IvyGraphMLDependencies extends App {
buildGraph(buildDoc(ivyReportFile))
def buildGraph(doc: Document): ModuleGraph = {
def edgesForModule(id: ModuleId, revision: NodeSeq, rev: String): Seq[Edge] =
def edgesForModule(id: ModuleId, revision: NodeSeq): Seq[Edge] =
for {
caller <- revision \ "caller" if caller.attribute("rev").get.text == rev
caller <- revision \ "caller"
callerModule = moduleIdFromElement(caller, caller.attribute("callerrev").get.text)
} yield (moduleIdFromElement(caller, caller.attribute("callerrev").get.text), id)
@ -85,7 +85,7 @@ object IvyGraphMLDependencies extends App {
(revision \ "license").headOption.flatMap(_.attribute("name")).map(_.text),
evictedByVersion = (revision \ "evicted-by").headOption.flatMap(_.attribute("rev").map(_.text)),
error = revision.attribute("error").map(_.text))
} yield (module, edgesForModule(moduleId, revision, rev))
} yield (module, edgesForModule(moduleId, revision))
val (nodes, edges) = moduleEdges.unzip

View File

@ -16,6 +16,7 @@ TaskKey[Unit]("check") <<= (ivyReport in Test, asciiTree in Test) map { (report,
| +-ch.qos.logback:logback-classic:1.0.7
| | +-ch.qos.logback:logback-core:1.0.7
| | +-org.slf4j:slf4j-api:1.6.6 (evicted by: 1.7.2)
| | +-org.slf4j:slf4j-api:1.7.2
| |
| +-org.slf4j:slf4j-api:1.7.2
| """.stripMargin

View File

@ -0,0 +1,24 @@
import net.virtualvoid.sbt.graph.Plugin._
graphSettings
scalaVersion := "2.9.2"
libraryDependencies ++= Seq(
"com.codahale" % "jerkson_2.9.1" % "0.5.0"
)
TaskKey[Unit]("check") <<= (ivyReport in Test, asciiTree in Test) map { (report, graph) =>
def sanitize(str: String): String = str.split('\n').drop(1).map(_.trim).mkString("\n")
val expectedGraph =
"""default:default-dbc48d_2.9.2:0.1-SNAPSHOT [S]
| +-com.codahale:jerkson_2.9.1:0.5.0 [S]
| +-org.codehaus.jackson:jackson-core-asl:1.9.12
| +-org.codehaus.jackson:jackson-mapper-asl:1.9.12
| +-org.codehaus.jackson:jackson-core-asl:1.9.12
| """.stripMargin
IO.writeLines(file("/tmp/blib"), sanitize(graph).split("\n"))
IO.writeLines(file("/tmp/blub"), sanitize(expectedGraph).split("\n"))
require(sanitize(graph) == sanitize(expectedGraph), "Graph for report %s was '\n%s' but should have been '\n%s'" format (report, sanitize(graph), sanitize(expectedGraph)))
()
}

View File

@ -0,0 +1 @@
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.2-SNAPSHOT")

View File

@ -0,0 +1 @@
> check

View File

@ -1 +1 @@
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.1-SNAPSHOT")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.2-SNAPSHOT")