diff --git a/src/main/scala/net/virtualvoid/sbt/graph/DependencyGraphKeys.scala b/src/main/scala/net/virtualvoid/sbt/graph/DependencyGraphKeys.scala index 7356e97a9..e0159a4f0 100644 --- a/src/main/scala/net/virtualvoid/sbt/graph/DependencyGraphKeys.scala +++ b/src/main/scala/net/virtualvoid/sbt/graph/DependencyGraphKeys.scala @@ -41,6 +41,10 @@ trait DependencyGraphKeys { "Opens an HTML page that can be used to view the graph.") val moduleGraph = TaskKey[ModuleGraph]("module-graph", "The dependency graph for a project") + val moduleGraphIvyReport = TaskKey[ModuleGraph]("module-graph-ivy-report", + "The dependency graph for a project as generated from an Ivy Report XML") + val moduleGraphSbt = TaskKey[ModuleGraph]("module-graph-sbt", + "The dependency graph for a project as generated from SBT data structures.") val asciiGraph = TaskKey[String]("dependency-graph-string", "Returns a string containing the ascii representation of the dependency graph for a project") val dependencyGraph = InputKey[Unit]("dependency-graph", diff --git a/src/main/scala/net/virtualvoid/sbt/graph/DependencyGraphSettings.scala b/src/main/scala/net/virtualvoid/sbt/graph/DependencyGraphSettings.scala index a8bc387ad..55234b2da 100644 --- a/src/main/scala/net/virtualvoid/sbt/graph/DependencyGraphSettings.scala +++ b/src/main/scala/net/virtualvoid/sbt/graph/DependencyGraphSettings.scala @@ -42,7 +42,14 @@ object DependencyGraphSettings { def ivyReportForConfig(config: Configuration) = inConfig(config)(Seq( ivyReport <<= ivyReportFunction map (_(config.toString)) dependsOn (ignoreMissingUpdate), crossProjectId <<= (scalaVersion, scalaBinaryVersion, projectID)((sV, sBV, id) ⇒ CrossVersion(sV, sBV)(id)), - moduleGraph <<= sbtUpdateReportGraph, + moduleGraphSbt <<= moduleGraphSbtTask, + moduleGraphIvyReport <<= moduleGraphIvyReportTask, + moduleGraph <<= (sbtVersion, moduleGraphSbt, moduleGraphIvyReport) { (version, graphSbt, graphIvy) ⇒ + version match { + case Version(0, 13, x, _) if x >= 6 ⇒ graphSbt + case _ ⇒ graphIvy + } + }, moduleGraph <<= (scalaVersion, moduleGraph, filterScalaLibrary) map { (scalaV, graph, filter) ⇒ if (filter) GraphTransformations.ignoreScalaLibrary(scalaV, graph) else graph @@ -110,8 +117,8 @@ object DependencyGraphSettings { } } - def ivyReportGraph = ivyReport map (absoluteReportPath.andThen(IvyReport.fromReportFile)) - def sbtUpdateReportGraph = + def moduleGraphIvyReportTask = ivyReport map (absoluteReportPath.andThen(IvyReport.fromReportFile)) + def moduleGraphSbtTask = (ignoreMissingUpdate, crossProjectId, configuration) map { (update, root, config) ⇒ SbtUpdateReport.fromConfigurationReport(update.configuration(config.name).get, root) }