Skip to content

Instantly share code, notes, and snippets.

@jmecosta
Last active February 13, 2016 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmecosta/32bfc907668256bd7763 to your computer and use it in GitHub Desktop.
Save jmecosta/32bfc907668256bd7763 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<meta-runner name="Cxx MSBuild SonarQube Runner">
<description>Execute Cxx MSBuild SonarQube Runner Wrapper</description>
<settings>
<parameters>
<param name="additionalCommandLineArgs" value="" />
<param name="key" value="" />
<param name="name" value="" />
<param name="solutionName" value="" />
<param name="solutionPath" value="%teamcity.build.checkoutDir%" />
<param name="currentBranch" value="" spec="text description='current branch ex: /d:sonar.branch=branch' label='currentBranch' display='normal'" />
<param name="destinationBranch" value="" spec="text description='destination branch ex: /b:branch' label='destinationBranch' display='normal'" />
<param name="permissionTemplateName" value="" spec="text description='permission template name to apply to branch project during provision ex: /c:permissionname' label='permissionTemplateName' display='normal'" />
<param name="MsbuildRunnerVersion" value="1.1" />
<param name="sonarhost" value="http://localhost:9000" />
<param name="CxxSqMsbuildVersion" value="1.9.2" spec="text description='define the version that is found in the donwnload page' label='CxxSqMsbuildVersion' display='normal'" />
<param name="system.NunitRunnerTaskEnabled" value="true" spec="text description='enables tests' label='test' display='hidden'" />
<param name="system.ProduceCoverage" value="true" spec="text description='enables coverage' label='coverage' display='hidden'" />
<param name="userName" value="" />
<param name="userPassword" value="" spec="password description='pass' label='pass' display='normal'" />
<param name="version" value="work" />
<param name="visualStudioVersion" value="vs15" spec="select description='Visual Studio Version to Use' data_2='vs13' data_1='vs15' display='normal' label='visualStudioVersion'" />
</parameters>
<build-runners>
<runner name="" type="jetbrains_powershell">
<parameters>
<param name="jetbrains_powershell_bitness" value="x64" />
<param name="jetbrains_powershell_errorToError" value="true" />
<param name="jetbrains_powershell_execution" value="PS1" />
<param name="jetbrains_powershell_minVersion" value="4.0" />
<param name="jetbrains_powershell_script_code"><![CDATA[$SQDir = Join-Path ([Environment]::GetFolderPath("CommonApplicationData")) CxxMSBuidSonarQube.%CxxSqMsbuildVersion%
$SQExecutor = Join-Path $SQDir CxxSonarQubeMsbuidRunner.exe
$downloadUrl = "https://github.com/SonarOpenCommunity/sonar-cxx-msbuild-tasks/releases/download/%CxxSqMsbuildVersion%/CxxSonarQubeMsbuidRunner.zip"
Write-Host "Donwload URL : " $downloadUrl
$tempZipFile = "%teamcity.build.checkoutDir%/Cxx.SBuild.SonarQube.Runner.zip"
Write-Host "##teamcity[setParameter name='SQExecutor' value='$SQExecutor']"
If (Test-Path $SQDir){
Write-Host "##teamcity[progressMessage 'Skip Installation: MSBuild Runner Already installed']"
}Else{
Write-Host "##teamcity[progressMessage 'Download Cxx SQ MSBuild Runner']"
(new-object net.webclient).DownloadFile($downloadUrl, $tempZipFile)
#Load the assembly
[System.Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") | Out-Null
#Unzip the file
[System.IO.Compression.ZipFile]::ExtractToDirectory($tempZipFile, $SQDir)
Write-Host "##teamcity[progressMessage 'CxxSQ Installed: Ok']"
}]]></param>
<param name="jetbrains_powershell_script_mode" value="CODE" />
<param name="teamcity.step.mode" value="default" />
</parameters>
</runner>
<runner name="" type="jb.nuget.installer">
<parameters>
<param name="nuget.path" value="?NuGet.CommandLine.DEFAULT.nupkg" />
<param name="nuget.updatePackages.mode" value="perConfig" />
<param name="nuget.use.restore" value="restore" />
<param name="nugetCustomPath" value="?NuGet.CommandLine.DEFAULT.nupkg" />
<param name="nugetPathSelector" value="?NuGet.CommandLine.DEFAULT.nupkg" />
<param name="sln.path" value="%solutionPath%\%solutionName%" />
<param name="teamcity.step.mode" value="default" />
</parameters>
</runner>
<runner name="Run Analysis" type="simpleRunner">
<parameters>
<param name="command.executable" value="%SQExecutor%" />
<param name="command.parameters" value="/x:%visualStudioVersion% /m:%solutionPath%\%solutionName% %currentBranch% %destinationBranch% %permissionTemplateName% /k:%key% /n:%name% /v:%version% /r:%MsbuildRunnerVersion% /p:NunitRunnerTaskEnabled=true /p:ProduceCoverage=true /d:sonar.cs.opencover.reportsPaths=%solutionPath%\*.coverage.xml /d:sonar.cs.nunit.reportsPaths=%solutionPath%\*.unittest.report.xml /d:sonar.host.url=%sonarhost% /d:sonar.fs.opencover.reportsPaths=%solutionPath%\*.coverage.xml /d:sonar.fs.nunit.reportsPaths=%solutionPath%\*.unittest.report.xml /d:sonar.login=%userName% /d:sonar.password=%userPassword% /p:SonarQubeTempPath=%solutionPath%\.sonarqube %additionalCommandLineArgs%" />
<param name="teamcity.build.workingDir" value="%solutionPath%" />
<param name="teamcity.step.mode" value="default" />
</parameters>
</runner>
</build-runners>
<requirements />
</settings>
</meta-runner>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment