clarified directory layout and settings: more robust on all platforms;
authorwenzelm
Mon, 14 Mar 2022 21:56:46 +0100
changeset 75279 9229f2681db7
parent 75278 249fde3aacbf
child 75280 b9dde91f9106
clarified directory layout and settings: more robust on all platforms;
lib/Tools/electron
lib/Tools/vscode
src/Tools/VSCode/extension/src/symbol.ts
src/Tools/VSCode/patches/cli.patch
src/Tools/VSCode/src/build_vscodium.scala
--- a/lib/Tools/electron	Mon Mar 14 16:09:25 2022 +0100
+++ b/lib/Tools/electron	Mon Mar 14 21:56:46 2022 +0100
@@ -4,4 +4,4 @@
 #
 # DESCRIPTION: run the Electron framework (with its own command-line arguments)
 
-exec "$ISABELLE_VSCODIUM_HOME/electron" "$@"
+exec "$ISABELLE_VSCODIUM_ELECTRON" "$@"
--- a/lib/Tools/vscode	Mon Mar 14 16:09:25 2022 +0100
+++ b/lib/Tools/vscode	Mon Mar 14 21:56:46 2022 +0100
@@ -6,8 +6,10 @@
 
 isabelle vscode_setup || exit "$?"
 
-ELECTRON_RUN_AS_NODE=1 "$ISABELLE_VSCODIUM_HOME/electron" \
-  "$(platform_path "$ISABELLE_VSCODIUM_HOME/resources/vscodium/out/cli.js")" \
+export ISABELLE_VSCODIUM_APP="$(platform_path "$ISABELLE_VSCODIUM_RESOURCES/vscodium")"
+
+ELECTRON_RUN_AS_NODE=1 "$ISABELLE_VSCODIUM_ELECTRON" \
+  "$(platform_path "$ISABELLE_VSCODIUM_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	Mon Mar 14 16:09:25 2022 +0100
+++ b/src/Tools/VSCode/extension/src/symbol.ts	Mon Mar 14 21:56:46 2022 +0100
@@ -79,9 +79,9 @@
 
 function load_symbols(): Entry[]
 {
-  const vscodium_home = library.getenv("ISABELLE_VSCODIUM_HOME")
-  if (vscodium_home) {
-    const path = vscodium_home + "/resources/vscodium/out/vs/base/browser/ui/fonts/symbols.json"
+  const vscodium_resources = library.getenv("ISABELLE_VSCODIUM_RESOURCES")
+  if (vscodium_resources) {
+    const path = vscodium_resources + "/vscodium/out/vs/base/browser/ui/fonts/symbols.json"
     return file.read_json_sync(file.platform_path(path))
   }
   else { return [] }
--- a/src/Tools/VSCode/patches/cli.patch	Mon Mar 14 16:09:25 2022 +0100
+++ b/src/Tools/VSCode/patches/cli.patch	Mon Mar 14 21:56:46 2022 +0100
@@ -1,19 +1,11 @@
 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> {
+@@ -363,9 +363,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 app_arg = '--app=' + process.env['ISABELLE_VSCODIUM_APP'];
 +		const electron_args = [app_arg].concat(argv.slice(2));
  		if (!isMacOSBigSurOrNewer) {
  			// We spawn process.execPath directly
@@ -22,7 +14,7 @@
  		} 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> {
+@@ -425,7 +427,7 @@ export async function main(argv: string[]): Promise<any> {
  				}
  			}
  
--- a/src/Tools/VSCode/src/build_vscodium.scala	Mon Mar 14 16:09:25 2022 +0100
+++ b/src/Tools/VSCode/src/build_vscodium.scala	Mon Mar 14 21:56:46 2022 +0100
@@ -219,13 +219,12 @@
       platform match {
         case Platform.Family.linux | Platform.Family.linux_arm =>
           Isabelle_System.move_file(dir + Path.explode("codium"), dir + electron)
-        case Platform.Family.macos =>
-          Isabelle_System.symlink(Path.explode("VSCodium.app/Contents/MacOS/Electron"), dir + electron)
         case Platform.Family.windows =>
           Isabelle_System.move_file(dir + Path.explode("VSCodium.exe"), dir + electron.exe)
           Isabelle_System.move_file(
             dir + Path.explode("VSCodium.VisualElementsManifest.xml"),
             dir + Path.explode("electron.VisualElementsManifest.xml"))
+        case Platform.Family.macos =>
       }
     }
 
@@ -410,6 +409,14 @@
       """# -*- shell-script -*- :mode=shellscript:
 
 ISABELLE_VSCODIUM_HOME="$COMPONENT/${ISABELLE_WINDOWS_PLATFORM64:-$ISABELLE_PLATFORM64}"
+
+if [ "$ISABELLE_PLATFORM_FAMILY" = "macos" ]; then
+  ISABELLE_VSCODIUM_ELECTRON="$ISABELLE_VSCODIUM_HOME/VSCodium.app/Contents/MacOS/Electron"
+  ISABELLE_VSCODIUM_RESOURCES="$ISABELLE_VSCODIUM_HOME/VSCodium.app/Contents/Resources"
+else
+  ISABELLE_VSCODIUM_ELECTRON="$ISABELLE_VSCODIUM_HOME/electron"
+  ISABELLE_VSCODIUM_RESOURCES="$ISABELLE_VSCODIUM_HOME/resources"
+fi
 """)