-
Notifications
You must be signed in to change notification settings - Fork 14
/
default.ps1
49 lines (43 loc) · 1.83 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
properties {
$projectName = "OwinHttpMessageHandler"
$buildNumber = 0
$rootDir = Resolve-Path .\
$buildOutputDir = "$rootDir\build"
$reportsDir = "$buildOutputDir\reports"
$srcDir = "$rootDir\src"
$solutionFilePath = "$srcDir\$projectName.sln"
$assemblyInfoFilePath = "$srcDir\SharedAssemblyInfo.cs"
$ilmerge_path = "$srcDir\packages\ILMerge.2.13.0307\ILMerge.exe"
}
task default -depends UpdateVersion, RunTests, CreateNuGetPackages
task Clean {
Remove-Item $buildOutputDir -Force -Recurse -ErrorAction SilentlyContinue
exec { msbuild /nologo /verbosity:quiet $solutionFilePath /t:Clean }
}
task UpdateVersion {
$version = Get-Version $assemblyInfoFilePath
$oldVersion = New-Object Version $version
$newVersion = New-Object Version ($oldVersion.Major, $oldVersion.Minor, $oldVersion.Build, $buildNumber)
Update-Version $newVersion $assemblyInfoFilePath
}
task Compile -depends Clean {
exec { msbuild /nologo /verbosity:quiet $solutionFilePath /p:Configuration=Release }
}
task RunTests -depends Compile {
$xunitRunner = "$srcDir\packages\xunit.runners.1.9.2\tools\xunit.console.clr4.exe"
gci . -Recurse -Include *Tests.csproj, Tests.*.csproj | % {
$project = $_.BaseName
if(!(Test-Path $reportsDir\xUnit\$project)){
New-Item $reportsDir\xUnit\$project -Type Directory
}
.$xunitRunner "$srcDir\$project\bin\Release\$project.dll" /html "$reportsDir\xUnit\$project\index.html"
}
}
task CreateNuGetPackages -depends Compile {
$versionString = Get-Version $assemblyInfoFilePath
$version = New-Object Version $versionString
$packageVersion = $version.Major.ToString() + "." + $version.Minor.ToString() + "." + $version.Build.ToString() + "-build" + $buildNumber.ToString().PadLeft(5,'0')
gci $srcDir -Recurse -Include *.nuspec | % {
exec { .$srcDir\.nuget\nuget.exe pack $_ -o $buildOutputDir -version $packageVersion }
}
}