mirror of https://github.com/sbt/sbt.git
refactoring: function returning ivy report file for a config is now a separate SettingsKey
This commit is contained in:
parent
2520dc25de
commit
09aa146fc5
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue