Skip to content

Commit 0a7892e

Browse files
committed
Update build script
1 parent c7f8654 commit 0a7892e

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

Build.ps1

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ echo "build: Build started"
33
Push-Location $PSScriptRoot
44

55
if(Test-Path .\artifacts) {
6-
echo "build: Cleaning ./artifacts"
7-
Remove-Item ./artifacts -Force -Recurse
6+
echo "build: Cleaning .\artifacts"
7+
Remove-Item .\artifacts -Force -Recurse
88
}
99

1010
& dotnet restore --no-cache
@@ -16,34 +16,33 @@ $commitHash = $(git rev-parse --short HEAD)
1616
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
1717

1818
echo "build: Package version suffix is $suffix"
19-
echo "build: Build version suffix is $buildSuffix"
19+
echo "build: Build version suffix is $buildSuffix"
2020

21-
foreach ($src in gci src/*) {
21+
foreach ($src in ls src/*) {
2222
Push-Location $src
2323

2424
echo "build: Packaging project in $src"
2525

26-
& dotnet build -c Release --version-suffix=$buildSuffix
27-
28-
if($suffix) {
29-
& dotnet pack -c Release --include-source --no-build -o ../../artifacts --version-suffix=$suffix
26+
& dotnet build -c Release --version-suffix=$buildSuffix -p:EnableSourceLink=true
27+
if ($suffix) {
28+
& dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix --no-build
3029
} else {
31-
& dotnet pack -c Release --include-source --no-build -o ../../artifacts
30+
& dotnet pack -c Release -o ..\..\artifacts --no-build
3231
}
33-
if($LASTEXITCODE -ne 0) { exit 1 }
32+
if($LASTEXITCODE -ne 0) { throw "build failed" }
3433

3534
Pop-Location
3635
}
3736

38-
foreach ($test in gci test/*.Tests) {
37+
foreach ($test in ls test/*.Tests) {
3938
Push-Location $test
4039

4140
echo "build: Testing project in $test"
4241

4342
& dotnet test -c Release
44-
if($LASTEXITCODE -ne 0) { exit 3 }
43+
if($LASTEXITCODE -ne 0) { throw "tests failed" }
4544

4645
Pop-Location
4746
}
4847

49-
Pop-Location
48+
Pop-Location

0 commit comments

Comments
 (0)