Recently I started to lock up completely on certain code-fragments, forcing me to kill the process and restart Eclipse. Unfortunately it was "reproducible", so I actually had to (cosmetically) change some code I was trying to write in order to avoid to lockup. (Miles Sabin et al are doing a great work, it just needs some time, I really admire what they're doing)
That's why I started looking to alternative ways to code Scala. First I tried IntelliJ withthe Scala-Plugin: Tried it, but didn't fall in love with it... I probably should've given it more time, but I was afraid, that it was going to have to same behavior as Eclipse (fine for small, bad for larger projects).
During surfing on the net I also found several posters, that really liked the sbt along with some text editor (some guys even pair it with an IDE), so I gave it a try. It does a great job at setting up your project and managing its dependencies (similar to maven, but easier).
Here's the scala/build/ScalaBase.scala (my project is named ScalaBase and uses the new cps-plugin of Scala 2.8):
import sbt._
class ScalaBaseProject(info: ProjectInfo) extends DefaultProject(info) with AutoCompilerPlugins {
val continuations = compilerPlugin("org.scala-lang.plugins" % "continuations" % "2.8.0-SNAPSHOT")
override def compileOptions = CompileOption("-P:continuations:enable") :: super.compileOptions.toList
val slf4j = "org.slf4j" % "slf4j-api" % "1.5.11"
val logbackcore = "ch.qos.logback" % "logback-core" % "0.9.20"
val logbackclassic = "ch.qos.logback" % "logback-classic" % "0.9.20"
val scalatest = "org.scalatest" % "scalatest" % "1.0.1-for-scala-2.8.0.RC1-SNAPSHOT" % "test"
val toolsSnapshot = ScalaToolsSnapshots
}
But what's really great: Start it up with
[~/scala/myproject] sbtthen type
~test-quickand then edit your source files. As soon as you save a file it compiles all the affected classes and tests and then executes only the tests that were recompiled! This is great and gives you immediate feedback without stopping you from coding on. And it's really quick too (seems to take half the time of Eclipse-plugin to compile my code).
For more infos see the sbt documentation.
No comments:
Post a Comment