forked from jonwagner/Insight.Database
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.psake.ps1
66 lines (51 loc) · 1.73 KB
/
Build.psake.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.use_exit_on_error = $true
#########################################
# to build a new version
# 1. git tag 1.0.x
# 2. build package
#########################################
exec { & $env:VS150COMNTOOLS\vsmsbuildcmd.bat }
properties {
$baseDir = $psake.build_script_dir
$outputDir = "$baseDir\Build\Output"
$configuration = 'Release'
$nunit = "$($env:USERPROFILE)\.nuget\packages\nunit.consolerunner\3.6.1\tools\nunit3-console.exe"
}
Task default -depends Build
function Wipe-Folder {
param (
[string] $Path
)
if (Test-Path $Path) {
Remove-Item $Path -Recurse -Force -ErrorAction SilentlyContinue
}
[System.IO.Directory]::CreateDirectory($Path) | Out-Null
}
Task Clean {
exec { dotnet clean -c $configuration Insight.sln }
}
Task Restore {
exec { dotnet restore Insight.sln }
}
Task Build -depends Restore {
exec { dotnet build -c $configuration Insight.sln }
}
Task BuildQuick {
exec { dotnet build -c $configuration Insight.Database\Insight.Database.csproj -f netstandard2.0 }
}
Task Test -depends Build, TestOnly {
}
Task TestOnly {
Get-ChildItem $baseDir\Insight.Tests*\*.csproj | % { exec { dotnet test $_ -c $configuration --no-build } }
}
Task TestQuick {
Get-ChildItem Insight.Tests\Insight.Tests.csproj | % { exec { dotnet test $_ -c $configuration -f netcoreapp2.0 } }
}
Task PackageOnly {
Wipe-Folder $outputDir
Get-ChildItem $baseDir\Insight.Database*\**\**\*.nupkg | Remove-Item
Get-ChildItem $baseDir\Insight.Database*\*.csproj | % { exec { dotnet pack $_ -c $configuration --no-build } }
Get-ChildItem $baseDir\Insight.Database*\**\**\*.nupkg | Copy-Item -Destination $outputDir
}
Task Package -depends Clean, Build, Test, PackageOnly {
}