Merge pull request #397 from lbergelson/lb_scala_2.10.2

Update scala from 2.9 to 2.10.2
This commit is contained in:
kshakir 2013-09-26 21:51:43 -07:00
commit a29f1f84bf
14 changed files with 24 additions and 114 deletions

View File

@ -526,6 +526,7 @@
<fileset dir="${lib.dir}"> <fileset dir="${lib.dir}">
<include name="scala-compiler-*.jar"/> <include name="scala-compiler-*.jar"/>
<include name="scala-library-*.jar"/> <include name="scala-library-*.jar"/>
<include name="scala-reflect-*.jar"/>
</fileset> </fileset>
</path> </path>
<taskdef resource="scala/tools/ant/antlib.xml"> <taskdef resource="scala/tools/ant/antlib.xml">
@ -537,7 +538,7 @@
<target name="scala.compile" depends="init,resolve,gatk.compile,queue-extensions.generate,init.scala.compile" if="include.scala"> <target name="scala.compile" depends="init,resolve,gatk.compile,queue-extensions.generate,init.scala.compile" if="include.scala">
<mkdir dir="${scala.classes}"/> <mkdir dir="${scala.classes}"/>
<echo>Building Scala...</echo> <echo>Building Scala...</echo>
<scalac fork="true" jvmargs="-Xmx512m" destdir="${scala.classes}" classpathref="scala.dependencies" deprecation="yes" unchecked="yes"> <scalac fork="true" jvmargs="-Xmx512m" destdir="${scala.classes}" classpathref="scala.dependencies" deprecation="yes" unchecked="yes" addparams="-feature">
<src refid="scala.source.path" /> <src refid="scala.source.path" />
<src path="${queue-extensions.source.dir}" /> <src path="${queue-extensions.source.dir}" />
<include name="**/*.scala" /> <include name="**/*.scala" />
@ -1218,7 +1219,7 @@
<target name="test.scala.compile" depends="test.java.compile,scala.compile" if="include.scala"> <target name="test.scala.compile" depends="test.java.compile,scala.compile" if="include.scala">
<echo message="Scala: Compiling test cases!"/> <echo message="Scala: Compiling test cases!"/>
<scalac fork="true" jvmargs="-Xmx512m" destdir="${scala.test.classes}" deprecation="yes" unchecked="yes"> <scalac fork="true" jvmargs="-Xmx512m" destdir="${scala.test.classes}" deprecation="yes" unchecked="yes" addparams="-feature">
<src refid="scala.test.source.path" /> <src refid="scala.test.source.path" />
<classpath> <classpath>
<path refid="build.results"/> <path refid="build.results"/>

View File

@ -82,8 +82,8 @@
<dependency org="net.sf.gridscheduler" name="drmaa" rev="latest.integration"/> <dependency org="net.sf.gridscheduler" name="drmaa" rev="latest.integration"/>
<!-- Scala dependancies --> <!-- Scala dependancies -->
<dependency org="org.scala-lang" name="scala-compiler" rev="2.9.2"/> <dependency org="org.scala-lang" name="scala-compiler" rev="2.10.2"/>
<dependency org="org.scala-lang" name="scala-library" rev="2.9.2"/> <dependency org="org.scala-lang" name="scala-library" rev="2.10.2"/>
<!-- testing and evaluation dependencies --> <!-- testing and evaluation dependencies -->
<dependency org="org.testng" name="testng" rev="6.8"/> <dependency org="org.testng" name="testng" rev="6.8"/>

View File

@ -33,10 +33,9 @@ import java.io.File
import scala.tools.nsc.reporters.AbstractReporter import scala.tools.nsc.reporters.AbstractReporter
import java.lang.String import java.lang.String
import org.apache.log4j.Level import org.apache.log4j.Level
import scala.tools.nsc.util.{FakePos, NoPosition, Position}
import org.broadinstitute.sting.queue.util.TextFormatUtils._ import org.broadinstitute.sting.queue.util.TextFormatUtils._
import org.broadinstitute.sting.utils.classloader.JVMUtils import org.broadinstitute.sting.utils.classloader.JVMUtils
import tools.util.StringOps import scala.reflect.internal.util.{FakePos, NoPosition, Position, StringOps}
/** /**
* Plugin manager for QScripts which loads QScripts into the current class loader. * Plugin manager for QScripts which loads QScripts into the current class loader.
@ -53,7 +52,10 @@ class QScriptManager() extends Logging {
settings.outdir.value = tempDir.getPath settings.outdir.value = tempDir.getPath
// Set the classpath to the current class path. // Set the classpath to the current class path.
JVMUtils.getClasspathURLs.foreach(url => settings.classpath.append(url.getPath)) JVMUtils.getClasspathURLs.foreach(url => {
settings.bootclasspath.append(url.getPath)
settings.classpath.append(url.getPath)
})
val reporter = new QScriptManager.Log4JReporter(settings) val reporter = new QScriptManager.Log4JReporter(settings)

View File

@ -160,7 +160,7 @@ class DrmaaJobRunner(val session: Session, val function: CommandLineFunction) ex
// resource of the designated queue to SIGTERM // resource of the designated queue to SIGTERM
session.control(jobId, Session.TERMINATE) session.control(jobId, Session.TERMINATE)
} catch { } catch {
case e => case e: Exception =>
logger.error("Unable to kill job " + jobId, e) logger.error("Unable to kill job " + jobId, e)
} }
} }

View File

@ -361,7 +361,7 @@ object Lsf706JobRunner extends Logging {
if (LibBat.lsb_signaljob(runner.jobId, SIGTERM) < 0) if (LibBat.lsb_signaljob(runner.jobId, SIGTERM) < 0)
logger.error(LibBat.lsb_sperror("Unable to kill job " + runner.jobId)) logger.error(LibBat.lsb_sperror("Unable to kill job " + runner.jobId))
} catch { } catch {
case e => case e: Exception=>
logger.error("Unable to kill job " + runner.jobId, e) logger.error("Unable to kill job " + runner.jobId, e)
} }
} }

View File

@ -83,8 +83,8 @@ class ShellJobRunner(val function: CommandLineFunction) extends CommandLineJobRu
try { try {
controller.tryDestroy() controller.tryDestroy()
} catch { } catch {
case e => case e: Exception =>
logger.error("Unable to kill shell job: " + function.description) logger.error("Unable to kill shell job: " + function.description, e)
} }
} }
} }

View File

@ -32,6 +32,7 @@ import org.broadinstitute.sting.queue.{QException, QSettings}
import java.lang.IllegalStateException import java.lang.IllegalStateException
import org.broadinstitute.sting.queue.util._ import org.broadinstitute.sting.queue.util._
import org.broadinstitute.sting.utils.io.IOUtils import org.broadinstitute.sting.utils.io.IOUtils
import scala.language.reflectiveCalls
/** /**
* The base interface for all functions in Queue. * The base interface for all functions in Queue.

View File

@ -39,7 +39,7 @@ class VCFExtractSamples(inVCF: File, outVCF: File, samples: List[String]) extend
@Argument(doc="The samples to extract from the VCF") var extractSamples : List[String] = samples @Argument(doc="The samples to extract from the VCF") var extractSamples : List[String] = samples
var out : PrintWriter = _ var out : PrintWriter = _
var columns : List[Int] = 0 to 8 toList var columns : List[Int] = (0 to 8).toList
def run = { def run = {
out = new PrintWriter(new PrintStream(outputVCF)) out = new PrintWriter(new PrintStream(outputVCF))

View File

@ -26,7 +26,7 @@
package org.broadinstitute.sting.queue.util package org.broadinstitute.sting.queue.util
import org.apache.commons.mail.{MultiPartEmail, EmailAttachment} import org.apache.commons.mail.{MultiPartEmail, EmailAttachment}
import java.io.{FileReader, File} import java.io.{IOException, FileReader, File}
import javax.mail.internet.InternetAddress import javax.mail.internet.InternetAddress
import scala.collection.JavaConversions._ import scala.collection.JavaConversions._
@ -105,7 +105,7 @@ class EmailMessage extends Logging {
try { try {
Retry.attempt(() => send(settings), .5) Retry.attempt(() => send(settings), .5)
} catch { } catch {
case e => logger.error("Error sending message: %n%s".format(this.toString), e) case e: RetryException=> logger.error("Error sending message: %n%s".format(this.toString), e)
} }
} }

View File

@ -25,6 +25,8 @@
package org.broadinstitute.sting.queue.util package org.broadinstitute.sting.queue.util
import scala.language.implicitConversions
/** /**
* An importable object that provides automatic primitive to option conversion. * An importable object that provides automatic primitive to option conversion.
*/ */

View File

