@@ -3,8 +3,8 @@ echo "build: Build started"
3
3
Push-Location $PSScriptRoot
4
4
5
5
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
8
8
}
9
9
10
10
& dotnet restore -- no- cache
@@ -16,34 +16,33 @@ $commitHash = $(git rev-parse --short HEAD)
16
16
$buildSuffix = @ { $true = " $ ( $suffix ) -$ ( $commitHash ) " ; $false = " $ ( $branch ) -$ ( $commitHash ) " }[$suffix -ne " " ]
17
17
18
18
echo " build: Package version suffix is $suffix "
19
- echo " build: Build version suffix is $buildSuffix "
19
+ echo " build: Build version suffix is $buildSuffix "
20
20
21
- foreach ($src in gci src/* ) {
21
+ foreach ($src in ls src/* ) {
22
22
Push-Location $src
23
23
24
24
echo " build: Packaging project in $src "
25
25
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
30
29
} else {
31
- & dotnet pack - c Release -- include - source -- no - build - o ../ .. / artifacts
30
+ & dotnet pack - c Release - o ..\..\ artifacts -- no - build
32
31
}
33
- if ($LASTEXITCODE -ne 0 ) { exit 1 }
32
+ if ($LASTEXITCODE -ne 0 ) { throw " build failed " }
34
33
35
34
Pop-Location
36
35
}
37
36
38
- foreach ($test in gci test/* .Tests) {
37
+ foreach ($test in ls test/* .Tests) {
39
38
Push-Location $test
40
39
41
40
echo " build: Testing project in $test "
42
41
43
42
& dotnet test - c Release
44
- if ($LASTEXITCODE -ne 0 ) { exit 3 }
43
+ if ($LASTEXITCODE -ne 0 ) { throw " tests failed " }
45
44
46
45
Pop-Location
47
46
}
48
47
49
- Pop-Location
48
+ Pop-Location
0 commit comments