-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsonar.ps1
33 lines (31 loc) · 980 Bytes
/
sonar.ps1
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
<#
.SYNOPSIS
Initializes or finalizes SonarQube scanner for MSBuild to be executed in between
.EXAMPLE
./sonar.ps1 begin YOUR_SONAR_AUTH_TOKEN 3.1.0.14792
./sonar.ps1 end YOUR_SONAR_AUTH_TOKEN
#>
param(
[Parameter(Mandatory=$true,Position=1)]
[string]$step,
[Parameter(Mandatory=$true,Position=2)]
[string]$sonarLogin,
[Parameter(Mandatory=$false,Position=3)]
[string]$version = 'unknown-version'
)
if ($step -eq 'begin') {
SonarQube.Scanner.MSBuild begin `
/k:MarWac_NUnit_Migrator `
/n:"nunit.migrator" `
/v:"$version" `
/o:"wachulski-github" `
/d:"sonar.host.url=https://sonarqube.com" `
/d:"sonar.login=$sonarLogin" `
/d:"sonar.cs.dotcover.reportsPaths=dotCover.html" `
/d:"sonar.msbuild.testProjectPattern=nunit\.migrator\.tests"
}
elseif ($step -eq 'end') {
SonarQube.Scanner.MSBuild end /d:"sonar.login=$sonarLogin"
} else {
throw "Invalid step provided ($step). Valid are: 'begin', 'end'"
}