From 510a708a08a1185e7353ffb5204c49129c0ba2ce Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Mon, 1 Feb 2010 07:38:10 -0500 Subject: [PATCH] Fix for compatibility test framework --- src/main/scala/sbt/BasicProjectTypes.scala | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/scala/sbt/BasicProjectTypes.scala b/src/main/scala/sbt/BasicProjectTypes.scala index 9477643dd..578190eab 100644 --- a/src/main/scala/sbt/BasicProjectTypes.scala +++ b/src/main/scala/sbt/BasicProjectTypes.scala @@ -221,15 +221,21 @@ trait BasicManagedProject extends ManagedProject with ReflectiveManagedProject w deps ++ compatExtra(deps) } /** Determines extra libraries needed for compatibility. Currently, this is the compatibility test framework. */ - private def compatExtra(deps: Set[ModuleID]) = if(deps.exists(requiresCompat)) compatTestFramework else Nil + private def compatExtra(deps: Set[ModuleID]) = + if(isScala27 && deps.exists(requiresCompat)) { log.debug("Using compatibility implementation of test interface."); compatTestFramework } else Nil + private def isScala27 = buildScalaVersion.startsWith("2.7.") /** True if the given dependency requires the compatibility test framework. */ private def requiresCompat(m: ModuleID) = - (m.name == "scalacheck" && Set("1.5", "1.6").contains(m.revision)) || - (m.name == "specs" && Set("1.6.0", "1.6.1").contains(m.revision)) || - (m.name == "scalatest" && m.revision == "1.0") + { + def nameMatches(name: String, id: String) = name == id || name.startsWith(id + "_2.7.") + + (nameMatches(m.name, "scalacheck") && Set("1.5", "1.6").contains(m.revision)) || + (nameMatches(m.name, "specs") && Set("1.6.0", "1.6.1").contains(m.revision)) || + (nameMatches(m.name, "scalatest") && m.revision == "1.0") + } /** Extra dependencies to add if a dependency on an older test framework (one released before the uniform test interface) is declared. * This is the compatibility test framework by default.*/ - def compatTestFramework = Set("org.scala-tools.sbt" %% "test-compat" % "0.4.0" % "test") + def compatTestFramework = Set("org.scala-tools.sbt" %% "test-compat" % "0.4.1" % "test") def defaultModuleSettings: ModuleSettings = {