36 |
36 |
37 object Context { |
37 object Context { |
38 def apply( |
38 def apply( |
39 isabelle_platform: Isabelle_Platform = local, |
39 isabelle_platform: Isabelle_Platform = local, |
40 mingw: MinGW = MinGW.none, |
40 mingw: MinGW = MinGW.none, |
|
41 apple: Boolean = true, |
41 progress: Progress = new Progress |
42 progress: Progress = new Progress |
42 ): Context = { |
43 ): Context = { |
43 val context_platform = isabelle_platform |
44 val context_platform = isabelle_platform |
44 val context_mingw = mingw |
45 val context_mingw = mingw |
|
46 val context_apple = apple |
45 val context_progress = progress |
47 val context_progress = progress |
46 new Context { |
48 new Context { |
47 override def isabelle_platform: Isabelle_Platform = context_platform |
49 override def isabelle_platform: Isabelle_Platform = context_platform |
48 override def mingw: MinGW = context_mingw |
50 override def mingw: MinGW = context_mingw |
|
51 override def apple: Boolean = context_apple |
49 override def progress: Progress = context_progress |
52 override def progress: Progress = context_progress |
50 } |
53 } |
51 } |
54 } |
52 } |
55 } |
53 |
56 |
54 trait Context { |
57 trait Context { |
55 def isabelle_platform: Isabelle_Platform |
58 def isabelle_platform: Isabelle_Platform |
56 def mingw: MinGW |
59 def mingw: MinGW |
|
60 def apple: Boolean |
57 def progress: Progress |
61 def progress: Progress |
|
62 |
|
63 def ISABELLE_PLATFORM: String = isabelle_platform.ISABELLE_PLATFORM(windows = true, apple = apple) |
|
64 def is_linux_arm: Boolean = isabelle_platform.is_linux && isabelle_platform.is_arm |
|
65 def is_macos_arm: Boolean = isabelle_platform.is_macos && isabelle_platform.is_arm && apple |
|
66 def is_arm: Boolean = is_linux_arm || is_macos_arm |
58 |
67 |
59 def standard_path(path: Path): String = |
68 def standard_path(path: Path): String = |
60 mingw.standard_path(File.platform_path(path)) |
69 mingw.standard_path(File.platform_path(path)) |
61 |
70 |
62 def execute(cwd: Path, script_lines: String*): Process_Result = { |
71 def execute(cwd: Path, script_lines: String*): Process_Result = { |
63 val script = cat_lines("set -e" :: script_lines.toList) |
72 val script = cat_lines("set -e" :: script_lines.toList) |
64 val script1 = |
73 val script1 = |
65 if (isabelle_platform.is_arm && isabelle_platform.is_macos) { |
74 if (is_macos_arm) "arch -arch arm64 bash -c " + Bash.string(script) |
66 "arch -arch arm64 bash -c " + Bash.string(script) |
|
67 } |
|
68 else mingw.bash_script(script) |
75 else mingw.bash_script(script) |
69 progress.bash(script1, cwd = cwd, echo = progress.verbose).check |
76 progress.bash(script1, cwd = cwd, echo = progress.verbose).check |
70 } |
77 } |
71 } |
78 } |
72 } |
79 } |