-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
39 lines (33 loc) · 1.42 KB
/
Copy pathbuild.ps1
File metadata and controls
39 lines (33 loc) · 1.42 KB
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
[CmdletBinding(PositionalBinding=$false)]
param(
[bool] $CreatePackages = $false,
[bool] $RunTests = $true
)
Write-Host "Run Parameters:" -ForegroundColor Cyan
Write-Host " CreatePackages: $CreatePackages"
Write-Host " RunTests: $RunTests"
$packageOutputFolder = "$PSScriptRoot\.nupkgs"
$projectFile = ".\Dapper.Apex\Dapper.Apex.csproj";
$testProjectFile = ".\Dapper.Apex.Test\Dapper.Apex.Test.csproj";
Write-Host "Building Dapper.Apex..." -ForegroundColor Yellow
dotnet build $projectFile -c Release /p:CI=true
Write-Host "Done building." -ForegroundColor Green
if ($RunTests) {
Write-Host "Running tests: Dapper.Apex.Test" -ForegroundColor Yellow
dotnet build $testProjectFile -c Release /p:CI=true
dotnet test $testProjectFile -c Release --no-build
if ($LastExitCode -ne 0) {
Write-Host "Error with tests, aborting..." -Foreground Red
Exit 1
}
Write-Host "Tests passed!" -ForegroundColor Green
}
if ($CreatePackages) {
New-Item -ItemType Directory -Path $packageOutputFolder -Force | Out-Null
Write-Host "Clearing existing $packageOutputFolder..." -NoNewline
Get-ChildItem $packageOutputFolder | Remove-Item
Write-Host "done." -ForegroundColor Green
Write-Host "Building Dappe.Apex package..." -ForegroundColor Yellow
dotnet pack $projectFile --no-build -c Release /p:PackageOutputPath=$packageOutputFolder /p:CI=true
}
Write-Host "Build Complete." -ForegroundColor Green