forked from DapperLib/Dapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
42 lines (37 loc) · 1.13 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
param(
[parameter(Position=0)][string] $PreReleaseSuffix = ''
)
$packageOutputFolder = "$PSScriptRoot\.nupkgs"
# Restore packages and build product
Write-Host "Restoring..." -ForegroundColor "Green"
& dotnet restore -v Minimal # Restore all packages
if ($LASTEXITCODE -ne 0)
{
throw "dotnet restore failed with exit code $LASTEXITCODE"
}
# Build all
Write-Host "Building..." -ForegroundColor "Green"
Get-ChildItem "Dapper*.csproj" -Recurse |
ForEach-Object {
if ($PreReleaseSuffix) {
& dotnet build "$_" --version-suffix "$PreReleaseSuffix"
} else {
& dotnet build "$_"
}
}
# Run tests
Write-Host "Running Tests..." -ForegroundColor "Green"
Get-ChildItem "Dapper.Test*.csproj" -Recurse |
ForEach-Object {
& dotnet test "$_"
}
# Package all
Write-Host "Packaging..." -ForegroundColor "Green"
Get-ChildItem "Dapper*.csproj" -Recurse | Where-Object { $_.Name -NotLike "*.Tests*" } |
ForEach-Object {
if ($PreReleaseSuffix) {
& dotnet pack "$_" -c Release -o "$packageOutputFolder" --version-suffix "$PreReleaseSuffix"
} else {
& dotnet pack "$_" -c Release -o "$packageOutputFolder"
}
}