/
Build.ps1
101 lines (86 loc) 路 2.67 KB
/
Build.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
Framework "4.6"
$ErrorActionPreference = "Stop"
properties {
$packageSources=$null
$nugetBin = "$PSScriptRoot\bin\nuget\"
$cleanBin = $null
$nugetApiKey = $null
$compile = $true
$dxVersion=$null
$branch=$null
$Release=$null
}
task Release -depends Clean, Init, UpdateProjects, Compile,IndexSources, CreateNuspec, PackNuspec, UpdateReadMe
Task IndexSources{
InvokeScript{
Get-ChildItem "$PSScriptRoot\bin" Xpand.XAF.Modules.*.pdb| Update-XSymbols -SourcesRoot "$PSScriptRoot" -TargetRoot "https://raw.githubusercontent.com/eXpandFramework/DevExpress.XAF/$branch"
}
}
task Init {
InvokeScript{
New-Item "$PSScriptRoot\bin" -ItemType Directory -Force |Out-Null
}
}
task UpdateProjects {
InvokeScript{
& "$PSScriptRoot\tools\build\UpdateProjects.ps1"
}
}
task UpdateReadMe {
InvokeScript{
& "$PSScriptRoot\tools\build\UpdateReadMe.ps1"
}
}
task Compile -precondition {return $compile } {
$source="https://api.nuget.org/v3/index.json;$packageSources"
InvokeScript{
write-host "Building Extensions" -f "Blue"
dotnet restore "$PSScriptRoot\src\Extensions\Extensions.sln" --source $source
dotnet msbuild "$PSScriptRoot\src\Extensions\Extensions.sln" "/p:configuration=Release" /WarnAsError
}
InvokeScript{
write-host "Building Modules" -f "Blue"
dotnet restore "$PSScriptRoot\src\Modules\Modules.sln" --source $source
dotnet msbuild "$PSScriptRoot\src\Modules\Modules.sln" "/p:configuration=Release" /WarnAsError
}
InvokeScript{
write-host "Building Tests" -f "Blue"
dotnet restore "$PSScriptRoot\src\Tests\Tests.sln" --source $source
dotnet msbuild "$PSScriptRoot\src\Tests\Tests.sln" #"/p:OutDir=$PSScriptRoot\bin"
}
}
Task CreateNuspec {
InvokeScript{
$a=@{
Release=$Release
}
& "$PSScriptRoot\tools\build\CreateNuspec.ps1" @a
}
}
Task PackNuspec {
InvokeScript {
& .\tools\build\PackNuspec.ps1 -branch $branch
}
}
task Clean -precondition {return $cleanBin} {
InvokeScript {
$bin="$PSScriptRoot\bin\"
if (Test-Path $bin) {
Get-ChildItem $bin | Remove-Item -Force -Recurse
}
Clear-XProjectDirectories
}
}
task ? -Description "Helper to display task info" {
Write-Documentation
}
function InvokeScript($sb,$maxRetries=0){
try {
exec $sb -maxRetries $maxRetries
}
catch {
Write-Error ($_.Exception | Format-List -Force | Out-String) -ErrorAction Continue
Write-Error ($_.InvocationInfo | Format-List -Force | Out-String) -ErrorAction Continue
exit 1
}
}