-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.wls
executable file
·53 lines (41 loc) · 1.45 KB
/
build.wls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env wolframscript
#
# paclet builder
#
(* gerbils *)
$globalsFile="Globals.wl";
$directory = Directory[];
$packageName = VersionInformation[$directory]["name"];
pacletDirectory = FileNameJoin[{$directory, $packageName}];
Print["Building ",$packageName, " from: ", $directory];
(* bump build *)
VersionBumpBuild[$directory];
(* globals *)
Unprotect[{$MonitorUtilitiesDebug,$MonitorUtilitiesVersion}]
$MonitorUtilitiesDebug=False;
$MonitorUtilitiesVersion=VersionString[$directory,"Build"->True];
(* create global file *)
gfile=FileNameJoin[{$directory,$packageName,$globalsFile}];
If[FileExistsQ[gfile], DeleteFile[gfile]];
Save[gfile, {$MonitorUtilitiesDebug, $MonitorUtilitiesVersion}];
(* delete old paclet *)
files = FileNames["*.paclet", $directory];
Print["Found paclets (to be deleted): ", files];
DeleteFile /@ files;
(* build new paclet *)
Print["Building new paclet"];
UpdatePacletFile[pacletDirectory,$directory];
paclet = PackPaclet[pacletDirectory];
Print["New paclet: ", paclet];
paclets = PacletFind[$packageName];
Print["Found the following old paclets (uninstalling): ", Map[ #["Location"]&, paclets]];
Map[ PacletUninstall, paclets ];
(* install new paclet *)
Print["Installing new paclet"]
PacletInstall[paclet, IgnoreVersion -> True];
(* Build wiki docs *)
wikidir=FileNameJoin[{"..",$packageName<>".wiki"}];
If[DirectoryQ[wikidir],
Print["Building wiki at ",wikidir];
BuildWikiDocumentation[wikidir,$packageName]];
Print["Done"]