-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpsakefile.ps1
113 lines (94 loc) · 2.86 KB
/
psakefile.ps1
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
Include ".\build_utils.ps1"
Properties {
$DistDir = (Join-Path $PSScriptRoot "dist")
$SrcRoot = (Join-Path $PSScriptRoot "src")
# By default, produce only SVG diagrams as output
[string[]] $script:OutputFormats = ,"svg"
# PlantUML/Dot diagrams to compile
$DiagramFiles = @{
hc = (
"hc_2h_progression_1.puml",
"hc_2h_progression_ALL.puml",
"hc_2h_progression_ALT.puml",
"hc_sa_progression.puml"
)
kb = (
"kb_progression_1.puml",
"kb_progression_2_tgu.puml",
"kb_progression_3.puml",
"kb_progression_4.puml",
"kb_progression_ALL.puml"
)
mace = (
"mace_progression_ALL.puml",
"mace_progression_sa.puml",
"mace_warrior_subsequence.puml"
)
}
# Files copied directly to Dist
$StaticFiles = @{
hc = (
"2hhc_bootstrap_program.xlsx",
"hc_2h_progression.csv",
"hc_sa_drills.csv")
kb = (
"kb_bootstrap_program.xlsx",
"kb_progression.csv")
mace = (
"mace_progression.csv"
)
}
}
Task default -Depends Quick
Task Quick -Depends Compile `
-Description "Build only SVG files for quick updates."
Task Full -Depends Clean, SetReleaseFormats, Compile, CopyStaticFiles `
-Description "Prepare a full release of diagrams and static files"
# Releases include SVG & PNG formats for accessibility
Task SetReleaseFormats `
-Description "Set to the supported image formats for releases." `
{
$script:OutputFormats = "svg", "png"
}
Task Compile `
-Description "Use PlantUML to produce diagram images." `
-Depends CompileHeavyClub, `
CompileKettlebell, `
CompileMace `
Task CompileHeavyClub { Compile-PumlDiagram -ToolName "hc" }
Task CompileKettlebell { Compile-PumlDiagram -ToolName "kb" }
Task CompileMace { Compile-PumlDiagram -ToolName "mace" }
Task CopyStaticFiles `
-Description "Copy unprocessed files to Dist directory." `
-Depends CopyStaticHeavyClub, `
CopyStaticKettlebell, `
CopyStaticMace
Task CopyStaticHeavyClub { Copy-StaticFiles -ToolName "hc" }
Task CopyStaticKettlebell { Copy-StaticFiles -ToolName "kb" }
Task CopyStaticMace { Copy-StaticFiles -ToolName "mace" }
Task Clean -Description "Remove all files in Dist." {
Remove-Item -Path (Join-Path $DistDir "*")
}
function Compile-PumlDiagram {
param (
[string] $ToolName
)
$ToolRoot = (Join-Path $SrcRoot $ToolName)
foreach ($SrcFile in $DiagramFiles[$ToolName]) {
Write-Host "Rendering $SrcFile"
Puml -SrcFilePath (Join-Path $ToolRoot $SrcFile) `
-OutputDirPath $DistDir `
-OutputFormatList $script:OutputFormats
}
}
function Copy-StaticFiles {
param (
[string] $ToolName
)
$ToolRoot = (Join-Path $SrcRoot $ToolName)
$FilesToCopy = $StaticFiles[$ToolName]
foreach ($SrcFile in $FilesToCopy) {
Copy-Item -Path (Join-Path $ToolRoot $SrcFile) `
-Destination $DistDir
}
}