11param (
2- [switch ]$Debug
2+ [switch ]$Debug ,
3+ [switch ]$NoBuild ,
4+ [switch ]$NoReport ,
5+ [switch ]$AppVeyor
36)
47
5- # Run a build to ensure everything is up-to-date
6- If ($Debug ) {
7- .\build.ps1 - Debug - Incremental
8- } Else {
9- .\build.ps1 - Incremental
10- }
8+ If (-not $NoBuild ) {
9+ # Run a build to ensure everything is up-to-date
10+ If ($Debug ) {
11+ .\build.ps1 - Debug - Incremental
12+ } Else {
13+ .\build.ps1 - Incremental
14+ }
1115
12- If (-not $? ) {
13- $host.UI.WriteErrorLine (' Build failed; coverage analysis aborted.' )
14- Exit $LASTEXITCODE
16+ If (-not $? ) {
17+ $host.UI.WriteErrorLine (' Build failed; coverage analysis aborted.' )
18+ Exit $LASTEXITCODE
19+ }
1520}
1621
1722If ($Debug ) {
@@ -39,6 +44,10 @@ If (Test-Path $report_folder) {
3944
4045mkdir $report_folder | Out-Null
4146
47+ If ($AppVeyor ) {
48+ $AppVeyorArg = ' -appveyor'
49+ }
50+
4251& $opencover_console `
4352 - register:user `
4453 - returntargetcode `
@@ -48,7 +57,12 @@ mkdir $report_folder | Out-Null
4857 - excludebyfile:* \* Designer.cs `
4958 - output:" $report_folder \OpenCover.StyleCopAnalyzers.xml" `
5059 - target:" $xunit_runner_console " `
51- - targetargs:" $target_dll -noshadow"
60+ - targetargs:" $target_dll -noshadow $AppVeyorArg "
61+
62+ If ($AppVeyor -and -not $? ) {
63+ $host.UI.WriteErrorLine (' Build failed; coverage analysis aborted.' )
64+ Exit $LASTEXITCODE
65+ }
5266
5367& $opencover_console `
5468 - register:user `
@@ -60,8 +74,14 @@ mkdir $report_folder | Out-Null
6074 - output:" $report_folder \OpenCover.StyleCopAnalyzers.xml" `
6175 - mergebyhash - mergeoutput `
6276 - target:" $xunit_runner_console " `
63- - targetargs:" $target_dll_csharp7 -noshadow"
77+ - targetargs:" $target_dll_csharp7 -noshadow $AppVeyorArg "
6478
65- & $report_generator - targetdir:$report_folder - reports:$report_folder \OpenCover.* .xml
79+ If ($AppVeyor -and -not $? ) {
80+ $host.UI.WriteErrorLine (' Build failed; coverage analysis aborted.' )
81+ Exit $LASTEXITCODE
82+ }
6683
67- $host.UI.WriteLine (" Open $report_folder \index.htm to see code coverage results." )
84+ If (-not $NoReport ) {
85+ & $report_generator - targetdir:$report_folder - reports:$report_folder \OpenCover.* .xml
86+ $host.UI.WriteLine (" Open $report_folder \index.htm to see code coverage results." )
87+ }
0 commit comments