-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.wl
More file actions
executable file
·129 lines (107 loc) · 3.99 KB
/
Copy pathbuild.wl
File metadata and controls
executable file
·129 lines (107 loc) · 3.99 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/env wolframscript
$appName = "LieACh";
$icon = MemberQ[
Rest@$ScriptCommandLine,
_String?(StringMatchQ["-i" | "--icon"])
];
tAbort[str_] := (Print["ABORTING: ", Style[str, Red, Bold]]; Quit[])
If[$VersionNumber < 12.3, printAbort["Mathematica 12.3 or later required."]]
$dir = Which[
$InputFileName =!= "", DirectoryName[$InputFileName],
$Notebooks, NotebookDirectory[],
True, printAbort["Cannot determine script directory."]
];
If[Not@DirectoryQ[$appName],
printAbort["Application directory not found."]
];
Check[
Quiet[PacletDirectoryAdd[$appName], PacletDirectoryAdd::expobs];
Needs[$appName <> "`"],
printAbort["Cannot add paclet directory and load package."]
];
If[AbsoluteFileName[$appName] =!= Information[PacletObject[$appName], "Location"],
printAbort["Wrong paclet loaded."]
];
ClearAll[generateLogo];
generateLogo[algebra_: LieART`E6, thick_:0.005, opa_:0.8, size_Integer: 128] :=
Module[{delta, eig, roots, grouped, ig, jg, xx, yy, eg, ln, gp, normK, colorFn, d},
delta = List @@@ OrthogonalSimpleRoots[algebra];
eig = Simplify @ ToRadicals @ Eigenvectors[CartanMatrix[algebra]] // Last;
roots = RootSystem[algebra] // OrthogonalBasis // MapApply[List];
grouped = AssociationThread[Range[Length @ delta], delta];
{ig, jg} = FindGraphPartition @ RelationGraph[Dot[Lookup[grouped,
#1], Lookup[grouped, #2]] == 0&, Keys[grouped] ];
xx = Total[eig[[ig]] delta[[ig]]] // N;
yy = Total[eig[[jg]] delta[[jg]]] // N;
xx = Normalize[xx];
yy = yy - Dot[xx, yy] xx;
yy = Normalize[yy];
eg = UndirectedEdge @@@ Select[Subsets[roots, {2}], Dot[{1, -1}.#, {1, -1}.#] == 4&];
ln = MapAt[{#.xx, #.yy} &, Line@*List @@@ eg, {All, 1, All}];
d = Chop @ TransformedRegion[
BoundingRegion[Map[{#.xx, #.yy}&, roots], "MinDisk"],
1.1 # &
];
colorFn[l_] := Max[Norm /@ Identity @@ l];
ln = ReverseSortBy[RegionMeasure]@Select[ln,
And[Not@PossibleZeroQ@Chop@colorFn[#], Not@PossibleZeroQ@RegionMeasure@#]&
];
gp = Map[colorFn, ln];
normK[x_] = 0.001 + 0.998 ((x - Min @ gp) / (Max @ gp - Min @ gp));
Graphics[{
{DropShadowing[{0, 0}, 5], FaceForm[White], d},
Map[{ColorData["Rainbow"][0.05 + 0.75 normK[colorFn @ #1]],
Thickness[thick], Opacity[opa], #1}&, ln]
},
PlotRangePadding -> Scaled[.05],
ImageSize -> {size, size}
]
];
If[$icon,
MapThread[
Export[
FileNameJoin[{AbsoluteFileName[$appName], "icon", "icon-"<>ToString[#1]<>".svg"}],
generateLogo[E6, #2, #3],
ImageSize -> {#1, #1}
] &,
{{64, 128, 256, 512},
{0.005, 0.004, 0.003, 0.002},
{0.85, 0.8, 0.75, 0.70}}
]
];
date = DateString[{"Year", "Month", "Day"}];
time = DateString[{"Hour24", "Minute", "Second"}];
template = StringTemplate[
Import[FileNameJoin[{$appName, $appName <> ".wl"}], "String"],
Delimiters -> "%%"
];
versionData = <|
"version" -> Information[PacletObject[$appName], "Version"],
"mathversion" -> Information[PacletObject[$appName], "WolframVersion"],
"date" -> DateString[{"MonthName", " ", "DayShort", ", ", "Year"}]
|>;
allSymbols = Join[ Names[$appName <> "`*"], Names["LieART`*"] ];
Unprotect /@ allSymbols;
ClearAll /@ allSymbols;
Remove /@ allSymbols;
Needs["PacletTools`"];
$buildDir = "build";
If[Not@DirectoryQ[$buildDir],
CreateDirectory[$buildDir, CreateIntermediateDirectories -> True]
];
PacletDocumentationBuild[AbsoluteFileName[$appName], $buildDir];
Map[
Block[{newPath, newDir},
newPath = FileNameJoin[{Directory[], $buildDir, FileNameDrop[#, Length@FileNameSplit@Directory[]]}];
newDir = FileNameDrop[newPath, -1];
If[Not@DirectoryQ@newDir,
CreateDirectory[newDir, CreateIntermediateDirectories -> True]
];
Echo[CopyFile[#, newPath, OverwriteTarget -> True], #] ;
] &,
DeleteCases[_?DirectoryQ]@Select[
FileNames["*", AbsoluteFileName[$appName], Infinity],
FreeQ["Documentation" | ".DS_Store"]@*FileNameSplit
]
];
Echo@CreatePacletArchive[FileNameJoin[{Directory[], $buildDir, $appName}], $buildDir];