author | wenzelm |
Sat, 05 Mar 2022 20:01:23 +0100 | |
changeset 75225 | 05f677e64178 |
parent 75224 | 419781ac89bf |
child 75226 | 5e87e4fb68d2 |
permissions | -rw-r--r-- |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
1 |
/* Title: Pure/Admin/build_vscodium.scala |
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 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
4 |
Build component for VSCodium (cross-compiled from sources for all platforms). |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
5 |
*/ |
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 |
package isabelle |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
8 |
|
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 |
import java.security.MessageDigest |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
11 |
import java.util.Base64 |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
12 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
13 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
14 |
object Build_VSCodium |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
15 |
{ |
75217 | 16 |
/* global parameters */ |
17 |
||
18 |
lazy val version: String = Isabelle_System.getenv_strict("ISABELLE_VSCODE_VERSION") |
|
19 |
val vscodium_repository = "https://github.com/VSCodium/vscodium.git" |
|
75224 | 20 |
val vscodium_download = "https://github.com/VSCodium/vscodium/releases/download" |
21 |
||
22 |
def vscodium_exe(dir: Path): Path = dir + Path.explode("bin/codium") |
|
75217 | 23 |
|
24 |
||
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
25 |
/* platform info */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
26 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
27 |
sealed case class Platform_Info( |
75224 | 28 |
platform: Platform.Family.Value, |
29 |
download_template: String, |
|
30 |
build_name: String, |
|
31 |
env: List[String]) |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
32 |
{ |
75224 | 33 |
def download_name: String = "VSCodium-" + download_template.replace("{VERSION}", version) |
34 |
def download_zip: Boolean = download_name.endsWith(".zip") |
|
35 |
||
36 |
def download(dir: Path, progress: Progress = new Progress): Unit = |
|
37 |
{ |
|
38 |
if (download_zip) Isabelle_System.require_command("unzip", test = "-h") |
|
39 |
||
40 |
Isabelle_System.with_tmp_file("download")(download_file => |
|
41 |
{ |
|
42 |
Isabelle_System.download_file(vscodium_download + "/" + version + "/" + download_name, |
|
43 |
download_file, progress = progress) |
|
44 |
||
45 |
progress.echo("Unpacking " + dir.expand) |
|
46 |
if (download_zip) { |
|
47 |
Isabelle_System.bash("unzip -x " + File.bash_path(download_file), cwd = dir.file).check |
|
48 |
} |
|
49 |
else { |
|
50 |
Isabelle_System.gnutar("-xzf " + File.bash_path(download_file), dir = dir).check |
|
51 |
} |
|
52 |
}) |
|
53 |
} |
|
54 |
||
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
55 |
def platform_dir(dir: Path): Path = |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
56 |
{ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
57 |
val platform_name = |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
58 |
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
|
59 |
else Platform.Family.standard(platform) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
60 |
dir + Path.explode(platform_name) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
61 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
62 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
63 |
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
|
64 |
|
75224 | 65 |
def build_environment: String = |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
66 |
(("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
|
67 |
.map(s => "export " + s + "\n").mkString |
75222 | 68 |
|
75224 | 69 |
def resources_dir(dir: Path): Path = |
75222 | 70 |
{ |
71 |
val resources = |
|
72 |
if (platform == Platform.Family.macos) "VSCodium.app/Contents/Resources" |
|
73 |
else "resources" |
|
75224 | 74 |
dir + Path.explode(resources) |
75 |
} |
|
76 |
||
77 |
def patch_resources(dir0: Path): Unit = |
|
78 |
{ |
|
79 |
val dir = resources_dir(dir0) |
|
75222 | 80 |
|
81 |
HTML.init_fonts(dir + Path.explode("app/out/vs/base/browser/ui")) |
|
82 |
||
83 |
val workbench_css = dir + Path.explode("app/out/vs/workbench/workbench.desktop.main.css") |
|
84 |
val checksum1 = file_checksum(workbench_css) |
|
85 |
File.append(workbench_css, "\n\n" + HTML.fonts_css_dir(prefix = "../base/browser/ui")) |
|
86 |
val checksum2 = file_checksum(workbench_css) |
|
87 |
||
88 |
val file_name = workbench_css.file_name |
|
89 |
File.change_lines(dir + Path.explode("app/product.json")) { _.map(line => |
|
90 |
if (line.containsSlice(file_name) && line.contains(checksum1)) { |
|
91 |
line.replace(checksum1, checksum2) |
|
92 |
} |
|
93 |
else line) |
|
94 |
} |
|
95 |
} |
|
75224 | 96 |
|
97 |
def setup_executables(dir: Path): Unit = |
|
98 |
{ |
|
99 |
val exe = vscodium_exe(dir) |
|
100 |
Isabelle_System.make_directory(exe.dir) |
|
101 |
||
102 |
platform match { |
|
103 |
case Platform.Family.macos => |
|
104 |
File.write(exe, macos_exe) |
|
105 |
File.set_executable(exe, true) |
|
106 |
case Platform.Family.windows => |
|
107 |
val files1 = File.find_files(exe.dir.file) |
|
108 |
val files2 = File.find_files(dir.file, pred = file => |
|
109 |
{ |
|
110 |
val name = file.getName |
|
111 |
name.endsWith(".dll") || name.endsWith(".exe") || name.endsWith(".node") |
|
112 |
}) |
|
113 |
for (file <- files1 ::: files2) File.set_executable(File.path(file), true) |
|
114 |
Isabelle_System.bash("chmod -R o-w " + File.bash_path(dir)) |
|
115 |
case _ => |
|
116 |
} |
|
117 |
} |
|
75222 | 118 |
} |
119 |
||
120 |
// see https://github.com/microsoft/vscode/blob/main/build/gulpfile.vscode.js |
|
121 |
// function computeChecksum(filename) |
|
122 |
private def file_checksum(path: Path): String = |
|
123 |
{ |
|
124 |
val digest = MessageDigest.getInstance("MD5") |
|
125 |
digest.update(Bytes.read(path).array) |
|
126 |
Bytes(Base64.getEncoder.encode(digest.digest())) |
|
127 |
.text.replaceAll("=", "") |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
128 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
129 |
|
75224 | 130 |
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
|
131 |
Iterator( |
75224 | 132 |
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
|
133 |
List("OS_NAME=linux", "SKIP_LINUX_PACKAGES=True")), |
75224 | 134 |
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
|
135 |
List("OS_NAME=linux", "SKIP_LINUX_PACKAGES=True", "VSCODE_ARCH=arm64")), |
75224 | 136 |
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
|
137 |
List("OS_NAME=osx")), |
75224 | 138 |
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
|
139 |
List("OS_NAME=windows", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
140 |
"SHOULD_BUILD_ZIP=no", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
141 |
"SHOULD_BUILD_EXE_SYS=no", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
142 |
"SHOULD_BUILD_EXE_USR=no", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
143 |
"SHOULD_BUILD_MSI=no", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
144 |
"SHOULD_BUILD_MSI_NOUP=no"))) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
145 |
.map(info => info.platform -> info).toMap |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
146 |
|
75224 | 147 |
def the_platform_info(platform: Platform.Family.Value): Platform_Info = |
148 |
platform_infos.getOrElse(platform, error("No platform info for " + quote(platform.toString))) |
|
149 |
||
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
150 |
|
75222 | 151 |
/* check system */ |
152 |
||
153 |
def check_system(platforms: List[Platform.Family.Value]): Unit = |
|
154 |
{ |
|
155 |
Linux.check_system() |
|
156 |
||
157 |
Isabelle_System.require_command("git") |
|
158 |
if (platforms.nonEmpty) { |
|
159 |
Isabelle_System.require_command("node") |
|
160 |
Isabelle_System.require_command("yarn") |
|
161 |
Isabelle_System.require_command("jq") |
|
162 |
} |
|
163 |
if (platforms.contains(Platform.Family.windows)) { |
|
164 |
Isabelle_System.require_command("wine") |
|
165 |
} |
|
75224 | 166 |
if (platforms.exists(platform => the_platform_info(platform).download_zip)) { |
167 |
Isabelle_System.require_command("unzip", test = "-h") |
|
168 |
} |
|
75222 | 169 |
} |
170 |
||
171 |
||
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
172 |
/* build vscodium */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
173 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
174 |
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
|
175 |
|
75223 | 176 |
def macos_exe: String = |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
177 |
"""#!/usr/bin/env bash |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
178 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
179 |
unset CDPATH |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
180 |
VSCODE_PATH="$(cd "$(dirname "$0")"/../VSCodium.app/Contents; pwd)" |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
181 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
182 |
ELECTRON="$VSCODE_PATH/MacOS/Electron" |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
183 |
CLI="$VSCODE_PATH/Resources/app/out/cli.js" |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
184 |
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" --ms-enable-electron-run-as-node "$@" |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
185 |
exit $? |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
186 |
""" |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
187 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
188 |
def build_vscodium( |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
189 |
target_dir: Path = Path.current, |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
190 |
platforms: List[Platform.Family.Value] = default_platforms, |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
191 |
verbose: Boolean = false, |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
192 |
progress: Progress = new Progress): Unit = |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
193 |
{ |
75222 | 194 |
check_system(platforms) |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
195 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
196 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
197 |
/* component */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
198 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
199 |
val component_name = "vscodium-" + version |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
200 |
val component_dir = Isabelle_System.new_directory(target_dir + Path.basic(component_name)) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
201 |
progress.echo("Component " + component_dir) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
202 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
203 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
204 |
/* build */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
205 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
206 |
for (platform <- platforms) { |
75224 | 207 |
val platform_info = the_platform_info(platform) |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
208 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
209 |
progress.echo("Building " + platform + " ...") |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
210 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
211 |
Isabelle_System.with_tmp_dir("vscodium")(vscodium_dir => |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
212 |
{ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
213 |
def execute(lines: String*): Unit = |
75224 | 214 |
progress.bash(("set -e" :: platform_info.build_environment :: lines.toList).mkString("\n"), |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
215 |
cwd = vscodium_dir.file, echo = verbose).check |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
216 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
217 |
execute( |
75217 | 218 |
"git clone -n " + Bash.string(vscodium_repository) + " .", |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
219 |
"git checkout -q " + Bash.string(version), |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
220 |
"./get_repo.sh") |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
221 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
222 |
for (name <- Seq("vscode/build/lib/electron.js", "vscode/build/lib/electron.ts")) { |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
223 |
File.change(vscodium_dir + Path.explode(name), strict = true) { |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
224 |
_.replace("""'resources/darwin/' + icon + '.icns'""", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
225 |
"""'resources/darwin/' + icon.toLowerCase() + '.icns'""") |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
226 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
227 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
228 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
229 |
execute("./build.sh") |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
230 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
231 |
Isabelle_System.copy_file(vscodium_dir + Path.explode("LICENSE"), component_dir) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
232 |
|
75224 | 233 |
val platform_dir = platform_info.platform_dir(component_dir) |
234 |
Isabelle_System.copy_dir(platform_info.build_dir(vscodium_dir), platform_dir) |
|
235 |
platform_info.patch_resources(platform_dir) |
|
236 |
platform_info.setup_executables(platform_dir) |
|
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
237 |
}) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
238 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
239 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
240 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
241 |
/* settings */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
242 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
243 |
val etc_dir = Isabelle_System.make_directory(component_dir + Path.explode("etc")) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
244 |
File.write(etc_dir + Path.basic("settings"), |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
245 |
"""# -*- shell-script -*- :mode=shellscript: |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
246 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
247 |
ISABELLE_VSCODIUM_HOME="$COMPONENT/${ISABELLE_WINDOWS_PLATFORM64:-$ISABELLE_PLATFORM64}" |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
248 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
249 |
case "$ISABELLE_PLATFORM_FAMILY" in |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
250 |
linux) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
251 |
ISABELLE_ELECTRON="$ISABELLE_VSCODIUM_HOME/codium" |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
252 |
;; |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
253 |
macos) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
254 |
ISABELLE_ELECTRON="$ISABELLE_VSCODIUM_HOME/VSCodium.app/Contents/MacOS/Electron" |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
255 |
;; |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
256 |
windows) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
257 |
ISABELLE_ELECTRON="$ISABELLE_VSCODIUM_HOME/VSCodium.exe" |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
258 |
;; |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
259 |
esac |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
260 |
""") |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
261 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
262 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
263 |
/* README */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
264 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
265 |
File.write(component_dir + Path.basic("README"), |
75217 | 266 |
"This is VSCodium " + version + " from " + vscodium_repository + |
75214
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
267 |
""" |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
268 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
269 |
It has been built from sources using "isabelle build_vscodium": this applies |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
270 |
a few changes required for Isabelle/VSCode. |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
271 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
272 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
273 |
Makarius |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
274 |
""" + Date.Format.date(Date.now()) + "\n") |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
275 |
} |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
276 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
277 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
278 |
/* Isabelle tool wrapper */ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
279 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
280 |
val isabelle_tool = |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
281 |
Isabelle_Tool("build_vscodium", "build component for VSCodium", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
282 |
Scala_Project.here, args => |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
283 |
{ |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
284 |
var target_dir = Path.current |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
285 |
var platforms = default_platforms |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
286 |
var verbose = false |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
287 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
288 |
val getopts = Getopts(""" |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
289 |
Usage: vscode_setup [OPTIONS] |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
290 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
291 |
Options are: |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
292 |
-D DIR target directory (default ".") |
75217 | 293 |
-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
|
294 |
-v verbose |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
295 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
296 |
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
|
297 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
298 |
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
|
299 |
for targeting Windows. |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
300 |
""", |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
301 |
"D:" -> (arg => target_dir = Path.explode(arg)), |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
302 |
"p:" -> (arg => platforms = Library.space_explode(',', arg).map(Platform.Family.parse)), |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
303 |
"v" -> (_ => verbose = true)) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
304 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
305 |
val more_args = getopts(args) |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
306 |
if (more_args.nonEmpty) getopts.usage() |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
307 |
|
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
308 |
val progress = new Console_Progress() |
a51a0a704854
build component for VSCodium (cross-compiled from sources for all platforms);
wenzelm
parents:
diff
changeset
|
309 |
|
75217 | 310 |
build_vscodium(target_dir = target_dir, platforms = platforms, |
311 |
verbose = verbose, progress = progress) |
|
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 |
} |