fall back on ivy report XML for sbt < 0.13.6

This commit is contained in:
Johannes Rudolph 2015-11-26 13:18:08 +01:00
parent 21e5b7ce5b
commit 2a54348003
2 changed files with 14 additions and 3 deletions

View File

@ -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",

View File

@ -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)
}