Skip to content

Commit d71fa50

Browse files
authored
Immutable appdata (#445)
* moved all to the bundle, no appdata * version up * fixed dependencies, removed appData references * addData dir * removed depricated * logger fix * deps list * readFileSync * wljs packages paths * qfixes * home * linux test * set -eux * fix * fix * header fixes * removed handler * trailling * qfix nginx * no waiting tunnel * last attempt * rm * readme update * store_config_in_docs * macos-latest
1 parent e37d590 commit d71fa50

31 files changed

+315
-985
lines changed

.github/workflows/container-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: Fetch all dependencies inside Wolfram container
4949
run: |
5050
docker exec -e WOLFRAMSCRIPT_ENTITLEMENTID=${{ secrets.WOLFRAM_LICENSE_ENTITLEMENT_ID }} wolfram \
51-
wolframscript -script ./Scripts/update.wls
51+
wolframscript -script ./Scripts/bundle.wls
5252
5353
- name: Extract Docker metadata
5454
id: meta

.github/workflows/server-windows.yml

Lines changed: 0 additions & 106 deletions
This file was deleted.

.github/workflows/test-update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on: workflow_dispatch
88

99
jobs:
1010
autotest:
11-
runs-on: macos-14
11+
runs-on: macos-latest
1212
env:
1313
WOLFRAM_SYSTEM_ID: MacOSX-ARM
1414
WOLFRAMENGINE_CACHE_KEY: WolframEngine-B

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on: workflow_dispatch
88

99
jobs:
1010
autotest:
11-
runs-on: macos-14
11+
runs-on: macos-latest
1212
env:
1313
WOLFRAM_SYSTEM_ID: MacOSX-ARM
1414
WOLFRAMENGINE_CACHE_KEY: WolframEngine-B

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Temp/
33
__backups/*.wln
44
__ntemp/*.wln
55
__localkernel/*
6+
__shared
67
_settings.wl
78
shipped/*
89
*.DS_STORE

Common/LPM/LPM.wl

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
BeginPackage["JerryI`LPM`"]
22

3-
PacletRepositories::usage = "PacletRepositories[{Github -> \"URL to the repo\", ...}] specify the wolfram packages to be synced via remote url"
4-
Github::usage = "internal name to specify the source of the package"
3+
PacletRepositories::usage = "depricated"
4+
LPMRepositories::usage = "LPMRepositories[{\"Github\" -> \"URL to the repo\", ...}] specify the wolfram packages to be synced via remote url"
5+
LPMLoad::usage = ""
6+
Github::usage = "depricated"
57

68

79
Begin["`Private`"]
810

9-
System`$Env;
10-
electronConfirmed = System`$Env["ElectronCode"] === 1;
11-
12-
JerryI`LPM`Private`Version = 15
1311
pacletDirectoryLoad = PacletDirectoryLoad
1412

1513
urlImport = Import;
@@ -38,6 +36,10 @@ inspectPackages[dir_String, cbk_] := Module[{
3836
] &/@ packages;
3937
]
4038

39+
LPMRepositories = PacletRepositories;
40+
41+
LPMLoad[projectDir_String] := If[FileExistsQ[FileNameJoin[{projectDir, "wl_packages"}] ], Map[pacletDirectoryLoad] @ Map[DirectoryName] @ DeleteDuplicatesBy[FileNames["PacletInfo.wl" | "PacletInfo.m", {#}, {2}], DirectoryName]& @ FileNameJoin[{projectDir, "wl_packages"}], $Failed];
42+
4143
PacletRepositories[list_List, OptionsPattern[]] := Module[{projectDir, strictMode = OptionValue["StrictMode"], info, repos, cache, updated, removed, new, current, updatable, skipUpdates = OptionValue["Passive"], automaticUpdates = OptionValue["AutomaticUpdates"], versionControl, maxVersionDiff = OptionValue["MaxVersionDiff"]},
4244
(* making key-values pairs *)
4345
repos = (#-><|"key"->#|>)&/@list // Association;
@@ -63,6 +65,10 @@ PacletRepositories[list_List, OptionsPattern[]] := Module[{projectDir, strictMod
6365
If[Now - time < OptionValue["UpdateInterval"] || strictMode,
6466
skipUpdates = True;
6567

68+
With[{c = CacheLoad[projectDir]}, If[AssociationQ[c] && !TrueQ[strictMode],
69+
If[Length[Complement[Keys[repos], Keys[c] ] ] > 0, skipUpdates = False];
70+
] ];
71+
6672
];
6773
]
6874
];
@@ -77,7 +83,6 @@ PacletRepositories[list_List, OptionsPattern[]] := Module[{projectDir, strictMod
7783
Echo["LPM >> fetching packages info"];
7884

7985
If[FailureQ[ URLFetch["https://github.com"] ],
80-
If[!electronConfirmed,
8186
Echo["LPM >> ERROR! no connection to github.com!"];
8287

8388
If[!MissingQ[cache],
@@ -89,12 +94,6 @@ PacletRepositories[list_List, OptionsPattern[]] := Module[{projectDir, strictMod
8994
Echo["LPM >> ERROR! no cache found ;()"];
9095
Abort[];
9196
];
92-
,
93-
Echo["LPM >> URLRead or proxy connection failed"];
94-
Echo["@Electron, fetch me libraries"];
95-
96-
Exit[-1];
97-
];
9897
];
9998

10099
(* fetching new information from Github for each repo in the list *)
@@ -132,7 +131,7 @@ PacletRepositories[list_List, OptionsPattern[]] := Module[{projectDir, strictMod
132131
If[automaticUpdates,
133132
updatable = Select[current, CheckUpdates];
134133
,
135-
Echo["LPM >> Automatic updates are suppressed by default since 2.7.6"];
134+
Echo["LPM >> Automatic updates are suppressed by default"];
136135
updatable = <||>;
137136
];
138137

@@ -206,7 +205,7 @@ CheckUpdates[a_Association] := Module[{result},
206205
convertVersion[str_String] := ToExpression[StringReplace[str, "." -> ""]]
207206

208207
(* general function work for both Releases & Branches *)
209-
CheckUpdates[a_Association, Rule[Github, _]] := Module[{package, new, now},
208+
CheckUpdates[a_Association, Rule[Github | "Github", _]] := Module[{package, new, now},
210209
(* fetch any *)
211210
package = FetchInfo[a];
212211
If[!AssociationQ[package], Echo["LPM >> cannot check. Skipping..."]; Return[False, Module]];
@@ -239,7 +238,7 @@ FetchInfo[a_Association] := Module[{result},
239238
]
240239

241240
(* for releases *)
242-
FetchInfo[a_Association, Rule[Github, url_String]] := Module[{new, data},
241+
FetchInfo[a_Association, Rule[Github | "Github", url_String]] := Module[{new, data},
243242
(* extracting from given url *)
244243
new = StringCases[url, RegularExpression[".com\\/(.*).git"]->"$1"]//First // Quiet;
245244
If[!StringQ[new], new = StringCases[url, RegularExpression[".com\\/(.*)"]->"$1"]//First];
@@ -252,15 +251,15 @@ FetchInfo[a_Association, Rule[Github, url_String]] := Module[{new, data},
252251
If[!StringQ[data["zipball_url"]],
253252
Print["Releases are not available. Taking a master branch"];
254253
(* TAKE MASTER Branch *)
255-
Return[FetchInfo[a, Rule[Github, Rule[url, "master"]]]];
254+
Return[FetchInfo[a, Rule["Github", Rule[url, "master"]]]];
256255
];
257256

258257
(* merge new and old data together *)
259258
Join[a, data, <|"git-url"->new|>]
260259
]
261260

262261
(* for branches *)
263-
FetchInfo[a_Association, Rule[Github, Rule[url_String, branch_String]]] :=
262+
FetchInfo[a_Association, Rule[Github | "Github", Rule[url_String, branch_String]]] :=
264263
Module[{new, data},
265264
(* extracting from given url *)
266265
new = StringCases[url, RegularExpression[".com\\/(.*).git"]->"$1"]//First // Quiet;
@@ -290,15 +289,15 @@ Module[{new, data},
290289
InstallPaclet[dir_String][a_Association] := InstallPaclet[dir][a, a["key"]]
291290

292291
(* releases *)
293-
InstallPaclet[dir_String][a_Association, Rule[Github, url_String]] := Module[{dirName, pacletPath},
292+
InstallPaclet[dir_String][a_Association, Rule[Github | "Github", url_String]] := Module[{dirName, pacletPath},
294293
dirName = FileNameJoin[{dir, "wl_packages"}];
295294
If[!FileExistsQ[dirName], CreateDirectory[dirName]];
296295

297296
(* check if there is no data on releases -> *)
298297
If[MissingQ[a["zipball_url"]],
299298
(* TAKE Master branch instead *)
300299
Echo["LPM >> Releases are not available. Taking a master branch"];
301-
Return[InstallPaclet[dir][a, Rule[Github, Rule[url, "master"]]]];
300+
Return[InstallPaclet[dir][a, Rule["Github", Rule[url, "master"]]]];
302301
];
303302

304303
(* make a name from the git url provided *)
@@ -336,7 +335,7 @@ InstallPaclet[dir_String][a_Association, Rule[Github, url_String]] := Module[{di
336335
]
337336

338337
(* for branch *)
339-
InstallPaclet[dir_String][a_Association, Rule[Github, Rule[url_String, branch_String]]] := Module[{dirName, pacletPath},
338+
InstallPaclet[dir_String][a_Association, Rule[Github | "Github", Rule[url_String, branch_String]]] := Module[{dirName, pacletPath},
340339
dirName = FileNameJoin[{dir, "wl_packages"}];
341340
If[!FileExistsQ[dirName], CreateDirectory[dirName]];
342341

@@ -379,11 +378,11 @@ InstallPaclet[dir_String][a_Association, Rule[Github, Rule[url_String, branch_St
379378
RemovePaclet[dir_String][a_Association] := RemovePaclet[dir][a, a["key"]]
380379

381380
(* releases *)
382-
RemovePaclet[dir_String][a_Association, Rule[Github, url_String]] := (
381+
RemovePaclet[dir_String][a_Association, Rule[Github | "Github", url_String]] := (
383382

384383
If[MissingQ[a["zipball_url"]],
385384
Echo["LPM >> Releases are not available. Removing master"];
386-
Return[RemovePaclet[dir][a, Rule[Github, Rule[url, "master"]]]];
385+
Return[RemovePaclet[dir][a, Rule["Github", Rule[url, "master"]]]];
387386
];
388387

389388
dirName = FileNameJoin[{dir, "wl_packages"}];
@@ -402,7 +401,7 @@ RemovePaclet[dir_String][a_Association, Rule[Github, url_String]] := (
402401
)
403402

404403
(* branches *)
405-
RemovePaclet[dir_String][a_Association, Rule[Github, Rule[url_String, branch_String]]] := Module[{dirName, pacletPath},
404+
RemovePaclet[dir_String][a_Association, Rule[Github | "Github", Rule[url_String, branch_String]]] := Module[{dirName, pacletPath},
406405
dirName = FileNameJoin[{dir, "wl_packages"}];
407406
dirName = FileNameJoin[{dirName, StringReplace[a["Name"], "/"->"_"]}];
408407

Components/FakeMenu.wlx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,7 @@ Component[OptionsPattern[]] := With[{
5757
<button data-name="locateExamples" class="block w-full text-black group flex items-center px-1 my-1 py-1 rounded text-sm leading-4 dark:text-gray-400" role="menuitem" tabindex="-1">
5858

5959
Locate Examples
60-
</button>
61-
<button data-name="locateAppData" class="block w-full text-black group flex items-center px-1 my-1 py-1 rounded text-sm leading-4 dark:text-gray-400" role="menuitem" tabindex="-1">
62-
63-
Locate AppData
64-
</button>
65-
<button data-name="checkupdates" class="block w-full text-black group flex items-center px-1 my-1 py-1 rounded text-sm leading-4 dark:text-gray-400" role="menuitem" tabindex="-1">
66-
67-
Check updates
68-
</button>
60+
</button>
6961
</div>
7062

7163
,

Components/FakeMenuBrowser.wlx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ With[{
3535
<button data-name="LocateExamples" class="block w-full text-black group flex items-center px-1 my-1 py-1 rounded text-sm leading-4 dark:text-gray-400" role="menuitem" tabindex="-1">
3636

3737
Locate examples
38-
</button>
39-
<button data-name="CheckUpdates" class="block w-full text-black group flex items-center px-1 my-1 py-1 rounded text-sm leading-4 dark:text-gray-400" role="menuitem" tabindex="-1">
40-
41-
Check updates
42-
</button>
38+
</button>
4339
</div>
4440
,
4541
<div class="py-0 px-2" role="none">

Electron/bundle/log.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2969,14 +2969,6 @@ const term = new xtermExports.Terminal({cursorBlink: true, rows: 13, fontFamily:
29692969

29702970
const logger = document.getElementById('log');
29712971

2972-
const logFile = document.getElementById('log_file');
2973-
logFile.addEventListener('click', () => window.electronAPI.locateLogFile());
2974-
2975-
const reinstall = document.getElementById('reinstall');
2976-
reinstall.addEventListener('click', () => {
2977-
window.electronAPI.reinstall();
2978-
reinstall.remove();
2979-
});
29802972

29812973
// Open the terminal in #terminal-container
29822974
term.open(logger);
@@ -3027,10 +3019,7 @@ debug.addEventListener('click', () => {
30273019

30283020
const info = document.getElementById("modal_info");
30293021

3030-
const installDir = document.getElementById('log_file');
3031-
installDir.addEventListener('click', () => {
3032-
window.electronAPI.locateLogFile();
3033-
});
3022+
30343023

30353024
window.electronAPI.updateInfo((event, info) => {
30363025
document.getElementById("modal_info_state").innerText = info;
@@ -3065,11 +3054,7 @@ window.electronAPI.addPromt((event, id, title) => {
30653054
modal.classList.remove('hidden');
30663055
});
30673056

3068-
const updateBtn = document.getElementById("update_button");
3069-
updateBtn.addEventListener('click', () => {
3070-
window.electronAPI.update();
3071-
updateBtn.remove();
3072-
})
3057+
30733058

30743059

30753060
window.electronAPI.addDialog((event, id, title) => {

Electron/log.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323

2424
<div class="mt-2 w-full flex flex-row text-sm text-gray-500 dark:text-gray-300">
2525
<button id="debug_button" style="-webkit-app-region: no-drag;" class="inline-flex bg-gray-100/50 dark:bg-gray-600/50 text-xs items-center px-4 outline-gray-400 outline-offset-2 ring-1 text-gray-800 ring-inset ring-gray-300 dark:ring-gray-400 hover:outline outline-1 placeholder:text-gray-400 rounded-md dark:text-gray-400">Debug</button>
26-
<button id="update_button" style="-webkit-app-region: no-drag; margin-left:0.5rem;" class="inline-flex bg-gray-100/50 dark:bg-gray-600/50 text-xs items-center px-4 outline-gray-400 outline-offset-2 ring-1 text-gray-800 ring-inset ring-gray-300 dark:ring-gray-400 hover:outline outline-1 placeholder:text-gray-400 rounded-md dark:text-gray-400">Update</button>
27-
<button id="log_file" style="-webkit-app-region: no-drag;" class="ml-auto hover:underline text-blue-600 dark:text-blue-400 visited:text-purple-600" >Installation directory</button>
28-
<button id="reinstall" style="-webkit-app-region: no-drag;" class="ml-auto hover:underline text-blue-600 dark:text-blue-400 visited:text-purple-600" >Reinstall</button>
26+
2927
</div>
3028

3129

0 commit comments

Comments
 (0)