-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.wls
executable file
·53 lines (40 loc) · 1.44 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
Get["FPTools`Versioning`"];
(* gerbils *)
$globalsFile="Globals.wl";
$directory= Directory[];
$packageInfo=VersionInformation[$directory];
$packageName=$packageInfo["name"];
Print["Building ",$packageName, " from: ", $directory];
pacletDirectory = FileNameJoin[{$directory, $packageName}];
(* bump build *)
VersionBumpBuild[$directory];
(* globals *)
Unprotect[{$FPToolsDebug,$FPToolsVersion}];
$FPToolsDebug=False;
$FPToolsVersion=VersionString[$directory,"Build"->True,"Prerelease"->True];
(* create global file *)
gfile=FileNameJoin[{$directory,$packageName,$globalsFile}];
If[FileExistsQ[gfile], DeleteFile[gfile]];
Save[gfile, {$FPToolsDebug, $FPToolsVersion}];
(* 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"]