equal
deleted
inserted
replaced
4 Isabelle setup tool: bootstrap from generic Java environment. |
4 Isabelle setup tool: bootstrap from generic Java environment. |
5 */ |
5 */ |
6 |
6 |
7 package isabelle.setup; |
7 package isabelle.setup; |
8 |
8 |
|
9 |
|
10 import java.io.IOException; |
|
11 import java.security.NoSuchAlgorithmException; |
|
12 |
|
13 |
9 class Setup |
14 class Setup |
10 { |
15 { |
|
16 private static void echo(String msg) |
|
17 { |
|
18 System.out.println(msg); |
|
19 |
|
20 } |
|
21 private static void fail(String msg) |
|
22 { |
|
23 echo(msg); |
|
24 System.exit(2); |
|
25 } |
|
26 |
|
27 private static void check_args(boolean b) |
|
28 { |
|
29 if (!b) { fail("Bad command-line arguments"); } |
|
30 } |
|
31 |
11 public static void main(String[] args) |
32 public static void main(String[] args) |
12 { |
33 { |
13 System.out.println("Isabelle setup"); |
34 int n = args.length; |
|
35 check_args(n > 0); |
|
36 |
|
37 String op = args[0]; |
|
38 try { |
|
39 switch (op) { |
|
40 case "build": |
|
41 check_args(n == 1); |
|
42 Build.build_components(false); |
|
43 break; |
|
44 case "build_fresh": |
|
45 check_args(n == 1); |
|
46 Build.build_components(true); |
|
47 break; |
|
48 case "classpath": |
|
49 check_args(n == 1); |
|
50 echo(Environment.join_standard_paths(Build.classpath())); |
|
51 break; |
|
52 case "services": |
|
53 check_args(n == 1); |
|
54 for (String s : Build.services()) { echo(s); } |
|
55 break; |
|
56 default: |
|
57 fail("Bad setup operation " + Environment.quote(op)); |
|
58 break; |
|
59 } |
|
60 } |
|
61 catch (InterruptedException e) { |
|
62 echo("Interrupt"); |
|
63 System.exit(139); |
|
64 } |
|
65 catch (IOException | RuntimeException | NoSuchAlgorithmException e) { |
|
66 echo(e.getMessage()); |
|
67 System.exit(1); |
|
68 } |
14 } |
69 } |
15 } |
70 } |