forked from sbmako/NServiceBus.MongoDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.ps1
66 lines (48 loc) · 2.5 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
63
64
65
66
# psake script for NServiceBus.MongoDB
#Requires -Version 2.0
Set-StrictMode -Version Latest
Framework "4.0"
FormatTaskName (("-"*25) + "[{0}]" + ("-"*25))
Properties {
$baseDir = resolve-path .\.
$sourceDir = "$baseDir\src"
$companyName = "SharkByte Software Inc."
$projectName = "NServiceBus.MongoDB"
$solutionName = "NServiceBus.MongoDB"
$configurations = @("Debug","Release","DebugContracts")
$projectConfig = $configurations[0]
$allSolution = "$sourceDir\$solutionName.sln"
$unitTestProject = "NServiceBus.MongoDB.Tests"
$nugetExecutable = "$sourceDir\.nuget\nuget.exe"
$nuspecFile = "packaging\nuget\NServiceBus.MongoDB.nuspec"
$nugetOutDir = "packaging\"
$msbuildCommand = "MSBuild.exe"
$msbuildVerbosity = 'minimal'
}
# default task
task default -Depends Build
task All -Depends BuildDebug, BuildRelease, BuildContracts {}
Task BuildDebug { BuildSolution $allSolution '/property:Configuration=Debug' }
Task BuildRelease { BuildSolution $allSolution '/property:Configuration=Release' }
Task BuildContracts { BuildSolution $allSolution '/property:Configuration=DebugContracts' }
task Build -depends BuildDebug {}
task BuildPackage -Depends BuildRelease {
Remove-Item $baseDir\packaging\*.nupkg
exec { & "$nugetExecutable" pack $nuspecFile -OutputDirectory $nugetOutDir }
}
Task CleanSolution { BuildSolution $allSolution -Target Clean }
Task Clean -Depends CleanTestResults, CleanCode, CleanStyleCop
Task CleanTestResults { Remove-Item $sourceDir/../TestResults -Force -Recurse -ErrorAction SilentlyContinue }
Task CleanCode -Depends CleanSolution { Get-ChildItem $sourceDir -Include ('bin', 'obj') -Recurse | Where { !$_.FullName.Contains('dependencies') } | ForEach { try { Remove-Item $_.FullName -Force -Recurse -ErrorAction SilentlyContinue } catch {} } }
Task CleanStyleCop { Get-ChildItem $sourceDir -Include StyleCop.Cache -Recurse -Force | ForEach { Remove-Item $_.FullName -Force } }
Task CleanAll -Depends Clean
#region Helper Functions
function BuildSolution([ValidateScript( { Test-Path $_ -PathType Leaf } )][string]$solutionFile, [string[]] $msbuildArguments = @(), [string] $target = 'Build')
{
$private:commonMsbuildArguments = $solutionFile, "/target:$target", "/verbosity:$msbuildVerbosity", '/maxcpucount', '/nodeReuse:false',
'/fileLogger', '/property:WarningLevel=4;TreatWarningsAsErrors=False'
$arguments = $commonMsbuildArguments + $msbuildArguments
Write-Output "$msbuildCommand $arguments"
Exec { & $msbuildCommand $arguments }
}
#endregion