207 case None => Path.basic(entry.name) |
207 case None => Path.basic(entry.name) |
208 } |
208 } |
209 |
209 |
210 val key = Session.Key(full_name, entry.order) |
210 val key = Session.Key(full_name, entry.order) |
211 |
211 |
|
212 val session_options = options ++ entry.options |
|
213 |
212 val theories = |
214 val theories = |
213 entry.theories.map({ case (opts, thys) => (options ++ opts, thys.map(Path.explode(_))) }) |
215 entry.theories.map({ case (opts, thys) => |
|
216 (session_options ++ opts, thys.map(Path.explode(_))) }) |
214 val files = entry.files.map(Path.explode(_)) |
217 val files = entry.files.map(Path.explode(_)) |
215 val digest = SHA1.digest((full_name, entry.parent, entry.options, entry.theories).toString) |
218 val digest = SHA1.digest((full_name, entry.parent, entry.options, entry.theories).toString) |
216 |
219 |
217 val info = |
220 val info = |
218 Session.Info(entry.name, dir + path, entry.parent, |
221 Session.Info(entry.name, dir + path, entry.parent, |
219 entry.description, options ++ entry.options, theories, files, digest) |
222 entry.description, session_options, theories, files, digest) |
220 |
223 |
221 queue1 + (key, info) |
224 queue1 + (key, info) |
222 } |
225 } |
223 catch { |
226 catch { |
224 case ERROR(msg) => |
227 case ERROR(msg) => |
342 } |
345 } |
343 |
346 |
344 private def start_job(name: String, info: Session.Info, output: Option[String], |
347 private def start_job(name: String, info: Session.Info, output: Option[String], |
345 options: Options, timing: Boolean, verbose: Boolean, browser_info: Path): Job = |
348 options: Options, timing: Boolean, verbose: Boolean, browser_info: Path): Job = |
346 { |
349 { |
|
350 // global browser info dir |
|
351 if (options.bool("browser_info") && !(browser_info + Path.explode("index.html")).file.isFile) |
|
352 { |
|
353 browser_info.file.mkdirs() |
|
354 File.copy(Path.explode("~~/lib/logo/isabelle.gif"), |
|
355 browser_info + Path.explode("isabelle.gif")) |
|
356 File.write(browser_info + Path.explode("index.html"), |
|
357 File.read(Path.explode("~~/lib/html/library_index_header.template")) + |
|
358 File.read(Path.explode("~~/lib/html/library_index_content.template")) + |
|
359 File.read(Path.explode("~~/lib/html/library_index_footer.template"))) |
|
360 } |
|
361 |
347 val parent = info.parent.getOrElse("") |
362 val parent = info.parent.getOrElse("") |
348 |
363 |
349 val cwd = info.dir.file |
364 val cwd = info.dir.file |
350 val env = Map("INPUT" -> parent, "TARGET" -> name, "OUTPUT" -> output.getOrElse("")) |
365 val env = Map("INPUT" -> parent, "TARGET" -> name, "OUTPUT" -> output.getOrElse("")) |
351 val script = |
366 val script = |
396 val deps = dependencies(queue) |
411 val deps = dependencies(queue) |
397 |
412 |
398 val (output_dir, browser_info) = |
413 val (output_dir, browser_info) = |
399 if (system_mode) (Path.explode("~~/heaps/$ML_IDENTIFIER"), Path.explode("~~/browser_info")) |
414 if (system_mode) (Path.explode("~~/heaps/$ML_IDENTIFIER"), Path.explode("~~/browser_info")) |
400 else (Path.explode("$ISABELLE_OUTPUT"), Path.explode("$ISABELLE_BROWSER_INFO")) |
415 else (Path.explode("$ISABELLE_OUTPUT"), Path.explode("$ISABELLE_BROWSER_INFO")) |
401 |
|
402 // prepare browser info dir |
|
403 if (options.bool("browser_info") && !(browser_info + Path.explode("index.html")).file.isFile) |
|
404 { |
|
405 browser_info.file.mkdirs() |
|
406 File.copy(Path.explode("~~/lib/logo/isabelle.gif"), |
|
407 browser_info + Path.explode("isabelle.gif")) |
|
408 File.write(browser_info + Path.explode("index.html"), |
|
409 File.read(Path.explode("~~/lib/html/library_index_header.template")) + |
|
410 File.read(Path.explode("~~/lib/html/library_index_content.template")) + |
|
411 File.read(Path.explode("~~/lib/html/library_index_footer.template"))) |
|
412 } |
|
413 |
416 |
414 // prepare log dir |
417 // prepare log dir |
415 val log_dir = output_dir + Path.explode("log") |
418 val log_dir = output_dir + Path.explode("log") |
416 log_dir.file.mkdirs() |
419 log_dir.file.mkdirs() |
417 |
420 |
456 val output = |
459 val output = |
457 if (build_images || queue.is_inner(name)) |
460 if (build_images || queue.is_inner(name)) |
458 Some(Isabelle_System.standard_path(output_dir + Path.basic(name))) |
461 Some(Isabelle_System.standard_path(output_dir + Path.basic(name))) |
459 else None |
462 else None |
460 echo((if (output.isDefined) "Building " else "Running ") + name + " ...") |
463 echo((if (output.isDefined) "Building " else "Running ") + name + " ...") |
461 val job = start_job(name, info, output, options, timing, verbose, browser_info) |
464 val job = start_job(name, info, output, info.options, timing, verbose, browser_info) |
462 loop(pending, running + (name -> job), results) |
465 loop(pending, running + (name -> job), results) |
463 } |
466 } |
464 else { |
467 else { |
465 echo(name + " CANCELLED") |
468 echo(name + " CANCELLED") |
466 loop(pending - name, running, results + (name -> 1)) |
469 loop(pending - name, running, results + (name -> 1)) |