project/Build.scala
changeset 21 641c7190c566
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project/Build.scala	Mon Apr 02 00:06:52 2012 +0200
@@ -0,0 +1,37 @@
+/*
+ * See https://github.com/retronym/scratch/blob/master/20110929/project/build.scala
+ * for details.
+ */
+
+import sbt._
+import Keys._
+
+object CmgmtBuild extends Build {
+
+  // Setting shared by all projects
+  lazy val standardSettings = Defaults.defaultSettings ++ Seq(
+  // The console analog to Defaults.mainRunTask and Defaults.mainRunMainTask
+  // Its omission from the standard settings seems to be an oversight.
+  console <<= consoleTask(fullClasspath in Runtime, console))
+
+  lazy val root = Project(
+    id = "root",
+    base = file("."),
+    settings = standardSettings
+  )
+
+  import Build.data
+  import Project.Initialize
+
+  // Copy/Paste from Defaults.consoleTask, allowing classpath : ScopedTask rather than : Task.
+  def consoleTask(classpath: ScopedTask[Classpath], task: TaskKey[_]): Initialize[Task[Unit]] = {
+    (compilers in task, classpath, scalacOptions in task, initialCommands in task, streams) map {
+      (cs, cp, options, initCommands, s) =>
+      (new Console(cs.scalac))(data(cp), options, initCommands, "", s.log).foreach(msg => sys.error(msg))
+      println()
+    }
+  }
+
+}
+
+// vim: set ts=2 sw=2 et: