1
- $root = " $PSScriptRoot \.."
1
+ $root = ( Resolve-Path " $PSScriptRoot \.." ).Path
2
2
$artifactsDir = " $root \Artifacts"
3
- $nugetOutDir = " $root \Artifacts\NuGet"
4
- $testReportDir = " $root \Artifacts\Logs"
5
- $testCoverageDir = " $root \Artifacts\Coverage"
6
- $nuget = " $root \Tools\NuGet.exe"
3
+ $nugetOutDir = " $artifactsDir \NuGet"
4
+ $logsDir = " $artifactsDir \Logs"
5
+ $testReportDir = " $artifactsDir \TestResults"
6
+ $testCoverageDir = " $artifactsDir \Coverage"
7
+ $toolsDir = " $root \.tools"
8
+
9
+ $nuget = " $toolsDir \NuGet.exe"
7
10
$vswhere = " ${env: ProgramFiles(x86)} \Microsoft Visual Studio\Installer\vswhere.exe"
8
11
$msbuildPath = & $vswhere - latest - products * - requires Microsoft.Component.MSBuild - property installationPath
12
+
9
13
if ($msbuildPath ) {
10
- $msbuild = join-path $msbuildPath ' MSBuild\Current\Bin\MSBuild.exe'
11
14
$msbuildx64 = join-path $msbuildPath ' MSBuild\Current\Bin\amd64\MSBuild.exe'
12
15
}
13
16
@@ -31,13 +34,9 @@ function Update-GeneratedCode {
31
34
function Start-Build ([boolean ] $IncludeNanoFramework = $false ) {
32
35
write-host - foreground blue " Start-Build...`n ---"
33
36
34
- $fileLoggerArg = " /logger:FileLogger,Microsoft.Build;logfile=$testReportDir \UnitsNet.msbuild.log"
37
+ $fileLoggerArg = " /logger:FileLogger,Microsoft.Build;logfile=$logsDir \UnitsNet.msbuild.log"
35
38
36
- $appVeyorLoggerDll = " C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
37
- $appVeyorLoggerNetCoreDll = " C:\Program Files\AppVeyor\BuildAgent\dotnetcore\Appveyor.MSBuildLogger.dll"
38
- $appVeyorLoggerArg = if (Test-Path " $appVeyorLoggerNetCoreDll " ) { " /logger:$appVeyorLoggerNetCoreDll " } else { " " }
39
-
40
- dotnet build -- configuration Release / p:ContinuousIntegrationBuild= true " $root \UnitsNet.sln" $fileLoggerArg $appVeyorLoggerArg
39
+ dotnet build -- configuration Release / p:ContinuousIntegrationBuild= true " $root \UnitsNet.sln" $fileLoggerArg
41
40
if ($lastexitcode -ne 0 ) { exit 1 }
42
41
43
42
if (-not $IncludeNanoFramework )
@@ -47,13 +46,13 @@ function Start-Build([boolean] $IncludeNanoFramework = $false) {
47
46
else
48
47
{
49
48
write-host - foreground green " Build .NET nanoFramework."
50
- $fileLoggerArg = " /logger:FileLogger,Microsoft.Build;logfile=$testReportDir \UnitsNet.NanoFramework.msbuild.log"
51
- $appVeyorLoggerArg = if (Test-Path " $appVeyorLoggerDll " ) { " /logger:$appVeyorLoggerDll " } else { " " }
49
+ $fileLoggerArg = " /logger:FileLogger,Microsoft.Build;logfile=$logsDir \UnitsNet.NanoFramework.msbuild.log"
52
50
53
51
# msbuild does not auto-restore nugets for this project type
54
52
& " $nuget " restore " $root \UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln"
53
+
55
54
# now build
56
- & " $msbuildx64 " " $root \UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" / verbosity:minimal / p:Configuration= Release / p:Platform= " Any CPU" / p:ContinuousIntegrationBuild= true $fileLoggerArg $appVeyorLoggerArg
55
+ & " $msbuildx64 " " $root \UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" / verbosity:minimal / p:Configuration= Release / p:Platform= " Any CPU" / p:ContinuousIntegrationBuild= true $fileLoggerArg
57
56
if ($lastexitcode -ne 0 ) { exit 1 }
58
57
}
59
58
@@ -74,7 +73,6 @@ function Start-Tests {
74
73
write-host - foreground blue " Run tests...`n ---"
75
74
foreach ($projectPath in $projectPaths ) {
76
75
$projectFileNameNoEx = [System.IO.Path ]::GetFileNameWithoutExtension($projectPath )
77
- $reportFile = " $testReportDir \${projectFileNameNoEx} .xunit.xml"
78
76
$coverageReportFile = " $testCoverageDir \${projectFileNameNoEx} .coverage.xml"
79
77
$projectDir = [System.IO.Path ]::GetDirectoryName($projectPath )
80
78
@@ -84,6 +82,8 @@ function Start-Tests {
84
82
# Create coverage report for this test project
85
83
& dotnet dotcover test `
86
84
-- no- build `
85
+ -- logger trx `
86
+ -- results- directory " $testReportDir " `
87
87
-- dotCoverFilters= " +:module=UnitsNet*;-:module=*Tests" `
88
88
-- dotCoverOutput= " $coverageReportFile " `
89
89
-- dcReportType= DetailedXML
@@ -93,7 +93,7 @@ function Start-Tests {
93
93
}
94
94
95
95
# Generate a summarized code coverage report for all test projects
96
- & " Tools /reportgenerator.exe" - reports:" $root /Artifacts/Coverage/ *.coverage.xml" - targetdir:" $root /Artifacts/Coverage " - reporttypes:HtmlSummary
96
+ & " $toolsDir /reportgenerator.exe" - reports:" $testCoverageDir / *.coverage.xml" - targetdir:" $testCoverageDir " - reporttypes:HtmlSummary
97
97
98
98
write-host - foreground blue " Run tests...END`n "
99
99
}
0 commit comments