src/Pure/System/build.scala
changeset 48276 4bd480886813
child 48280 7d86239986c2
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/Pure/System/build.scala	Tue Jul 17 15:56:19 2012 +0200
     1.3 @@ -0,0 +1,60 @@
     1.4 +/*  Title:      Pure/System/build.scala
     1.5 +    Author:     Makarius
     1.6 +
     1.7 +Build and manage Isabelle sessions.
     1.8 +*/
     1.9 +
    1.10 +package isabelle
    1.11 +
    1.12 +
    1.13 +object Build
    1.14 +{
    1.15 +  /* command line entry point */
    1.16 +
    1.17 +  private object Bool
    1.18 +  {
    1.19 +    def unapply(s: String): Option[Boolean] =
    1.20 +      s match {
    1.21 +        case "true" => Some(true)
    1.22 +        case "false" => Some(false)
    1.23 +        case _ => None
    1.24 +      }
    1.25 +  }
    1.26 +
    1.27 +  def main(args: Array[String])
    1.28 +  {
    1.29 +    def bad_args()
    1.30 +    {
    1.31 +      java.lang.System.err.println("Bad arguments: " + args.toString)
    1.32 +      sys.exit(2)
    1.33 +    }
    1.34 +
    1.35 +    args.toList match {
    1.36 +      case Bool(all_sessions) :: Bool(build_images) :: Bool(list_only) :: rest =>
    1.37 +        rest.indexWhere(_ == "\n") match {
    1.38 +          case -1 => bad_args()
    1.39 +          case i =>
    1.40 +            val (options, rest1) = rest.splitAt(i)
    1.41 +            val sessions = rest1.tail
    1.42 +            val rc = build(all_sessions, build_images, list_only, options, sessions)
    1.43 +            sys.exit(rc)
    1.44 +        }
    1.45 +      case _ => bad_args()
    1.46 +    }
    1.47 +  }
    1.48 +
    1.49 +
    1.50 +  /* build */
    1.51 +
    1.52 +  def build(all_sessions: Boolean, build_images: Boolean, list_only: Boolean,
    1.53 +    options: List[String], sessions: List[String]): Int =
    1.54 +  {
    1.55 +    val rc = 1
    1.56 +
    1.57 +    println("options = " + options.toString)
    1.58 +    println("sessions = " + sessions.toString)
    1.59 +
    1.60 +    rc
    1.61 +  }
    1.62 +}
    1.63 +