-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathrun.ps1
89 lines (71 loc) · 3.26 KB
/
run.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
[CmdletBinding(PositionalBinding=$True)]
Param(
[parameter(Mandatory=$true)]
[string]$ExampleDir
)
###########################################################
# Start - Initialization - Invocation, Logging etc
###########################################################
$VerbosePreference = "SilentlyContinue"
$ErrorActionPreference = "Stop"
$scriptPath = $MyInvocation.MyCommand.Path
$scriptDir = Split-Path $scriptPath
& "$scriptDir\init.ps1"
if(-not $?)
{
throw "Initialization failure."
exit -9999
}
###########################################################
# End - Initialization - Invocation, Logging etc
###########################################################
###########################################################
# 1 - Prepare
###########################################################
Write-SpecialLog "Phase 1 - Prepare - Start - Preparing project configuration for $ExampleDir." (Get-ScriptName) (Get-ScriptLineNumber)
if(-not (Test-Path "$ExampleDir\prepare.ps1"))
{
Write-ErrorLog "$ExampleDir\prepare.ps1 not found." (Get-ScriptName) (Get-ScriptLineNumber)
throw "$ExampleDir\prepare.ps1 not found."
}
& "$ExampleDir\prepare.ps1"
if(-not $?)
{
Write-ErrorLog "Preparation of configuration failed for $ExampleDir." (Get-ScriptName) (Get-ScriptLineNumber)
throw "Preparation of configuration failed for $ExampleDir."
}
Write-SpecialLog "Phase 1 - Preparation - End - Preparation complete for $ExampleDir." (Get-ScriptName) (Get-ScriptLineNumber)
###########################################################
# 2 - Build
###########################################################
Write-SpecialLog "Phase 2 - Build - Start - Building $ExampleDir" (Get-ScriptName) (Get-ScriptLineNumber)
if(-not (Test-Path "$ExampleDir\build.ps1"))
{
Write-ErrorLog "$ExampleDir\build.ps1 not found." (Get-ScriptName) (Get-ScriptLineNumber)
throw "$ExampleDir\build.ps1 not found."
}
& "$ExampleDir\build.ps1"
if(-not $?)
{
Write-ErrorLog "Build failed! Please check if the project built successfully before you can launch examples." (Get-ScriptName) (Get-ScriptLineNumber)
throw "Build failed! Please check if the project built successfully before you can launch examples."
}
Write-SpecialLog "Build complete for $ExampleDir" (Get-ScriptName) (Get-ScriptLineNumber)
###########################################################
# 3 - Execute
###########################################################
Write-SpecialLog "Phase 3 - Execute - Start - Executing the example in $ExampleDir" (Get-ScriptName) (Get-ScriptLineNumber)
if(-not (Test-Path "$ExampleDir\execute.ps1"))
{
Write-ErrorLog "$ExampleDir\execute.ps1 not found." (Get-ScriptName) (Get-ScriptLineNumber)
throw "$ExampleDir\execute.ps1 not found."
}
& "$ExampleDir\execute.ps1"
if(-not $?)
{
Write-ErrorLog "Execute resulted in an error. Please check the error logs for more information." (Get-ScriptName) (Get-ScriptLineNumber)
throw "Execute resulted in an error. Please check the error logs for more information."
}
Write-SpecialLog "Phase 3 - Execute - End - Executed the example in $ExampleDir" (Get-ScriptName) (Get-ScriptLineNumber)
#Finish
Write-SpecialLog "Run Complete! Please use cleanup.bat for deleting all the created resources." (Get-ScriptName) (Get-ScriptLineNumber)