diff --git a/src/main/scala/net/virtualvoid/sbt/graph/Plugin.scala b/src/main/scala/net/virtualvoid/sbt/graph/Plugin.scala index c8b56a425..b9d98b940 100644 --- a/src/main/scala/net/virtualvoid/sbt/graph/Plugin.scala +++ b/src/main/scala/net/virtualvoid/sbt/graph/Plugin.scala @@ -4,16 +4,19 @@ import sbt._ import Keys._ object Plugin extends sbt.Plugin { - val dependencyGraphTask = TaskKey[File]("dependency-graph") + val dependencyGraphTask = TaskKey[File]("dependency-graph", + "Creates a graphml file containing the dependency-graph for a project") + val ivyReport = SettingKey[String => File]("ivy-report", + "A function which returns the file containing the ivy report from the ivy cache for a given configuration") def graphSettings = Seq( - dependencyGraphTask <<= (projectID, scalaVersion, appConfiguration, target, streams) map { (projectID, scalaVersion, config, target, streams) => + ivyReport <<= (projectID, scalaVersion, appConfiguration) { (projectID, scalaVersion, config) => val home = config.provider.scalaProvider.launcher.ivyHome - - val fileName = "%s/cache/%s-%s-compile.xml" format (home, projectID.organization, crossName(projectID, scalaVersion)) - + (c: String) => file("%s/cache/%s-%s-%s.xml" format (home, projectID.organization, crossName(projectID, scalaVersion), c)) + }, + dependencyGraphTask <<= (ivyReport, target, streams) map { (report, target, streams) => val resultFile = target / "dependencies.graphml" - IvyGraphMLDependencies.transform(fileName, resultFile.getAbsolutePath) + IvyGraphMLDependencies.transform(report("compile").getAbsolutePath, resultFile.getAbsolutePath) streams.log.info("Wrote dependency graph to '%s'" format resultFile) resultFile } dependsOn(deliverLocal)