take scala version classifier into account when crossPath is true (fixes #1)

This commit is contained in:
Johannes Rudolph 2011-11-18 11:10:57 +01:00
parent 7286764bf9
commit 2520dc25de
1 changed files with 13 additions and 4 deletions

View File

@ -4,12 +4,13 @@ import sbt._
import Keys._
object Plugin extends sbt.Plugin {
val dependencyGraphTask = TaskKey[File]("dependency-graph")
val dependencyGraphTask = TaskKey[File]("dependency-graph")
def graphSettings = Seq(
dependencyGraphTask <<= (projectID, appConfiguration, target, streams) map { (projectID, config, target, streams) =>
def graphSettings = Seq(
dependencyGraphTask <<= (projectID, scalaVersion, appConfiguration, target, streams) map { (projectID, scalaVersion, config, target, streams) =>
val home = config.provider.scalaProvider.launcher.ivyHome
val fileName = "%s/cache/%s-%s-compile.xml" format (home, projectID.organization, projectID.name)
val fileName = "%s/cache/%s-%s-compile.xml" format (home, projectID.organization, crossName(projectID, scalaVersion))
val resultFile = target / "dependencies.graphml"
IvyGraphMLDependencies.transform(fileName, resultFile.getAbsolutePath)
@ -17,4 +18,12 @@ object Plugin extends sbt.Plugin {
resultFile
} dependsOn(deliverLocal)
)
def crossName(moduleId: ModuleID, scalaVersion: String) =
moduleId.name + (
if (moduleId.crossVersion)
"_"+scalaVersion
else
""
)
}