@ -49,7 +49,7 @@ object Retry extends Logging {
result = f() result = f()
success = true success = true
} catch { } catch {
case e => { case e: Exception=> {
count += 1 count += 1
if (count < tries) { if (count < tries) {
val minutes = wait(count-1) val minutes = wait(count-1)

View File

@ -26,6 +26,7 @@
package org.broadinstitute.sting.queue.util package org.broadinstitute.sting.queue.util
import java.io.{Serializable, File} import java.io.{Serializable, File}
import scala.language.implicitConversions
/** /**
* Converts String to/from File * Converts String to/from File
@ -77,21 +78,6 @@ object StringFileConversions {
}) })
} }
implicit def stringsAsFiles(x: Set[Comparable[_ >: File with String <: Comparable[_ >: File with String <: Comparable[_ >: File with String <: Serializable] with Serializable] with Serializable] with Serializable]): Set[File] = {
x.map(_ match {
case string: String => stringAsFile(string)
case file: File => file
case null => null
})
}
implicit def filesAsStrings(x: Set[Comparable[_ >: String with File <: Comparable[_ >: String with File <: Comparable[_ >: String with File <: Serializable] with Serializable] with Serializable] with Serializable]): Set[String] = {
x.map(_ match {
case file: File => fileAsString(file)
case string: String => string
case null => null
})
}
} }
/** /**
@ -124,11 +110,4 @@ trait StringFileConversions {
StringFileConversions.filesAsStringsList(x) StringFileConversions.filesAsStringsList(x)
} }
implicit def stringsAsFiles(x: Set[Comparable[_ >: File with String <: Comparable[_ >: File with String <: Comparable[_ >: File with String <: Serializable] with Serializable] with Serializable] with Serializable]): Set[File] = {
StringFileConversions.stringsAsFiles(x)
}
implicit def filesAsStrings(x: Set[Comparable[_ >: String with File <: Comparable[_ >: String with File <: Comparable[_ >: String with File <: Serializable] with Serializable] with Serializable] with Serializable]): Set[String] = {
StringFileConversions.filesAsStrings(x)
}
} }

View File

@ -182,7 +182,7 @@ object PipelineTest extends BaseTest with Logging {
println("Executing test %s with Queue arguments: %s".format(name, Utils.join(" ",command))) println("Executing test %s with Queue arguments: %s".format(name, Utils.join(" ",command)))
CommandLineProgram.start(instance, command) CommandLineProgram.start(instance, command)
} catch { } catch {
case e => case e: Exception =>
gotAnException = true gotAnException = true
if (expectedException != null) { if (expectedException != null) {
// we expect an exception // we expect an exception
@ -224,7 +224,7 @@ object PipelineTest extends BaseTest with Logging {
try { try {
commandLine.shutdown() commandLine.shutdown()
} catch { } catch {
case _ => /* ignore */ case _: Throwable => /* ignore */
}) })
} }
}) })

View File

@ -87,44 +87,6 @@ class StringFileConversionsUnitTest {
Assert.assertEquals(strings, Seq(null, null)) Assert.assertEquals(strings, Seq(null, null))
} }
@Test
def testStringToFileSet() {
var files = Set(new File("foo"))
files += "bar"
Assert.assertEquals(files, Set(new File("foo"), new File("bar")))
files = Set(new File("foo"))
files += null.asInstanceOf[String]
Assert.assertEquals(files, Set(new File("foo"), null))
files = Set[File](null)
files += "foo"
Assert.assertEquals(files, Set(new File("foo"), null))
files = Set[File](null)
files += null.asInstanceOf[String]
Assert.assertEquals(files, Set(null))
}
@Test
def testFileToStringSet() {
var strings = Set("foo")
strings += new File("bar")
Assert.assertEquals(strings, Set("foo", "bar"))
strings = Set("foo")
strings += null.asInstanceOf[File]
Assert.assertEquals(strings, Set("foo", null))
strings = Set[String](null)
strings += new File("foo")
Assert.assertEquals(strings, Set("foo", null))
strings = Set[String](null)
strings += null.asInstanceOf[File]
Assert.assertEquals(strings, Set(null))
}
@Test @Test
def testStringListToFileList() { def testStringListToFileList() {
var files = Seq(new File("foo")) var files = Seq(new File("foo"))
@ -163,41 +125,4 @@ class StringFileConversionsUnitTest {
Assert.assertEquals(strings, Seq(null, null)) Assert.assertEquals(strings, Seq(null, null))
} }
@Test
def testStringSetToFileSet() {
var files = Set(new File("foo"))
files ++= Set("bar")
Assert.assertEquals(files, Set(new File("foo"), new File("bar")))
files = Set(new File("foo"))
files ++= Set[String](null)
Assert.assertEquals(files, Set(new File("foo"), null))
files = Set[File](null)
files ++= Set("foo")
Assert.assertEquals(files, Set(new File("foo"), null))
files = Set[File](null)
files ++= Set[String](null)
Assert.assertEquals(files, Set(null))
}
@Test
def testFileSetToStringSet() {
var strings = Set("foo")
strings ++= Set(new File("bar"))
Assert.assertEquals(strings, Set("foo", "bar"))
strings = Set("foo")
strings ++= Set[File](null)
Assert.assertEquals(strings, Set("foo", null))
strings = Set[String](null)
strings ++= Set(new File("foo"))
Assert.assertEquals(strings, Set("foo", null))
strings = Set[String](null)
strings ++= Set[File](null)
Assert.assertEquals(strings, Set(null))
}
} }