author | wenzelm |
Sun, 20 Nov 2022 23:37:54 +0100 | |
changeset 76518 | b30b8e23383c |
parent 75959 | 4fe213c214f9 |
child 76530 | 2bf13b30b98e |
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 |
) { |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
66 |
def is_linux: Boolean = platform == Platform.Family.linux |
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) |
75906
2167b9e3157a
clarified signature: support for adhoc file types;
wenzelm
parents:
75824
diff
changeset
|
69 |
def download_zip: Boolean = File.is_zip(download_name) |
75224 | 70 |
|
75393 | 71 |
def download(dir: Path, progress: Progress = new Progress): Unit = { |
75224 | 72 |
if (download_zip) Isabelle_System.require_command("unzip", test = "-h") |
73 |
||
75394 | 74 |
Isabelle_System.with_tmp_file("download") { download_file => |
75224 | 75 |
Isabelle_System.download_file(vscodium_download + "/" + version + "/" + download_name, |
76 |
download_file, progress = progress) |
|
77 |
||
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
78 |
progress.echo("Extract ...") |
75224 | 79 |
if (download_zip) { |
80 |
Isabelle_System.bash("unzip -x " + File.bash_path(download_file), cwd = dir.file).check |
|
81 |
} |
|
82 |
else { |
|
83 |
Isabelle_System.gnutar("-xzf " + File.bash_path(download_file), dir = dir).check |
|
84 |
} |
|
75394 | 85 |
} |
75224 | 86 |
} |
87 |
||
75393 | 88 |
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
|
89 |
progress.echo("Getting VSCodium repository ...") |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
90 |
Isabelle_System.bash( |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
91 |
List( |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
92 |
"set -e", |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
93 |
"git clone -n " + Bash.string(vscodium_repository) + " .", |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
94 |
"git checkout -q " + Bash.string(version) |
75272 | 95 |
).mkString("\n"), cwd = build_dir.file).check |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
96 |
|
75232 | 97 |
progress.echo("Getting VSCode repository ...") |
75272 | 98 |
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
|
99 |
} |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
100 |
|
75393 | 101 |
def platform_dir(dir: Path): Path = { |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
102 |
val platform_name = |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
103 |
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
|
104 |
else Platform.Family.standard(platform) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
105 |
dir + Path.explode(platform_name) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
106 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
107 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
108 |
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
|
109 |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
110 |
def environment: String = |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
111 |
(("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
|
112 |
.map(s => "export " + s + "\n").mkString |
75222 | 113 |
|
75393 | 114 |
def patch_sources(base_dir: Path): String = { |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
115 |
val dir = base_dir + Path.explode("vscode") |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
116 |
Isabelle_System.with_copy_dir(dir, dir.orig) { |
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
117 |
// macos icns |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
118 |
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
|
119 |
File.change(dir + Path.explode(name), strict = true) { |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
120 |
_.replace("""'resources/darwin/' + icon + '.icns'""", |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
121 |
"""'resources/darwin/' + icon.toLowerCase() + '.icns'""") |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
122 |
} |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
123 |
} |
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
124 |
|
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
125 |
// isabelle_encoding.ts |
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 |
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
|
128 |
val header = |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
129 |
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
|
130 |
.takeWhile(_.trim.nonEmpty) |
75253 | 131 |
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
|
132 |
} |
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 |
// explicit patches |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
135 |
{ |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
136 |
val patches_dir = Path.explode("$ISABELLE_VSCODE_HOME/patches") |
75277 | 137 |
for (name <- Seq("cli", "isabelle_encoding", "no_ocaml_icons")) { |
75271 | 138 |
val path = patches_dir + Path.explode(name).patch |
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
139 |
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
|
140 |
} |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
141 |
} |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
142 |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
143 |
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
|
144 |
} |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
145 |
} |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
146 |
|
75393 | 147 |
def patch_resources(base_dir: Path): String = { |
75277 | 148 |
val dir = base_dir + resources |
149 |
val patch = |
|
150 |
Isabelle_System.with_copy_dir(dir, dir.orig) { |
|
151 |
val fonts_dir = dir + Path.explode("app/out/vs/base/browser/ui/fonts") |
|
152 |
HTML.init_fonts(fonts_dir.dir) |
|
153 |
make_symbols().write(fonts_dir) |
|
75222 | 154 |
|
75277 | 155 |
val workbench_css = dir + Path.explode("app/out/vs/workbench/workbench.desktop.main.css") |
156 |
val checksum1 = file_checksum(workbench_css) |
|
157 |
File.append(workbench_css, "\n\n" + HTML.fonts_css_dir(prefix = "../base/browser/ui")) |
|
158 |
val checksum2 = file_checksum(workbench_css) |
|
75222 | 159 |
|
75277 | 160 |
val file_name = workbench_css.file_name |
161 |
File.change_lines(dir + Path.explode("app/product.json")) { _.map(line => |
|
162 |
if (line.containsSlice(file_name) && line.contains(checksum1)) { |
|
163 |
line.replace(checksum1, checksum2) |
|
164 |
} |
|
165 |
else line) |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
166 |
} |
75277 | 167 |
|
168 |
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
|
169 |
} |
75222 | 170 |
|
75277 | 171 |
val app_dir = dir + Path.explode("app") |
172 |
val vscodium_app_dir = dir + Path.explode("vscodium") |
|
173 |
Isabelle_System.move_file(app_dir, vscodium_app_dir) |
|
174 |
||
175 |
Isabelle_System.make_directory(app_dir) |
|
176 |
if ((vscodium_app_dir + resources).is_dir) { |
|
177 |
Isabelle_System.copy_dir(vscodium_app_dir + resources, app_dir) |
|
75222 | 178 |
} |
75277 | 179 |
|
180 |
patch |
|
75222 | 181 |
} |
75224 | 182 |
|
75393 | 183 |
def init_resources(base_dir: Path): Path = { |
75278 | 184 |
val dir = base_dir + resources |
75255 | 185 |
if (platform == Platform.Family.macos) { |
75278 | 186 |
Isabelle_System.symlink(Path.explode("VSCodium.app/Contents/Resources"), dir) |
75255 | 187 |
} |
75278 | 188 |
dir |
75255 | 189 |
} |
190 |
||
75393 | 191 |
def setup_node(target_dir: Path, progress: Progress): Unit = { |
75394 | 192 |
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
|
193 |
download(download_dir, progress = progress) |
75255 | 194 |
val dir1 = init_resources(download_dir) |
195 |
val dir2 = init_resources(target_dir) |
|
196 |
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
|
197 |
val path = Path.explode(name) |
75255 | 198 |
Isabelle_System.rm_tree(dir2 + path) |
199 |
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
|
200 |
} |
75394 | 201 |
} |
75228
33fb3014876f
recover platform-specific node binaries from original download, notably for node-pty for Terminal;
wenzelm
parents:
75227
diff
changeset
|
202 |
} |
33fb3014876f
recover platform-specific node binaries from original download, notably for node-pty for Terminal;
wenzelm
parents:
75227
diff
changeset
|
203 |
|
75393 | 204 |
def setup_electron(dir: Path): Unit = { |
75273 | 205 |
val electron = Path.explode("electron") |
206 |
platform match { |
|
207 |
case Platform.Family.linux | Platform.Family.linux_arm => |
|
208 |
Isabelle_System.move_file(dir + Path.explode("codium"), dir + electron) |
|
209 |
case Platform.Family.windows => |
|
210 |
Isabelle_System.move_file(dir + Path.explode("VSCodium.exe"), dir + electron.exe) |
|
211 |
Isabelle_System.move_file( |
|
212 |
dir + Path.explode("VSCodium.VisualElementsManifest.xml"), |
|
213 |
dir + Path.explode("electron.VisualElementsManifest.xml")) |
|
75279
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
214 |
case Platform.Family.macos => |
75273 | 215 |
} |
216 |
} |
|
217 |
||
75393 | 218 |
def setup_executables(dir: Path): Unit = { |
75273 | 219 |
Isabelle_System.rm_tree(dir + Path.explode("bin")) |
220 |
||
221 |
if (platform == Platform.Family.windows) { |
|
222 |
val files = |
|
75394 | 223 |
File.find_files(dir.file, pred = { file => |
224 |
val name = file.getName |
|
75906
2167b9e3157a
clarified signature: support for adhoc file types;
wenzelm
parents:
75824
diff
changeset
|
225 |
File.is_dll(name) || File.is_exe(name) || File.is_node(name) |
75394 | 226 |
}) |
75273 | 227 |
files.foreach(file => File.set_executable(File.path(file), true)) |
228 |
Isabelle_System.bash("chmod -R o-w " + File.bash_path(dir)).check |
|
75224 | 229 |
} |
230 |
} |
|
75222 | 231 |
} |
232 |
||
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
|
233 |
|
75222 | 234 |
// see https://github.com/microsoft/vscode/blob/main/build/gulpfile.vscode.js |
235 |
// function computeChecksum(filename) |
|
75393 | 236 |
private def file_checksum(path: Path): String = { |
75222 | 237 |
val digest = MessageDigest.getInstance("MD5") |
238 |
digest.update(Bytes.read(path).array) |
|
239 |
Bytes(Base64.getEncoder.encode(digest.digest())) |
|
240 |
.text.replaceAll("=", "") |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
241 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
242 |
|
75224 | 243 |
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
|
244 |
Iterator( |
75224 | 245 |
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
|
246 |
List("OS_NAME=linux", "SKIP_LINUX_PACKAGES=True")), |
75224 | 247 |
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
|
248 |
List("OS_NAME=linux", "SKIP_LINUX_PACKAGES=True", "VSCODE_ARCH=arm64")), |
75224 | 249 |
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
|
250 |
List("OS_NAME=osx")), |
75224 | 251 |
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
|
252 |
List("OS_NAME=windows", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
253 |
"SHOULD_BUILD_ZIP=no", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
254 |
"SHOULD_BUILD_EXE_SYS=no", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
255 |
"SHOULD_BUILD_EXE_USR=no", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
256 |
"SHOULD_BUILD_MSI=no", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
257 |
"SHOULD_BUILD_MSI_NOUP=no"))) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
258 |
.map(info => info.platform -> info).toMap |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
259 |
|
75224 | 260 |
def the_platform_info(platform: Platform.Family.Value): Platform_Info = |
261 |
platform_infos.getOrElse(platform, error("No platform info for " + quote(platform.toString))) |
|
262 |
||
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
263 |
def linux_platform_info: Platform_Info = |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
264 |
the_platform_info(Platform.Family.linux) |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
265 |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
266 |
|
75222 | 267 |
/* check system */ |
268 |
||
75393 | 269 |
def check_system(platforms: List[Platform.Family.Value]): Unit = { |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
270 |
if (Platform.family != Platform.Family.linux) error("Not a Linux/x86_64 system") |
75222 | 271 |
|
272 |
Isabelle_System.require_command("git") |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
273 |
Isabelle_System.require_command("node") |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
274 |
Isabelle_System.require_command("yarn") |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
275 |
Isabelle_System.require_command("jq") |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
276 |
|
75222 | 277 |
if (platforms.contains(Platform.Family.windows)) { |
278 |
Isabelle_System.require_command("wine") |
|
279 |
} |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
280 |
|
75224 | 281 |
if (platforms.exists(platform => the_platform_info(platform).download_zip)) { |
282 |
Isabelle_System.require_command("unzip", test = "-h") |
|
283 |
} |
|
75222 | 284 |
} |
285 |
||
286 |
||
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
287 |
/* original repository clones and patches */ |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
288 |
|
75393 | 289 |
def vscodium_patch(verbose: Boolean = false, progress: Progress = new Progress): String = { |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
290 |
val platform_info = linux_platform_info |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
291 |
check_system(List(platform_info.platform)) |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
292 |
|
75394 | 293 |
Isabelle_System.with_tmp_dir("build") { build_dir => |
75272 | 294 |
platform_info.get_vscodium_repository(build_dir, progress = progress) |
295 |
val vscode_dir = build_dir + Path.explode("vscode") |
|
75250 | 296 |
progress.echo("Prepare ...") |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
297 |
Isabelle_System.with_copy_dir(vscode_dir, vscode_dir.orig) { |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
298 |
progress.bash( |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
299 |
List( |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
300 |
"set -e", |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
301 |
platform_info.environment, |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
302 |
"./prepare_vscode.sh", |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
303 |
// enforce binary diff of code.xpm |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
304 |
"cp vscode/resources/linux/code.png vscode/resources/linux/rpm/code.xpm" |
75272 | 305 |
).mkString("\n"), cwd = build_dir.file, echo = verbose).check |
306 |
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
|
307 |
diff_options = "--exclude=.git --exclude=node_modules") |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
308 |
} |
75394 | 309 |
} |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
310 |
} |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
311 |
|
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
312 |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
313 |
/* build vscodium */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
314 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
315 |
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
|
316 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
317 |
def build_vscodium( |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
318 |
target_dir: Path = Path.current, |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
319 |
platforms: List[Platform.Family.Value] = default_platforms, |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
320 |
verbose: Boolean = false, |
75393 | 321 |
progress: Progress = new Progress |
322 |
): Unit = { |
|
75222 | 323 |
check_system(platforms) |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
324 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
325 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
326 |
/* component */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
327 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
328 |
val component_name = "vscodium-" + version |
76518 | 329 |
val component_dir = |
330 |
Components.Directory.create(target_dir + Path.explode(component_name), progress = progress) |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
331 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
332 |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
333 |
/* patches */ |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
334 |
|
75256 | 335 |
progress.echo("\n* Building patches:") |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
336 |
|
76518 | 337 |
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
|
338 |
|
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
339 |
def write_patch(name: String, patch: String): Unit = |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
340 |
File.write(patches_dir + Path.explode(name).patch, patch) |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
341 |
|
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
342 |
write_patch("01-vscodium", vscodium_patch(verbose = verbose, progress = progress)) |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
343 |
|
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
344 |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
345 |
/* build */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
346 |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
347 |
for (platform <- platforms) yield { |
75224 | 348 |
val platform_info = the_platform_info(platform) |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
349 |
|
75394 | 350 |
Isabelle_System.with_tmp_dir("build") { build_dir => |
75256 | 351 |
progress.echo("\n* Building " + platform + ":") |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
352 |
|
75272 | 353 |
platform_info.get_vscodium_repository(build_dir, progress = progress) |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
354 |
|
75272 | 355 |
val sources_patch = platform_info.patch_sources(build_dir) |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
356 |
if (platform_info.is_linux) write_patch("02-isabelle_sources", sources_patch) |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
357 |
|
75250 | 358 |
progress.echo("Build ...") |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
359 |
progress.bash(platform_info.environment + "\n" + "./build.sh", |
75272 | 360 |
cwd = build_dir.file, echo = verbose).check |
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
361 |
|
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
362 |
if (platform_info.is_linux) { |
76518 | 363 |
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
|
364 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
365 |
|
76518 | 366 |
val platform_dir = platform_info.platform_dir(component_dir.path) |
75272 | 367 |
Isabelle_System.copy_dir(platform_info.build_dir(build_dir), platform_dir) |
75273 | 368 |
platform_info.setup_node(platform_dir, progress) |
369 |
platform_info.setup_electron(platform_dir) |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
370 |
|
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
371 |
val resources_patch = platform_info.patch_resources(platform_dir) |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
372 |
if (platform_info.is_linux) write_patch("03-isabelle_resources", resources_patch) |
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
373 |
|
75277 | 374 |
Isabelle_System.copy_file( |
375 |
build_dir + Path.explode("vscode/node_modules/electron/dist/resources/default_app.asar"), |
|
75278 | 376 |
platform_dir + resources) |
75277 | 377 |
|
75224 | 378 |
platform_info.setup_executables(platform_dir) |
75394 | 379 |
} |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
380 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
381 |
|
75231 | 382 |
Isabelle_System.bash("gzip *.patch", cwd = patches_dir.file).check |
383 |
||
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
384 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
385 |
/* settings */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
386 |
|
76518 | 387 |
File.write(component_dir.settings, |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
388 |
"""# -*- shell-script -*- :mode=shellscript: |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
389 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
390 |
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
|
391 |
|
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
392 |
if [ "$ISABELLE_PLATFORM_FAMILY" = "macos" ]; then |
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
393 |
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
|
394 |
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
|
395 |
else |
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
396 |
ISABELLE_VSCODIUM_ELECTRON="$ISABELLE_VSCODIUM_HOME/electron" |
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
397 |
ISABELLE_VSCODIUM_RESOURCES="$ISABELLE_VSCODIUM_HOME/resources" |
9229f2681db7
clarified directory layout and settings: more robust on all platforms;
wenzelm
parents:
75278
diff
changeset
|
398 |
fi |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
399 |
""") |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
400 |
|
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 |
/* README */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
403 |
|
76518 | 404 |
File.write(component_dir.README, |
75217 | 405 |
"This is VSCodium " + version + " from " + vscodium_repository + |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
406 |
""" |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
407 |
|
75230
bbbee54b1198
prepare patched version more thoroughly, with explicit patches;
wenzelm
parents:
75228
diff
changeset
|
408 |
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
|
409 |
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
|
410 |
formal record. |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
411 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
412 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
413 |
Makarius |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
414 |
""" + Date.Format.date(Date.now()) + "\n") |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
415 |
} |
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 |
|
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
418 |
/* Isabelle tool wrappers */ |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
419 |
|
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
420 |
val isabelle_tool1 = |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
421 |
Isabelle_Tool("build_vscodium", "build component for VSCodium", |
75393 | 422 |
Scala_Project.here, |
75394 | 423 |
{ args => |
424 |
var target_dir = Path.current |
|
425 |
var platforms = default_platforms |
|
426 |
var verbose = false |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
427 |
|
75394 | 428 |
val getopts = Getopts(""" |
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
429 |
Usage: build_vscodium [OPTIONS] |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
430 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
431 |
Options are: |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
432 |
-D DIR target directory (default ".") |
75217 | 433 |
-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
|
434 |
-v verbose |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
435 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
436 |
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
|
437 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
438 |
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
|
439 |
for targeting Windows. |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
440 |
""", |
75394 | 441 |
"D:" -> (arg => target_dir = Path.explode(arg)), |
442 |
"p:" -> (arg => platforms = Library.space_explode(',', arg).map(Platform.Family.parse)), |
|
443 |
"v" -> (_ => verbose = true)) |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
444 |
|
75394 | 445 |
val more_args = getopts(args) |
446 |
if (more_args.nonEmpty) getopts.usage() |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
447 |
|
75394 | 448 |
val progress = new Console_Progress() |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
449 |
|
75394 | 450 |
build_vscodium(target_dir = target_dir, platforms = platforms, |
451 |
verbose = verbose, progress = progress) |
|
452 |
}) |
|
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
453 |
|
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
454 |
val isabelle_tool2 = |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
455 |
Isabelle_Tool("vscode_patch", "patch VSCode source tree", |
75393 | 456 |
Scala_Project.here, |
75394 | 457 |
{ args => |
458 |
var base_dir = Path.current |
|
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
459 |
|
75394 | 460 |
val getopts = Getopts(""" |
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
461 |
Usage: vscode_patch [OPTIONS] |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
462 |
|
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
463 |
Options are: |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
464 |
-D DIR base directory (default ".") |
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
465 |
|
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
466 |
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
|
467 |
""", |
75394 | 468 |
"D:" -> (arg => base_dir = Path.explode(arg))) |
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
469 |
|
75394 | 470 |
val more_args = getopts(args) |
471 |
if (more_args.nonEmpty) getopts.usage() |
|
75249
8142e75320f6
patch VSCode source tree to support isabelle_encoding.ts;
wenzelm
parents:
75247
diff
changeset
|
472 |
|
75394 | 473 |
val platform_info = the_platform_info(Platform.family) |
474 |
platform_info.patch_sources(base_dir) |
|
475 |
}) |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
476 |
} |