generated from splitio/.net-core-client
-
Notifications
You must be signed in to change notification settings - Fork 4
/
sonar-scanner.bat
50 lines (47 loc) · 1.7 KB
/
sonar-scanner.bat
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
@echo off
SET "JAVA_HOME=C:/Program Files/Java/jdk17"
setlocal EnableDelayedExpansion
GOTO :main
:sonar_scanner
SonarScanner.MSBuild.exe begin ^
/n:"dotnet-client" ^
/k:"dotnet-client" ^
/v:"%APPVEYOR_BUILD_VERSION%" ^
/d:sonar.host.url="https://sonarqube.split-internal.com" ^
/d:sonar.login="%SONAR_LOGIN%" ^
/d:sonar.ws.timeout="300" ^
/d:sonar.cs.opencover.reportsPaths="**\TestResults\*\*.xml" ^
/d:sonar.coverage.exclusions="**-tests.cs" ^
/d:sonar.links.ci="https://ci.appveyor.com/project/SplitDevOps/dotnet-client" ^
/d:sonar.links.scm="https://github.com/splitio/dotnet-client" ^
%*
EXIT /B 0
:main
IF NOT "%APPVEYOR_PULL_REQUEST_NUMBER%"=="" (
echo Pull Request number %APPVEYOR_PULL_REQUEST_NUMBER%
CALL :sonar_scanner ^
"/d:sonar.pullrequest.provider="GitHub"" ^
"/d:sonar.pullrequest.github.repository="splitio/dotnet-client"" ^
"/d:sonar.pullrequest.key="%APPVEYOR_PULL_REQUEST_NUMBER%"" ^
"/d:sonar.pullrequest.branch="%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%"" ^
"/d:sonar.pullrequest.base="%APPVEYOR_REPO_BRANCH%""
) ELSE (
IF "%APPVEYOR_REPO_BRANCH%"=="main" (
echo "Main branch."
CALL :sonar_scanner ^
"/d:sonar.branch.name="%APPVEYOR_REPO_BRANCH%""
) ELSE (
IF "%APPVEYOR_REPO_BRANCH%"=="development" (
echo "Development branch."
SET "TARGET_BRANCH=main"
) ELSE (
echo "Feature branch."
SET "TARGET_BRANCH=development"
)
echo Branch Name is %APPVEYOR_REPO_BRANCH%
echo Target Branch is !TARGET_BRANCH!
CALL :sonar_scanner ^
"/d:sonar.branch.name="%APPVEYOR_REPO_BRANCH%"" ^
"/d:sonar.branch.target="!TARGET_BRANCH!""
)
)