Backwards compatibility check for getScala method.

Added groupId dependant baseDirectoryName.
General code cleanup.
This commit is contained in:
Vojin Jovanovic
2012-04-11 04:04:21 +02:00
parent f17cb88d00
commit cbb8caef0c
4 changed files with 41 additions and 43 deletions
+9 -1
View File
@@ -23,8 +23,16 @@ object ScalaInstance
{
val VersionPrefix = "version "
def apply(org: String, version: String, launcher: xsbti.Launcher): ScalaInstance =
def apply(org: String, version: String, launcher: xsbti.Launcher): ScalaInstance = {
// launcher compatibility check
val strClass = "".getClass
if (launcher.getClass.getMethods.exists(m =>
m.getName == "getScala" &&
m.getParameterTypes.toSeq == Seq(strClass, strClass, strClass)))
apply(version, launcher.getScala(version, "", org))
else
error("Incompatible version of the xsbti.Launcher interface. Use sbt-0.12.x launcher instead.")
}
/** Creates a ScalaInstance using the given provider to obtain the jars and loader.*/
def apply(version: String, launcher: xsbti.Launcher): ScalaInstance =
apply(version, launcher.getScala(version))