new `dependency-graph-ml-file` setting to specify output location

This commit is contained in:
Johannes Rudolph 2012-05-23 12:33:54 +02:00
parent 05dce31593
commit d480c79ccc
1 changed files with 6 additions and 4 deletions

View File

@ -20,6 +20,8 @@ import sbt._
import Keys._ import Keys._
object Plugin extends sbt.Plugin { object Plugin extends sbt.Plugin {
val dependencyGraphMLFile = SettingKey[File]("dependency-graph-ml-file",
"The location the graphml file should be generated at")
val dependencyGraphML = TaskKey[File]("dependency-graph-ml", val dependencyGraphML = TaskKey[File]("dependency-graph-ml",
"Creates a graphml file containing the dependency-graph for a project") "Creates a graphml file containing the dependency-graph for a project")
val asciiGraph = TaskKey[String]("dependency-graph-string", val asciiGraph = TaskKey[String]("dependency-graph-string",
@ -42,7 +44,8 @@ object Plugin extends sbt.Plugin {
ivyReport <<= ivyReportFunction map (_(config.toString)) dependsOn(update), ivyReport <<= ivyReportFunction map (_(config.toString)) dependsOn(update),
asciiGraph <<= asciiGraphTask, asciiGraph <<= asciiGraphTask,
dependencyGraph <<= printAsciiGraphTask, dependencyGraph <<= printAsciiGraphTask,
dependencyGraphML <<= dependencyGraphMLTask(config) dependencyGraphMLFile <<= target / "dependencies-%s.graphml".format(config.toString),
dependencyGraphML <<= dependencyGraphMLTask
)) ))
def asciiGraphTask = (ivyReport) map { report => def asciiGraphTask = (ivyReport) map { report =>
@ -52,9 +55,8 @@ object Plugin extends sbt.Plugin {
def printAsciiGraphTask = def printAsciiGraphTask =
(streams, asciiGraph) map (_.log.info(_)) (streams, asciiGraph) map (_.log.info(_))
def dependencyGraphMLTask(config: Configuration) = def dependencyGraphMLTask =
(ivyReport, target, streams) map { (report, target, streams) => (ivyReport, dependencyGraphMLFile, streams) map { (report, resultFile, streams) =>
val resultFile = target / "dependencies-%s.graphml".format(config.toString)
IvyGraphMLDependencies.transform(report.getAbsolutePath, resultFile.getAbsolutePath) IvyGraphMLDependencies.transform(report.getAbsolutePath, resultFile.getAbsolutePath)
streams.log.info("Wrote dependency graph to '%s'" format resultFile) streams.log.info("Wrote dependency graph to '%s'" format resultFile)
resultFile resultFile