forked from ThomasLebrun/XForms-Toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.ps1
62 lines (49 loc) · 1.77 KB
/
default.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
properties {
$projects = $null
$configuration = "Release"
$source_folder = $null
$solution = $null
$build_meta = $null
$preRelease = $null
}
Task Default -Depends Build
Task RestorePackages {
Exec { nuget restore $solution -PackagesDirectory .\packages }
}
Task Publish -Depends Package {
$version = getVersionBase
exec { & ".\.nuget\Push All.ps1"}
}
Task Package {
$version = getVersionBase
exec { & ".\.nuget\Build All.ps1" "-version $version -preRelease $preRelease"}
}
Task Test -Depends Build {
# Get-ChildItem $source_folder -Recurse -Include *Tests.csproj | % {
# Exec { & ".\packages\xunit.runner.console.2.0.0\tools\xunit.console.exe" "$($_.DirectoryName)\bin\$configuration\$($_.BaseName).dll" }
# }
}
Task Build -Depends Clean,Set-Versions,RestorePackages {
Exec { msbuild "$solution" /t:Build /p:Configuration=$configuration }
}
Task Clean {
Exec { msbuild "$solution" /t:Clean /p:Configuration=$configuration }
exec { & ".\.nuget\Clean All.ps1"}
}
Task Set-Versions {
$version = getVersionBase
if ($build_meta) {
"##teamcity[buildNumber '$version+$build_meta']" | Write-Host
} else {
"##teamcity[buildNumber '$version']" | Write-Host
}
Get-ChildItem -Recurse -Force | Where-Object { $_.Name -eq "AssemblyInfo.cs" } | ForEach-Object {
(Get-Content $_.FullName) | ForEach-Object {
($_ -replace 'AssemblyVersion\(.*\)', ('AssemblyVersion("' + $version + '")')) -replace 'AssemblyFileVersion\(.*\)', ('AssemblyFileVersion("' + $version + '")')
} | Set-Content $_.FullName -Encoding UTF8
}
}
function getVersionBase {
$versionInfo = (Get-Content "version.json") -join "`n" | ConvertFrom-Json
"$($versionInfo.major).$($versionInfo.minor).$($versionInfo.patch)";
}