--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/Tools/electron Mon Mar 14 16:03:15 2022 +0100
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+#
+# Author: Makarius
+#
+# DESCRIPTION: run the Electron framework (with its own command-line arguments)
+
+exec "$ISABELLE_VSCODIUM_HOME/electron" "$@"
--- a/lib/Tools/vscode Fri Mar 11 09:23:05 2022 +0100
+++ b/lib/Tools/vscode Mon Mar 14 16:03:15 2022 +0100
@@ -6,8 +6,9 @@
isabelle vscode_setup || exit "$?"
-exec "$ISABELLE_VSCODIUM_HOME/vscodium" \
- --locale en-US \
+ELECTRON_RUN_AS_NODE=1 "$ISABELLE_VSCODIUM_HOME/electron" \
+ "$(platform_path "$ISABELLE_VSCODIUM_HOME/resources/vscodium/out/cli.js")" \
+ --ms-enable-electron-run-as-node --locale en-US \
--user-data-dir "$(platform_path "$ISABELLE_VSCODE_SETTINGS"/user-data)" \
--extensions-dir "$(platform_path "$ISABELLE_VSCODE_SETTINGS"/extensions)" \
"$@"
--- a/src/Tools/VSCode/extension/src/symbol.ts Fri Mar 11 09:23:05 2022 +0100
+++ b/src/Tools/VSCode/extension/src/symbol.ts Mon Mar 14 16:03:15 2022 +0100
@@ -81,7 +81,7 @@
{
const vscodium_home = library.getenv("ISABELLE_VSCODIUM_HOME")
if (vscodium_home) {
- const path = vscodium_home + "/resources/app/out/vs/base/browser/ui/fonts/symbols.json"
+ const path = vscodium_home + "/resources/vscodium/out/vs/base/browser/ui/fonts/symbols.json"
return file.read_json_sync(file.platform_path(path))
}
else { return [] }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/VSCode/patches/cli.patch Mon Mar 14 16:03:15 2022 +0100
@@ -0,0 +1,33 @@
+diff --git a/src/vs/code/node/cli.ts b/src/vs/code/node/cli.ts
+--- a/src/vs/code/node/cli.ts
++++ b/src/vs/code/node/cli.ts
+@@ -24,6 +24,7 @@ import product from 'vs/platform/product/common/product';
+ import { CancellationTokenSource } from 'vs/base/common/cancellation';
+ import { randomPath } from 'vs/base/common/extpath';
+ import { Utils } from 'vs/platform/profiling/common/profiling';
++import * as path from 'path';
+
+ function shouldSpawnCliProcess(argv: NativeParsedArgs): boolean {
+ return !!argv['install-source']
+@@ -363,9 +364,11 @@ export async function main(argv: string[]): Promise<any> {
+ }
+
+ let child: ChildProcess;
++ const app_arg = '--app=' + path.join(path.dirname(process.execPath), 'resources', 'vscodium');
++ const electron_args = [app_arg].concat(argv.slice(2));
+ if (!isMacOSBigSurOrNewer) {
+ // We spawn process.execPath directly
+- child = spawn(process.execPath, argv.slice(2), options);
++ child = spawn(process.execPath, electron_args, options);
+ } else {
+ // On Big Sur, we spawn using the open command to obtain behavior
+ // similar to if the app was launched from the dock
+@@ -425,7 +428,7 @@ export async function main(argv: string[]): Promise<any> {
+ }
+ }
+
+- spawnArgs.push('--args', ...argv.slice(2)); // pass on our arguments
++ spawnArgs.push('--args', ...electron_args); // pass on our arguments
+
+ if (env['VSCODE_DEV']) {
+ // If we're in development mode, replace the . arg with the
--- a/src/Tools/VSCode/src/build_vscodium.scala Fri Mar 11 09:23:05 2022 +0100
+++ b/src/Tools/VSCode/src/build_vscodium.scala Mon Mar 14 16:03:15 2022 +0100
@@ -140,7 +140,7 @@
// explicit patches
{
val patches_dir = Path.explode("$ISABELLE_VSCODE_HOME/patches")
- for (name <- Seq("isabelle_encoding", "no_ocaml_icons")) {
+ for (name <- Seq("cli", "isabelle_encoding", "no_ocaml_icons")) {
val path = patches_dir + Path.explode(name).patch
Isabelle_System.bash("patch -p1 < " + File.bash_path(path), cwd = dir.file).check
}
@@ -152,27 +152,40 @@
def patch_resources(base_dir: Path): String =
{
- val dir = base_dir + Path.explode("resources")
- Isabelle_System.with_copy_dir(dir, dir.orig) {
- val fonts_dir = dir + Path.explode("app/out/vs/base/browser/ui/fonts")
- HTML.init_fonts(fonts_dir.dir)
- make_symbols().write(fonts_dir)
+ val resources = Path.explode("resources")
+ val dir = base_dir + resources
+ val patch =
+ Isabelle_System.with_copy_dir(dir, dir.orig) {
+ val fonts_dir = dir + Path.explode("app/out/vs/base/browser/ui/fonts")
+ HTML.init_fonts(fonts_dir.dir)
+ make_symbols().write(fonts_dir)
- val workbench_css = dir + Path.explode("app/out/vs/workbench/workbench.desktop.main.css")
- val checksum1 = file_checksum(workbench_css)
- File.append(workbench_css, "\n\n" + HTML.fonts_css_dir(prefix = "../base/browser/ui"))
- val checksum2 = file_checksum(workbench_css)
+ val workbench_css = dir + Path.explode("app/out/vs/workbench/workbench.desktop.main.css")
+ val checksum1 = file_checksum(workbench_css)
+ File.append(workbench_css, "\n\n" + HTML.fonts_css_dir(prefix = "../base/browser/ui"))
+ val checksum2 = file_checksum(workbench_css)
- val file_name = workbench_css.file_name
- File.change_lines(dir + Path.explode("app/product.json")) { _.map(line =>
- if (line.containsSlice(file_name) && line.contains(checksum1)) {
- line.replace(checksum1, checksum2)
+ val file_name = workbench_css.file_name
+ File.change_lines(dir + Path.explode("app/product.json")) { _.map(line =>
+ if (line.containsSlice(file_name) && line.contains(checksum1)) {
+ line.replace(checksum1, checksum2)
+ }
+ else line)
}
- else line)
+
+ Isabelle_System.make_patch(dir.dir, dir.orig.base, dir.base)
}
- Isabelle_System.make_patch(dir.dir, dir.orig.base, dir.base)
+ val app_dir = dir + Path.explode("app")
+ val vscodium_app_dir = dir + Path.explode("vscodium")
+ Isabelle_System.move_file(app_dir, vscodium_app_dir)
+
+ Isabelle_System.make_directory(app_dir)
+ if ((vscodium_app_dir + resources).is_dir) {
+ Isabelle_System.copy_dir(vscodium_app_dir + resources, app_dir)
}
+
+ patch
}
def init_resources(base_dir: Path): Path =
@@ -219,16 +232,6 @@
{
Isabelle_System.rm_tree(dir + Path.explode("bin"))
- val exe = dir + Path.explode("vscodium")
- File.write(exe, """#!/usr/bin/env bash
-
-unset CDPATH
-THIS="$(cd "$(dirname "$0")"; pwd -P)"
-
-ELECTRON_RUN_AS_NODE=1 "$THIS/electron" "$THIS/resources/app/out/cli.js" --ms-enable-electron-run-as-node "$@"
-""")
- File.set_executable(exe, true)
-
if (platform == Platform.Family.windows) {
val files =
File.find_files(dir.file, pred = file =>
@@ -388,6 +391,10 @@
val resources_patch = platform_info.patch_resources(platform_dir)
if (platform_info.is_linux) write_patch("03-isabelle_resources", resources_patch)
+ Isabelle_System.copy_file(
+ build_dir + Path.explode("vscode/node_modules/electron/dist/resources/default_app.asar"),
+ platform_dir + Path.explode("resources"))
+
platform_info.setup_executables(platform_dir)
})
}