author | wenzelm |
Sat, 04 Mar 2023 23:25:30 +0100 | |
changeset 77510 | f5d6cd98b16a |
parent 77327 | 089720dddded |
permissions | -rw-r--r-- |
75247 | 1 |
/* Title: Tools/VSCode/src/build_vscodium.scala |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
2 |
Author: Makarius |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
3 |
|
75250 | 4 |
Build the Isabelle system component for VSCodium: cross-compilation for all |
5 |
platforms. |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
6 |
*/ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
7 |
|
75247 | 8 |
package isabelle.vscode |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
9 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
10 |
|
75247 | 11 |
import isabelle._ |
12 |
||
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
13 |
import java.security.MessageDigest |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
14 |
import java.util.Base64 |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
15 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
16 |
|
75393 | 17 |
object Build_VSCodium { |
75217 | 18 |
/* global parameters */ |
19 |
||
20 |
lazy val version: String = Isabelle_System.getenv_strict("ISABELLE_VSCODE_VERSION") |
|
21 |
val vscodium_repository = "https://github.com/VSCodium/vscodium.git" |
|
75224 | 22 |
val vscodium_download = "https://github.com/VSCodium/vscodium/releases/download" |
23 |
||
75278 | 24 |
private val resources = Path.explode("resources") |
25 |
||
75217 | 26 |
|
75253 | 27 |
/* Isabelle symbols (static subset only) */ |
75252
41dfe941c3da
inline Isabelle symbols into source text, so that "isabelle vscode" can start up properly without access to process.env or fs;
wenzelm
parents:
75250
diff
changeset
|
28 |
|
75393 | 29 |
def make_symbols(): File.Content = { |
75252
41dfe941c3da
inline Isabelle symbols into source text, so that "isabelle vscode" can start up properly without access to process.env or fs;
wenzelm
parents:
75250
diff
changeset
|
30 |
val symbols = Symbol.Symbols.load(static = true) |
75253 | 31 |
val symbols_js = |
75959 | 32 |
JSON.Format.pretty_print( |
75253 | 33 |
for (entry <- symbols.entries) yield |
34 |
JSON.Object( |
|
35 |
"symbol" -> entry.symbol, |
|
36 |
"name" -> entry.name, |
|
37 |
"abbrevs" -> entry.abbrevs) ++ |
|
38 |
JSON.optional("code", entry.code)) |
|
39 |
||
75824 | 40 |
File.content(Path.explode("symbols.json"), symbols_js) |
75253 | 41 |
} |
42 |
||
75393 | 43 |
def make_isabelle_encoding(header: String): File.Content = { |
75253 | 44 |
val symbols = Symbol.Symbols.load(static = true) |
45 |
val symbols_js = |
|
75959 | 46 |
JSON.Format.pretty_print( |
75253 | 47 |
for (entry <- symbols.entries; code <- entry.code) |
48 |
yield JSON.Object("symbol" -> entry.symbol, "code" -> code)) |
|
49 |
||
50 |
val path = Path.explode("isabelle_encoding.ts") |
|
51 |
val body = |
|
52 |
File.read(Path.explode("$ISABELLE_VSCODE_HOME/patches") + path) |
|
53 |
.replace("[/*symbols*/]", symbols_js) |
|
75824 | 54 |
File.content(path, header + "\n" + body) |
75252
41dfe941c3da
inline Isabelle symbols into source text, so that "isabelle vscode" can start up properly without access to process.env or fs;
wenzelm
parents:
75250
diff
changeset
|
55 |
} |
41dfe941c3da
inline Isabelle symbols into source text, so that "isabelle vscode" can start up properly without access to process.env or fs;
wenzelm
parents:
75250
diff
changeset
|
56 |
|
41dfe941c3da
inline Isabelle symbols into source text, so that "isabelle vscode" can start up properly without access to process.env or fs;
wenzelm
parents:
75250
diff
changeset
|
57 |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
58 |
/* platform info */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
59 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
60 |
sealed case class Platform_Info( |
75224 | 61 |
platform: Platform.Family.Value, |
62 |
download_template: String, |
|
63 |
build_name: String, |
|
75393 | 64 |
env: List[String] |
65 |
) { |
|
77327 | 66 |
def primary: Boolean = platform == Platform.Family.linux |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
67 |
|
75224 | 68 |
def download_name: String = "VSCodium-" + download_template.replace("{VERSION}", version) |
76626
117cb1c35564
proper file extension for Isabelle_System.extract;
wenzelm
parents:
76548
diff
changeset
|
69 |
def download_ext: String = if (download_template.endsWith(".zip")) "zip" else "tar.gz" |
75224 | 70 |
|
75393 | 71 |
def download(dir: Path, progress: Progress = new Progress): Unit = { |
76626
117cb1c35564
proper file extension for Isabelle_System.extract;
wenzelm
parents:
76548
diff
changeset
|
72 |
Isabelle_System.with_tmp_file("download", ext = download_ext) { download_file => |
75224 | 73 |
Isabelle_System.download_file(vscodium_download + "/" + version + "/" + download_name, |
74 |
download_file, progress = progress) |
|
75 |
||
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
76 |
progress.echo("Extract ...") |
76530 | 77 |
Isabelle_System.extract(download_file, dir) |
75394 | 78 |
} |
75224 | 79 |
} |
80 |
||
75393 | 81 |
def get_vscodium_repository(build_dir: Path, progress: Progress = new Progress): Unit = { |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
82 |
progress.echo("Getting VSCodium repository ...") |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
83 |
Isabelle_System.bash( |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
84 |
List( |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
85 |
"set -e", |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
86 |
"git clone -n " + Bash.string(vscodium_repository) + " .", |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
87 |
"git checkout -q " + Bash.string(version) |
75272 | 88 |
).mkString("\n"), cwd = build_dir.file).check |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
89 |
|
75232 | 90 |
progress.echo("Getting VSCode repository ...") |
75272 | 91 |
Isabelle_System.bash(environment + "\n" + "./get_repo.sh", cwd = build_dir.file).check |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
92 |
} |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
93 |
|
75393 | 94 |
def platform_dir(dir: Path): Path = { |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
95 |
val platform_name = |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
96 |
if (platform == Platform.Family.windows) Platform.Family.native(platform) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
97 |
else Platform.Family.standard(platform) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
98 |
dir + Path.explode(platform_name) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
99 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
100 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
101 |
def build_dir(dir: Path): Path = dir + Path.explode(build_name) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
102 |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
103 |
def environment: String = |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
104 |
(("MS_TAG=" + Bash.string(version)) :: "SHOULD_BUILD=yes" :: "VSCODE_ARCH=x64" :: env) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
105 |
.map(s => "export " + s + "\n").mkString |
75222 | 106 |
|
75393 | 107 |
def patch_sources(base_dir: Path): String = { |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
108 |
val dir = base_dir + Path.explode("vscode") |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
109 |
Isabelle_System.with_copy_dir(dir, dir.orig) { |
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
110 |
// macos icns |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
111 |
for (name <- Seq("build/lib/electron.js", "build/lib/electron.ts")) { |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
112 |
File.change(dir + Path.explode(name), strict = true) { |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
113 |
_.replace("""'resources/darwin/' + icon + '.icns'""", |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
114 |
"""'resources/darwin/' + icon.toLowerCase() + '.icns'""") |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
115 |
} |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
116 |
} |
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
117 |
|
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
118 |
// isabelle_encoding.ts |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
119 |
{ |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
120 |
val common_dir = dir + Path.explode("src/vs/workbench/services/textfile/common") |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
121 |
val header = |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
122 |
split_lines(File.read(common_dir + Path.explode("encoding.ts"))) |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
123 |
.takeWhile(_.trim.nonEmpty) |
75253 | 124 |
make_isabelle_encoding(cat_lines(header)).write(common_dir) |
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
125 |
} |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
126 |
|
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
127 |
// explicit patches |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
128 |
{ |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
129 |
val patches_dir = Path.explode("$ISABELLE_VSCODE_HOME/patches") |
75277 | 130 |
for (name <- Seq("cli", "isabelle_encoding", "no_ocaml_icons")) { |
75271 | 131 |
val path = patches_dir + Path.explode(name).patch |
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
132 |
Isabelle_System.bash("patch -p1 < " + File.bash_path(path), cwd = dir.file).check |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
133 |
} |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
134 |
} |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
135 |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
136 |
Isabelle_System.make_patch(base_dir, dir.base.orig, dir.base) |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
137 |
} |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
138 |
} |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
139 |
|
75393 | 140 |
def patch_resources(base_dir: Path): String = { |
75277 | 141 |
val dir = base_dir + resources |
142 |
val patch = |
|
143 |
Isabelle_System.with_copy_dir(dir, dir.orig) { |
|
144 |
val fonts_dir = dir + Path.explode("app/out/vs/base/browser/ui/fonts") |
|
145 |
HTML.init_fonts(fonts_dir.dir) |
|
146 |
make_symbols().write(fonts_dir) |
|
75222 | 147 |
|
75277 | 148 |
val workbench_css = dir + Path.explode("app/out/vs/workbench/workbench.desktop.main.css") |
149 |
val checksum1 = file_checksum(workbench_css) |
|
150 |
File.append(workbench_css, "\n\n" + HTML.fonts_css_dir(prefix = "../base/browser/ui")) |
|
151 |
val checksum2 = file_checksum(workbench_css) |
|
75222 | 152 |
|
75277 | 153 |
val file_name = workbench_css.file_name |
154 |
File.change_lines(dir + Path.explode("app/product.json")) { _.map(line => |
|
155 |
if (line.containsSlice(file_name) && line.contains(checksum1)) { |
|
156 |
line.replace(checksum1, checksum2) |
|
157 |
} |
|
158 |
else line) |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
159 |
} |
75277 | 160 |
|
161 |
Isabelle_System.make_patch(dir.dir, dir.orig.base, dir.base) |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
162 |
} |
75222 | 163 |
|
75277 | 164 |
val app_dir = dir + Path.explode("app") |
165 |
val vscodium_app_dir = dir + Path.explode("vscodium") |
|
166 |
Isabelle_System.move_file(app_dir, vscodium_app_dir) |
|
167 |
||
168 |
Isabelle_System.make_directory(app_dir) |
|
169 |
if ((vscodium_app_dir + resources).is_dir) { |
|
170 |
Isabelle_System.copy_dir(vscodium_app_dir + resources, app_dir) |
|
75222 | 171 |
} |
75277 | 172 |
|
173 |
patch |
|
75222 | 174 |
} |
75224 | 175 |
|
75393 | 176 |
def init_resources(base_dir: Path): Path = { |
75278 | 177 |
val dir = base_dir + resources |
75255 | 178 |
if (platform == Platform.Family.macos) { |
75278 | 179 |
Isabelle_System.symlink(Path.explode("VSCodium.app/Contents/Resources"), dir) |
75255 | 180 |
} |
75278 | 181 |
dir |
75255 | 182 |
} |
183 |
||
75393 | 184 |
def setup_node(target_dir: Path, progress: Progress): Unit = { |
75394 | 185 |
Isabelle_System.with_tmp_dir("download") { download_dir => |
75228
33fb3014876f
recover platform-specific node binaries from original download, notably for node-pty for Terminal;
wenzelm
parents:
75227
diff
changeset
|
186 |
download(download_dir, progress = progress) |
75255 | 187 |
val dir1 = init_resources(download_dir) |
188 |
val dir2 = init_resources(target_dir) |
|
189 |
for (name <- Seq("app/node_modules.asar", "app/node_modules.asar.unpacked")) { |
|
75252
41dfe941c3da
inline Isabelle symbols into source text, so that "isabelle vscode" can start up properly without access to process.env or fs;
wenzelm
parents:
75250
diff
changeset
|
190 |
val path = Path.explode(name) |
75255 | 191 |
Isabelle_System.rm_tree(dir2 + path) |
192 |
Isabelle_System.copy_dir(dir1 + path, dir2 + path) |
|
75228
33fb3014876f
recover platform-specific node binaries from original download, notably for node-pty for Terminal;
wenzelm
parents:
75227
diff
changeset
|
193 |
} |
75394 | 194 |
} |
75228
33fb3014876f
recover platform-specific node binaries from original download, notably for node-pty for Terminal;
wenzelm
parents:
75227
diff
changeset
|
195 |
} |
33fb3014876f
recover platform-specific node binaries from original download, notably for node-pty for Terminal;
wenzelm
parents:
75227
diff
changeset
|
196 |
|
75393 | 197 |
def setup_electron(dir: Path): Unit = { |
75273 | 198 |
val electron = Path.explode("electron") |
199 |
platform match { |
|
200 |
case Platform.Family.linux | Platform.Family.linux_arm => |
|
201 |
Isabelle_System.move_file(dir + Path.explode("codium"), dir + electron) |
|
202 |
case Platform.Family.windows => |
|
203 |
Isabelle_System.move_file(dir + Path.explode("VSCodium.exe"), dir + electron.exe) |
|
204 |
Isabelle_System.move_file( |
|
205 |
dir + Path.explode("VSCodium.VisualElementsManifest.xml"), |
|
206 |
dir + Path.explode("electron.VisualElementsManifest.xml")) |
|
75279
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
207 |
case Platform.Family.macos => |
75273 | 208 |
} |
209 |
} |
|
210 |
||
75393 | 211 |
def setup_executables(dir: Path): Unit = { |
75273 | 212 |
Isabelle_System.rm_tree(dir + Path.explode("bin")) |
213 |
||
214 |
if (platform == Platform.Family.windows) { |
|
215 |
val files = |
|
75394 | 216 |
File.find_files(dir.file, pred = { file => |
217 |
val name = file.getName |
|
75906
2167b9e3157a
clarified signature: support for adhoc file types;
wenzelm
parents:
75824
diff
changeset
|
218 |
File.is_dll(name) || File.is_exe(name) || File.is_node(name) |
75394 | 219 |
}) |
75273 | 220 |
files.foreach(file => File.set_executable(File.path(file), true)) |
221 |
Isabelle_System.bash("chmod -R o-w " + File.bash_path(dir)).check |
|
75224 | 222 |
} |
223 |
} |
|
75222 | 224 |
} |
225 |
||
75252
41dfe941c3da
inline Isabelle symbols into source text, so that "isabelle vscode" can start up properly without access to process.env or fs;
wenzelm
parents:
75250
diff
changeset
|
226 |
|
75222 | 227 |
// see https://github.com/microsoft/vscode/blob/main/build/gulpfile.vscode.js |
228 |
// function computeChecksum(filename) |
|
75393 | 229 |
private def file_checksum(path: Path): String = { |
75222 | 230 |
val digest = MessageDigest.getInstance("MD5") |
231 |
digest.update(Bytes.read(path).array) |
|
232 |
Bytes(Base64.getEncoder.encode(digest.digest())) |
|
233 |
.text.replaceAll("=", "") |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
234 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
235 |
|
75224 | 236 |
private val platform_infos: Map[Platform.Family.Value, Platform_Info] = |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
237 |
Iterator( |
75224 | 238 |
Platform_Info(Platform.Family.linux, "linux-x64-{VERSION}.tar.gz", "VSCode-linux-x64", |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
239 |
List("OS_NAME=linux", "SKIP_LINUX_PACKAGES=True")), |
75224 | 240 |
Platform_Info(Platform.Family.linux_arm, "linux-arm64-{VERSION}.tar.gz", "VSCode-linux-arm64", |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
241 |
List("OS_NAME=linux", "SKIP_LINUX_PACKAGES=True", "VSCODE_ARCH=arm64")), |
75224 | 242 |
Platform_Info(Platform.Family.macos, "darwin-x64-{VERSION}.zip", "VSCode-darwin-x64", |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
243 |
List("OS_NAME=osx")), |
75224 | 244 |
Platform_Info(Platform.Family.windows, "win32-x64-{VERSION}.zip", "VSCode-win32-x64", |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
245 |
List("OS_NAME=windows", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
246 |
"SHOULD_BUILD_ZIP=no", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
247 |
"SHOULD_BUILD_EXE_SYS=no", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
248 |
"SHOULD_BUILD_EXE_USR=no", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
249 |
"SHOULD_BUILD_MSI=no", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
250 |
"SHOULD_BUILD_MSI_NOUP=no"))) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
251 |
.map(info => info.platform -> info).toMap |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
252 |
|
75224 | 253 |
def the_platform_info(platform: Platform.Family.Value): Platform_Info = |
254 |
platform_infos.getOrElse(platform, error("No platform info for " + quote(platform.toString))) |
|
255 |
||
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
256 |
def linux_platform_info: Platform_Info = |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
257 |
the_platform_info(Platform.Family.linux) |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
258 |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
259 |
|
75222 | 260 |
/* check system */ |
261 |
||
75393 | 262 |
def check_system(platforms: List[Platform.Family.Value]): Unit = { |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
263 |
if (Platform.family != Platform.Family.linux) error("Not a Linux/x86_64 system") |
75222 | 264 |
|
265 |
Isabelle_System.require_command("git") |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
266 |
Isabelle_System.require_command("node") |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
267 |
Isabelle_System.require_command("yarn") |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
268 |
Isabelle_System.require_command("jq") |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
269 |
|
75222 | 270 |
if (platforms.contains(Platform.Family.windows)) { |
271 |
Isabelle_System.require_command("wine") |
|
272 |
} |
|
273 |
} |
|
274 |
||
275 |
||
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
276 |
/* original repository clones and patches */ |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
277 |
|
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
77327
diff
changeset
|
278 |
def vscodium_patch(progress: Progress = new Progress): String = { |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
279 |
val platform_info = linux_platform_info |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
280 |
check_system(List(platform_info.platform)) |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
281 |
|
75394 | 282 |
Isabelle_System.with_tmp_dir("build") { build_dir => |
75272 | 283 |
platform_info.get_vscodium_repository(build_dir, progress = progress) |
284 |
val vscode_dir = build_dir + Path.explode("vscode") |
|
75250 | 285 |
progress.echo("Prepare ...") |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
286 |
Isabelle_System.with_copy_dir(vscode_dir, vscode_dir.orig) { |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
287 |
progress.bash( |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
288 |
List( |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
289 |
"set -e", |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
290 |
platform_info.environment, |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
291 |
"./prepare_vscode.sh", |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
292 |
// enforce binary diff of code.xpm |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
293 |
"cp vscode/resources/linux/code.png vscode/resources/linux/rpm/code.xpm" |
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
77327
diff
changeset
|
294 |
).mkString("\n"), cwd = build_dir.file, echo = progress.verbose).check |
75272 | 295 |
Isabelle_System.make_patch(build_dir, vscode_dir.orig.base, vscode_dir.base, |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
296 |
diff_options = "--exclude=.git --exclude=node_modules") |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
297 |
} |
75394 | 298 |
} |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
299 |
} |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
300 |
|
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
301 |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
302 |
/* build vscodium */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
303 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
304 |
def default_platforms: List[Platform.Family.Value] = Platform.Family.list |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
305 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
306 |
def build_vscodium( |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
307 |
target_dir: Path = Path.current, |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
308 |
platforms: List[Platform.Family.Value] = default_platforms, |
75393 | 309 |
progress: Progress = new Progress |
310 |
): Unit = { |
|
75222 | 311 |
check_system(platforms) |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
312 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
313 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
314 |
/* component */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
315 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
316 |
val component_name = "vscodium-" + version |
76518 | 317 |
val component_dir = |
76547 | 318 |
Components.Directory(target_dir + Path.explode(component_name)).create(progress = progress) |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
319 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
320 |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
321 |
/* patches */ |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
322 |
|
75256 | 323 |
progress.echo("\n* Building patches:") |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
324 |
|
76518 | 325 |
val patches_dir = Isabelle_System.new_directory(component_dir.path + Path.explode("patches")) |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
326 |
|
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
327 |
def write_patch(name: String, patch: String): Unit = |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
328 |
File.write(patches_dir + Path.explode(name).patch, patch) |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
329 |
|
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
77327
diff
changeset
|
330 |
write_patch("01-vscodium", vscodium_patch(progress = progress)) |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
331 |
|
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
332 |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
333 |
/* build */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
334 |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
335 |
for (platform <- platforms) yield { |
75224 | 336 |
val platform_info = the_platform_info(platform) |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
337 |
|
75394 | 338 |
Isabelle_System.with_tmp_dir("build") { build_dir => |
75256 | 339 |
progress.echo("\n* Building " + platform + ":") |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
340 |
|
75272 | 341 |
platform_info.get_vscodium_repository(build_dir, progress = progress) |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
342 |
|
75272 | 343 |
val sources_patch = platform_info.patch_sources(build_dir) |
77327 | 344 |
if (platform_info.primary) write_patch("02-isabelle_sources", sources_patch) |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
345 |
|
75250 | 346 |
progress.echo("Build ...") |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
347 |
progress.bash(platform_info.environment + "\n" + "./build.sh", |
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
77327
diff
changeset
|
348 |
cwd = build_dir.file, echo = progress.verbose).check |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
349 |
|
77327 | 350 |
if (platform_info.primary) { |
76518 | 351 |
Isabelle_System.copy_file(build_dir + Path.explode("LICENSE"), component_dir.path) |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
352 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
353 |
|
76518 | 354 |
val platform_dir = platform_info.platform_dir(component_dir.path) |
75272 | 355 |
Isabelle_System.copy_dir(platform_info.build_dir(build_dir), platform_dir) |
75273 | 356 |
platform_info.setup_node(platform_dir, progress) |
357 |
platform_info.setup_electron(platform_dir) |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
358 |
|
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
359 |
val resources_patch = platform_info.patch_resources(platform_dir) |
77327 | 360 |
if (platform_info.primary) write_patch("03-isabelle_resources", resources_patch) |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
361 |
|
75277 | 362 |
Isabelle_System.copy_file( |
363 |
build_dir + Path.explode("vscode/node_modules/electron/dist/resources/default_app.asar"), |
|
75278 | 364 |
platform_dir + resources) |
75277 | 365 |
|
75224 | 366 |
platform_info.setup_executables(platform_dir) |
75394 | 367 |
} |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
368 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
369 |
|
75231 | 370 |
Isabelle_System.bash("gzip *.patch", cwd = patches_dir.file).check |
371 |
||
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
372 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
373 |
/* settings */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
374 |
|
76548 | 375 |
component_dir.write_settings(""" |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
376 |
ISABELLE_VSCODIUM_HOME="$COMPONENT/${ISABELLE_WINDOWS_PLATFORM64:-$ISABELLE_PLATFORM64}" |
75279
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
377 |
|
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
378 |
if [ "$ISABELLE_PLATFORM_FAMILY" = "macos" ]; then |
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
379 |
ISABELLE_VSCODIUM_ELECTRON="$ISABELLE_VSCODIUM_HOME/VSCodium.app/Contents/MacOS/Electron" |
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
380 |
ISABELLE_VSCODIUM_RESOURCES="$ISABELLE_VSCODIUM_HOME/VSCodium.app/Contents/Resources" |
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
381 |
else |
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
382 |
ISABELLE_VSCODIUM_ELECTRON="$ISABELLE_VSCODIUM_HOME/electron" |
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
383 |
ISABELLE_VSCODIUM_RESOURCES="$ISABELLE_VSCODIUM_HOME/resources" |
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
384 |
fi |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
385 |
""") |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
386 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
387 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
388 |
/* README */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
389 |
|
76518 | 390 |
File.write(component_dir.README, |
75217 | 391 |
"This is VSCodium " + version + " from " + vscodium_repository + |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
392 |
""" |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
393 |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
394 |
It has been built from sources using "isabelle build_vscodium". This applies |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
395 |
a few changes required for Isabelle/VSCode, see "patches" directory for a |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
396 |
formal record. |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
397 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
398 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
399 |
Makarius |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
400 |
""" + Date.Format.date(Date.now()) + "\n") |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
401 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
402 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
403 |
|
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
404 |
/* Isabelle tool wrappers */ |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
405 |
|
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
406 |
val isabelle_tool1 = |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
407 |
Isabelle_Tool("build_vscodium", "build component for VSCodium", |
75393 | 408 |
Scala_Project.here, |
75394 | 409 |
{ args => |
410 |
var target_dir = Path.current |
|
411 |
var platforms = default_platforms |
|
412 |
var verbose = false |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
413 |
|
75394 | 414 |
val getopts = Getopts(""" |
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
415 |
Usage: build_vscodium [OPTIONS] |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
416 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
417 |
Options are: |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
418 |
-D DIR target directory (default ".") |
75217 | 419 |
-p NAMES platform families (default: """ + quote(platforms.mkString(",")) + """) |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
420 |
-v verbose |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
421 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
422 |
Build VSCodium from sources and turn it into an Isabelle component. |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
423 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
424 |
The build platform needs to be Linux with nodejs/yarn, jq, and wine |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
425 |
for targeting Windows. |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
426 |
""", |
75394 | 427 |
"D:" -> (arg => target_dir = Path.explode(arg)), |
77218 | 428 |
"p:" -> (arg => platforms = space_explode(',', arg).map(Platform.Family.parse)), |
75394 | 429 |
"v" -> (_ => verbose = true)) |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
430 |
|
75394 | 431 |
val more_args = getopts(args) |
432 |
if (more_args.nonEmpty) getopts.usage() |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
433 |
|
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
77327
diff
changeset
|
434 |
val progress = new Console_Progress(verbose = verbose) |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
435 |
|
77510
f5d6cd98b16a
clarified signature: manage "verbose" flag via "progress";
wenzelm
parents:
77327
diff
changeset
|
436 |
build_vscodium(target_dir = target_dir, platforms = platforms, progress = progress) |
75394 | 437 |
}) |
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
438 |
|
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
439 |
val isabelle_tool2 = |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
440 |
Isabelle_Tool("vscode_patch", "patch VSCode source tree", |
75393 | 441 |
Scala_Project.here, |
75394 | 442 |
{ args => |
443 |
var base_dir = Path.current |
|
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
444 |
|
75394 | 445 |
val getopts = Getopts(""" |
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
446 |
Usage: vscode_patch [OPTIONS] |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
447 |
|
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
448 |
Options are: |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
449 |
-D DIR base directory (default ".") |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
450 |
|
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
451 |
Patch original VSCode source tree for use with Isabelle/VSCode. |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
452 |
""", |
75394 | 453 |
"D:" -> (arg => base_dir = Path.explode(arg))) |
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
454 |
|
75394 | 455 |
val more_args = getopts(args) |
456 |
if (more_args.nonEmpty) getopts.usage() |
|
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
457 |
|
75394 | 458 |
val platform_info = the_platform_info(Platform.family) |
459 |
platform_info.patch_sources(base_dir) |
|
460 |
}) |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
461 |
} |