Created
November 3, 2010 19:47
-
-
Save rossabaker/661590 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait ScalatraTestDependencies extends BasicManagedProject { | |
def testProjectDependencies = List(scalatest, specs) | |
abstract override def dependencies = super.dependencies.toList ++ testProjectDependencies | |
override def deliverProjectDependencies: Iterable[ModuleID] = { | |
val testDependencyIds = testProjectDependencies.map(_.projectID).toList | |
super.deliverProjectDependencies.toList -- testDependencyIds ++ (testDependencyIds map { _ % "test" }) | |
} | |
override def fullClasspath(config: Configuration): PathFinder = Path.lazyPathFinder { | |
def classpath(projects: Iterable[Project], config: Configuration) = projects flatMap { | |
case sp: ClasspathProject => sp.projectClasspath(config).get | |
case _ => Nil | |
} | |
val nonTestTopologicalSort = Dag.topologicalSort[Project](this) { | |
case p: ScalatraTestDependencies => p.dependencies -- testProjectDependencies | |
case p: Project => p.dependencies | |
} | |
val set = new LinkedHashSet[Path] | |
set ++= classpath(nonTestTopologicalSort, config) | |
if (config == Configurations.Test) { | |
set ++= classpath(topologicalSort -- nonTestTopologicalSort, Configurations.Default) | |
} | |
set.toList | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment