forked from splitio/.net-core-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sonar-scanner.bat
46 lines (44 loc) · 1.55 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
@echo off
setlocal EnableDelayedExpansion
GOTO :main
:sonar_scanner
SonarScanner.MSBuild.exe begin ^
/n:".net-core-client" ^
/k:"net-core-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.links.ci="https://travis-ci.com/splitio/.net-core-client" ^
/d:sonar.links.scm="https://github.com/splitio/.net-core-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/.net-core-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%"=="master" (
echo "Master branch."
CALL :sonar_scanner ^
"/d:sonar.branch.name="%APPVEYOR_REPO_BRANCH%""
) ELSE (
IF "%APPVEYOR_REPO_BRANCH%"=="development" (
echo "Development branch."
SET "TARGET_BRANCH=master"
) 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!""
)
)