src/Pure/System/build.scala
author wenzelm
Wed, 18 Jul 2012 17:27:28 +0200
changeset 48339 62570361e608
parent 48337 9c7f8e5805b4
child 48340 6f4fc030882a
permissions -rw-r--r--
more errors;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48276
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
     1
/*  Title:      Pure/System/build.scala
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
     3
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
     4
Build and manage Isabelle sessions.
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
     5
*/
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
     6
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
     7
package isabelle
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
     8
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
     9
48335
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    10
import java.io.File
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    11
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    12
import scala.collection.mutable
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    13
48335
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    14
48276
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    15
object Build
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    16
{
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    17
  /* command line entry point */
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    18
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    19
  private object Bool
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    20
  {
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    21
    def unapply(s: String): Option[Boolean] =
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    22
      s match {
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    23
        case "true" => Some(true)
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    24
        case "false" => Some(false)
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    25
        case _ => None
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    26
      }
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    27
  }
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    28
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    29
  def main(args: Array[String])
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    30
  {
48335
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    31
    def bad_args(): Nothing = error("Bad arguments: " + args.toString)
48276
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    32
48335
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    33
    val rc =
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    34
      try {
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    35
        args.toList match {
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    36
          case Bool(all_sessions) :: Bool(build_images) :: Bool(list_only) :: rest =>
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    37
            rest.indexWhere(_ == "\n") match {
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    38
              case -1 => bad_args()
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    39
              case i =>
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    40
                val (options, rest1) = rest.splitAt(i)
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    41
                val sessions = rest1.tail
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    42
                build(all_sessions, build_images, list_only, options, sessions)
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    43
            }
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    44
          case _ => bad_args()
48276
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    45
        }
48335
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    46
      }
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    47
      catch {
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    48
        case exn: Throwable => java.lang.System.err.println(Exn.message(exn)); 2
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    49
      }
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    50
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    51
    sys.exit(rc)
48276
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    52
  }
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    53
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    54
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    55
  /* build */
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    56
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    57
  def build(all_sessions: Boolean, build_images: Boolean, list_only: Boolean,
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    58
    options: List[String], sessions: List[String]): Int =
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    59
  {
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    60
    println("options = " + options.toString)
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    61
    println("sessions = " + sessions.toString)
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    62
48335
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    63
    find_sessions() foreach println
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    64
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
    65
    0
48276
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
    66
  }
48280
7d86239986c2 basic support for session ROOT files, with examples for FOL and ZF;
wenzelm
parents: 48276
diff changeset
    67
7d86239986c2 basic support for session ROOT files, with examples for FOL and ZF;
wenzelm
parents: 48276
diff changeset
    68
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    69
  /** session information **/
48334
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
    70
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
    71
  type Options = List[(String, Option[String])]
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
    72
48280
7d86239986c2 basic support for session ROOT files, with examples for FOL and ZF;
wenzelm
parents: 48276
diff changeset
    73
  case class Session_Info(
48334
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
    74
    dir: Path,
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
    75
    name: String,
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
    76
    parent: String,
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
    77
    description: String,
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
    78
    options: Options,
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
    79
    theories: List[(Options, String)],
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
    80
    files: List[String])
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
    81
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    82
  private val pure_info =
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    83
    Session_Info(Path.current, "Pure", "", "", Nil, List((Nil, "Pure")), Nil)
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    84
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    85
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    86
  /* parsing */
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    87
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    88
  val ROOT_NAME = "ROOT"
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    89
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    90
  private case class Session_Entry(
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    91
    name: String,
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    92
    reset: Boolean,
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    93
    path: Option[String],
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    94
    parent: String,
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    95
    description: String,
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    96
    options: Options,
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    97
    theories: List[(Options, List[String])],
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    98
    files: List[String])
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
    99
48334
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   100
  private object Parser extends Parse.Parser
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   101
  {
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   102
    val SESSION = "session"
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   103
    val IN = "in"
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   104
    val DESCRIPTION = "description"
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   105
    val OPTIONS = "options"
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   106
    val THEORIES = "theories"
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   107
    val FILES = "files"
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   108
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   109
    val syntax =
48336
3c55bfad22eb more tight treatment of reset_name;
wenzelm
parents: 48335
diff changeset
   110
      Outer_Syntax.empty + "!" + "(" + ")" + "+" + "," + "=" + "[" + "]" +
3c55bfad22eb more tight treatment of reset_name;
wenzelm
parents: 48335
diff changeset
   111
        SESSION + IN + DESCRIPTION + OPTIONS + THEORIES + FILES
48334
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   112
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   113
    val session_entry: Parser[Session_Entry] =
48334
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   114
    {
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   115
      val session_name = atom("session name", _.is_name)
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   116
      val theory_name = atom("theory name", _.is_name)
48280
7d86239986c2 basic support for session ROOT files, with examples for FOL and ZF;
wenzelm
parents: 48276
diff changeset
   117
48334
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   118
      val option =
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   119
        name ~ opt(keyword("=") ~! name ^^ { case _ ~ x => x }) ^^ { case x ~ y => (x, y) }
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   120
      val options = keyword("[") ~> repsep(option, keyword(",")) <~ keyword("]")
48334
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   121
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   122
      val theories =
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   123
        keyword(THEORIES) ~! ((options | success(Nil)) ~ rep1(theory_name)) ^^
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   124
          { case _ ~ (x ~ y) => (x, y) }
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   125
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   126
      ((keyword(SESSION) ~! session_name) ^^ { case _ ~ x => x }) ~
48336
3c55bfad22eb more tight treatment of reset_name;
wenzelm
parents: 48335
diff changeset
   127
        (keyword("!") ^^^ true | success(false)) ~
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   128
        (opt(keyword(IN) ~! string ^^ { case _ ~ x => x })) ~
48334
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   129
        (keyword("=") ~> session_name <~ keyword("+")) ~
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   130
        (keyword(DESCRIPTION) ~! text ^^ { case _ ~ x => x } | success("")) ~
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   131
        (keyword(OPTIONS) ~! options ^^ { case _ ~ x => x } | success(Nil)) ~
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   132
        rep1(theories) ~
48336
3c55bfad22eb more tight treatment of reset_name;
wenzelm
parents: 48335
diff changeset
   133
        (keyword(FILES) ~! rep1(path) ^^ { case _ ~ x => x } | success(Nil)) ^^
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   134
          { case a ~ b ~ c ~ d ~ e ~ f ~ g ~ h => Session_Entry(a, b, c, d, e, f, g, h) }
48334
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   135
    }
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   136
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   137
    def parse_entries(root: File): List[Session_Entry] =
48334
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   138
    {
48335
2f923e994056 more informative errors;
wenzelm
parents: 48334
diff changeset
   139
      val toks = syntax.scan(Standard_System.read_file(root))
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   140
      parse_all(rep(session_entry), Token.reader(toks, root.toString)) match {
48334
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   141
        case Success(result, _) => result
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   142
        case bad => error(bad.toString)
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   143
      }
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   144
    }
8dff9933e72a added parser for Session_Info;
wenzelm
parents: 48280
diff changeset
   145
  }
48280
7d86239986c2 basic support for session ROOT files, with examples for FOL and ZF;
wenzelm
parents: 48276
diff changeset
   146
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   147
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   148
  /* find session */
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   149
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   150
  def find_sessions(more_dirs: List[Path] = Nil): List[Session_Info] =
48280
7d86239986c2 basic support for session ROOT files, with examples for FOL and ZF;
wenzelm
parents: 48276
diff changeset
   151
  {
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   152
    val infos = new mutable.ListBuffer[Session_Info]
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   153
    infos += pure_info
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   154
48280
7d86239986c2 basic support for session ROOT files, with examples for FOL and ZF;
wenzelm
parents: 48276
diff changeset
   155
    for {
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   156
      dir <- Isabelle_System.components() ++ more_dirs
48280
7d86239986c2 basic support for session ROOT files, with examples for FOL and ZF;
wenzelm
parents: 48276
diff changeset
   157
      root = Isabelle_System.platform_file(dir + Path.basic(ROOT_NAME))
7d86239986c2 basic support for session ROOT files, with examples for FOL and ZF;
wenzelm
parents: 48276
diff changeset
   158
      if root.isFile
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   159
      entry <- Parser.parse_entries(root)
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   160
    }
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   161
    {
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   162
      try {
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   163
        val parent =
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   164
          infos.find(_.name == entry.parent) getOrElse
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   165
           error("Unknown parent session: " + quote(entry.parent))
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   166
        val full_name =
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   167
          if (entry.reset) entry.name
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   168
          else parent.name + "-" + entry.name
48339
62570361e608 more errors;
wenzelm
parents: 48337
diff changeset
   169
62570361e608 more errors;
wenzelm
parents: 48337
diff changeset
   170
        if (entry.name == "") error("Bad session name")
62570361e608 more errors;
wenzelm
parents: 48337
diff changeset
   171
        if (infos.exists(_.name == full_name))
62570361e608 more errors;
wenzelm
parents: 48337
diff changeset
   172
          error("Duplicate session name: " + quote(full_name))
62570361e608 more errors;
wenzelm
parents: 48337
diff changeset
   173
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   174
        val path =
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   175
          entry.path match {
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   176
            case Some(p) => Path.explode(p)
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   177
            case None => Path.basic(entry.name)
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   178
          }
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   179
        val thys = entry.theories.map({ case (x, ys) => ys.map(y => (x, y)) }).flatten
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   180
        val info =
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   181
          Session_Info(dir + path, full_name, entry.parent, entry.description,
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   182
            entry.options, thys, entry.files)
48339
62570361e608 more errors;
wenzelm
parents: 48337
diff changeset
   183
48337
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   184
        infos += info
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   185
      }
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   186
      catch {
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   187
        case ERROR(msg) =>
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   188
          error(msg + "\nThe error(s) above occurred in session entry " +
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   189
            quote(entry.name) + " (file " + quote(root.toString) + ")")
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   190
      }
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   191
    }
9c7f8e5805b4 cumulate semantic Session_Info, based on syntactic Session_Entry;
wenzelm
parents: 48336
diff changeset
   192
    infos.toList
48280
7d86239986c2 basic support for session ROOT files, with examples for FOL and ZF;
wenzelm
parents: 48276
diff changeset
   193
  }
48276
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
   194
}
4bd480886813 basic setup for Isabelle build tool;
wenzelm
parents:
diff changeset
   195