-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.ps1
More file actions
74 lines (56 loc) · 2.51 KB
/
build.ps1
File metadata and controls
74 lines (56 loc) · 2.51 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
<#
.SYNOPSIS
Starts the build process for AppCore.Data.
.Description
This script invokes PSake passing it the build definition file located in the 'build' directory.
It also handles constructing the parameters in a much nicer way than PSake takes them by default.
.EXAMPLE
.\build
You can just call the build script and this will excute with all the defaults.
.EXAMPLE
.\build UnitTest ci
In this example you could execute the unit tests as the CI server would.
.EXAMPLE
.\build -buildEnvironment "local" -buildNumber "1.2.3.43433"
If you don't want to specify the parameters in order you reference them explicitly like this.
.EXAMPLE
.\build ?
This will print out a list of all the available tasks that you can execute
.PARAMETER task
Used to tell PSake which build task it should execute, this parameter is defaulted to the default task.
.PARAMETER buildEnvironment
Used to define which build environment you want to run under. These options are defined in the .\build\environments folder, currently it is limited to [local, ci, dev] with the default being local.
.PARAMETER buildNumber
Used to version the package and assemblies.
.PARAMETER informationalVersion
Used to give a version string to the package and assemblies.
.LINK
https://github.com/psake/psake
.LINK
https://github.com/psake/psake/wiki
.LINK
http://codebetter.com/jameskovacs/2010/04/12/psake-v4-00/
#>
param(
[Parameter(Position = 0, Mandatory = 0)][string] $task = "Default",
[Parameter(Position = 1, Mandatory = 0)][string] $buildEnvironment = "local",
[Parameter(Position = 2, Mandatory = 0)][string] $buildNumber = "0.1.1.1",
[Parameter(Position = 3, Mandatory = 0)][string] $informationalVersion = "Developer Build"
)
$buildNumberParts = $buildNumber.split('.')
if ($buildNumberParts.length -ne 4) {
Write-Host "Incorrectly formated Build Number, it must be formated {X.X.X.X}"
exit 1
}
$versionNumber = $buildNumberParts[0] + '.' + $buildNumberParts[1] + '.' + $buildNumberParts[2]
$buildNumber = $buildNumberParts[3]
$informationalText = $versionNumber + ' ' + $informationalVersion
& ".\packages\psake.4.6.0\tools\psake.ps1" .\build\Build.ps1 $task -parameters @{
env=$buildEnvironment;
version=$versionNumber;
buildNumber=$buildNumber;
informationalVersion=$informationalText;
}
if ($psake.build_success -eq $false) {
exit 1
}