author | wenzelm |
Sat, 15 Aug 2015 17:38:20 +0200 | |
changeset 60932 | 13ee73f57c85 |
parent 60518 | a79f89a36dff |
child 61276 | 8a4bd05c1735 |
permissions | -rw-r--r-- |
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
1 |
/* Title: Pure/Tools/build_console.scala |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
2 |
Author: Makarius |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
3 |
|
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
4 |
Check and build Isabelle session for console tool. |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
5 |
*/ |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
6 |
|
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
7 |
package isabelle |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
8 |
|
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
9 |
|
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
10 |
object Build_Console |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
11 |
{ |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
12 |
/* build_console */ |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
13 |
|
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
14 |
def build_console( |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
15 |
options: Options, |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
16 |
progress: Build.Progress = Build.Ignore_Progress, |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
17 |
dirs: List[Path] = Nil, |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
18 |
no_build: Boolean = false, |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
19 |
system_mode: Boolean = false, |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
20 |
session: String): Int = |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
21 |
{ |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
22 |
if (no_build || |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
23 |
Build.build(options = options, build_heap = true, no_build = true, |
60518
a79f89a36dff
uniform system_mode for build test: avoid spurious output_dir/log that is not required later;
wenzelm
parents:
57581
diff
changeset
|
24 |
dirs = dirs, system_mode = system_mode, sessions = List(session)) == 0) 0 |
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
25 |
else { |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
26 |
progress.echo("Build started for Isabelle/" + session + " ...") |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
27 |
Build.build(options = options, progress = progress, build_heap = true, |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
28 |
dirs = dirs, system_mode = system_mode, sessions = List(session)) |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
29 |
} |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
30 |
} |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
31 |
|
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
32 |
|
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
33 |
/* command line entry point */ |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
34 |
|
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
35 |
def main(args: Array[String]) |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
36 |
{ |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
37 |
Command_Line.tool { |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
38 |
args.toList match { |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
39 |
case |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
40 |
session :: |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
41 |
Properties.Value.Boolean(no_build) :: |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
42 |
Properties.Value.Boolean(system_mode) :: |
57581
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
43 |
options_file :: |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
44 |
Command_Line.Chunks(dirs, system_options) => |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
45 |
val options = (Options.init() /: system_options)(_ + _) |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
46 |
File.write(Path.explode(options_file), YXML.string_of_body(options.encode)) |
74bbe9317aa4
provide explicit options file -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
57580
diff
changeset
|
47 |
|
57580
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
48 |
val progress = new Build.Console_Progress() |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
49 |
progress.interrupt_handler { |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
50 |
build_console(options, progress, |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
51 |
dirs.map(Path.explode(_)), no_build, system_mode, session) |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
52 |
} |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
53 |
case _ => error("Bad arguments:\n" + cat_lines(args)) |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
54 |
} |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
55 |
} |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
56 |
} |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
57 |
} |
86b413b8f779
check and build Isabelle session for console tool -- avoid multiple Scala/JVM invocation;
wenzelm
parents:
diff
changeset
|
58 |