-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeployScripts.ps1
More file actions
70 lines (60 loc) · 1.48 KB
/
DeployScripts.ps1
File metadata and controls
70 lines (60 loc) · 1.48 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
param (
[string]$scriptProcessorDir,
[string]$scriptSrc,
[string]$outDir,
[string]$scriptDest
)
function Load-Assembly($filePath) {
while (!(Test-Path $filePath)) {
echo "Waiting for $filePath..."
Start-Sleep 1
}
[Reflection.Assembly]::LoadFile($filePath) | Out-Null
}
function Copy-If-Exists
{
if([System.IO.File]::Exists($args[0])){
Echo "Deploying '$($args[0])'"
copy-item $args[0] -Destination $args[1]
}
}
$retCode = 0
$processingErrors = 0
try
{
Echo ""
Echo "build Dir = $outDir"
Echo "script Src = $scriptSrc"
Echo "script Dest = $scriptDest"
Echo "script Processor Dir = $scriptProcessorDir"
$scriptDirs = Get-ChildItem -Path $scriptSrc -Dir
Load-Assembly "$scriptProcessorDir\ScriptFileProcessor.dll"
foreach ($scriptDir in $scriptDirs) {
Echo ""
Echo "Processing Script Dir: '$($scriptDir)'"
$sp = New-Object ScriptFileProcessor.ScriptProcessor
$script = $sp.BuildEntryPointScript($scriptDir.FullName, $outDir)
Echo ""
if (-Not $script.Success) {
Echo $script.error
$processingErrors++
continue
}
Copy-If-Exists $script.BuiltPath $scriptDest
$config = $script.SourcePath + ".config"
Copy-If-Exists $config "$scriptDest\$($script.BuiltFilename).config"
$icon = $script.SourcePath + ".png"
Copy-If-Exists $icon "$scriptDest\$($script.BuiltFilename).png"
Echo ""
}
}
catch
{
Write-Error $_.Exception.Message
$retCode = 1
}
if ($processingErrors -ne 0)
{
$retCode = 1
}
exit $retCode