project/Build.scala
changeset 21 641c7190c566
equal deleted inserted replaced
20:f1551f9d3d3e 21:641c7190c566
       
     1 /*
       
     2  * See https://github.com/retronym/scratch/blob/master/20110929/project/build.scala
       
     3  * for details.
       
     4  */
       
     5 
       
     6 import sbt._
       
     7 import Keys._
       
     8 
       
     9 object CmgmtBuild extends Build {
       
    10 
       
    11   // Setting shared by all projects
       
    12   lazy val standardSettings = Defaults.defaultSettings ++ Seq(
       
    13   // The console analog to Defaults.mainRunTask and Defaults.mainRunMainTask
       
    14   // Its omission from the standard settings seems to be an oversight.
       
    15   console <<= consoleTask(fullClasspath in Runtime, console))
       
    16 
       
    17   lazy val root = Project(
       
    18     id = "root",
       
    19     base = file("."),
       
    20     settings = standardSettings
       
    21   )
       
    22 
       
    23   import Build.data
       
    24   import Project.Initialize
       
    25 
       
    26   // Copy/Paste from Defaults.consoleTask, allowing classpath : ScopedTask rather than : Task.
       
    27   def consoleTask(classpath: ScopedTask[Classpath], task: TaskKey[_]): Initialize[Task[Unit]] = {
       
    28     (compilers in task, classpath, scalacOptions in task, initialCommands in task, streams) map {
       
    29       (cs, cp, options, initCommands, s) =>
       
    30       (new Console(cs.scalac))(data(cp), options, initCommands, "", s.log).foreach(msg => sys.error(msg))
       
    31       println()
       
    32     }
       
    33   }
       
    34 
       
    35 }
       
    36 
       
    37 // vim: set ts=2 sw=2 et: