~ merge webacl
authorAlexandre Bertails <bertails@gmail.com>
Mon, 21 Nov 2011 12:00:02 -0500
branchwebacl
changeset 134 4f7578d03d3c
parent 133 e9586d101774 (current diff)
parent 131 8c38062c7809 (diff)
child 135 071c0931f322
~ merge
--- a/.hgignore	Mon Nov 21 11:58:10 2011 -0500
+++ b/.hgignore	Mon Nov 21 12:00:02 2011 -0500
@@ -20,3 +20,4 @@
 .settings
 .idea
 .idea_modules
+bin
\ No newline at end of file
--- a/project/build.scala	Mon Nov 21 11:58:10 2011 -0500
+++ b/project/build.scala	Mon Nov 21 12:00:02 2011 -0500
@@ -39,6 +39,8 @@
 // general build settings
 object BuildSettings {
 
+  val logger = ConsoleLogger()
+
   val buildOrganization = "org.w3"
   val buildVersion      = "0.1-SNAPSHOT"
   val buildScalaVersion = "2.9.1"
@@ -46,8 +48,26 @@
   val buildSettings = Defaults.defaultSettings ++ Seq (
     organization := buildOrganization,
     version      := buildVersion,
-    scalaVersion := buildScalaVersion,
-    scalaHome    := Some(file("/home/betehess/tools/scala")),
+    scalaVersion := buildScalaVersion, // ignored b/c of scalaHome
+    scalaHome    := Some {
+      val bin = file("bin")
+//      import scala.collection.JavaConverters._
+      def latest = (bin.listFiles.toList filter { _.getName startsWith "scala-2.10.0.r" } sortWith { _.getName > _.getName }).headOption
+      latest match {
+        case Some(scala) => {
+          logger.info("found nightly build of scala compiler: %s" format scala.getName)
+          scala
+        }
+        case None => {
+          logger.info("downloading the latest scala compiler (nightly builds)")
+          val u = url("http://www.scala-lang.org/archives/downloads/distrib/files/nightly/distributions/scala-2.10.0.latest.zip")
+          val zip = file("/tmp/scala-latest.zip")
+          u #> zip !;
+          Process("unzip -o %s -d %s" format (zip.getAbsolutePath, bin.getAbsolutePath)) !;
+          latest getOrElse sys.error("couldn't download and set the latest scala compiler") 
+        }
+      }
+    },
     parallelExecution in Test := false,
     scalacOptions ++= Seq("-deprecation", "-unchecked")
   )