- ALM used: Azure DevOps
- CI system used: Azure DevOps
- Languages of the repository: C#, JS, C++
We have repo with 1 C# solution, 1 C++ solution and 1 JS (Angular). We need to build it in single pipeline and push scan results to single project in sonarqube.
For C# i use:
-
task: SonarQubePrepare@5
inputs:
SonarQube: ‘$(SonarQubeServiceConnection)’
scannerMode: ‘MSBuild’
projectKey: ‘$(SonarQubeProjectKey)’
enabled: true -
task: VSBuild@1
displayName: ‘xxx.sln: build’
inputs:
solution: ‘Build/xxx.sln’
configuration: ‘Release’ -
task: SonarQubeAnalyze@5
For JS i use:
-
task: SonarQubePrepare@5
inputs:
SonarQube: ‘$(SonarQubeServiceConnection)’
scannerMode: ‘CLI’
configMode: ‘manual’
cliProjectKey: ‘$(SonarQubeProjectKey)’
cliSources: ‘Source/xxx’ -
task: Npm@1
displayName: ‘xxx: run build’
inputs:
command: custom
workingDir: Source/xxx
verbose: false
customCommand: run build -
task: SonarQubeAnalyze@5
For C++ i use:
-
powershell: |
Invoke-WebRequest -Uri ‘$(sonarQubeUrl)/static/cpp/build-wrapper-win-x86.zip’ -OutFile ‘build- wrapper.zip’
Expand-Archive -Path ‘build-wrapper.zip’ -DestinationPath ‘Build’
displayName: ‘Download Build Wrapper’ -
task: SonarQubePrepare@5
inputs:
SonarQube: ‘$(SonarQubeServiceConnection)’
scannerMode: ‘CLI’
configMode: ‘manual’
cliProjectKey: ‘$(SonarQubeProjectKey)’
extraProperties: ‘sonar.cfamily.build-wrapper-output=Build/bw-output’ -
powershell: >
Build/build-wrapper-win-x86/build-wrapper-win-x86-64.exe --out-dir Build/bw-output
“$(msbuild)” Build\xxx.sln /p:Configuration=Release /p:Platform=x64 /t:Rebuild
displayName: ‘Build xxx.sln’ -
task: SonarQubeAnalyze@5
-
task: SonarQubePublish@5
inputs:
pollingTimeoutSec: ‘300’
If we scan all together, C# code not scanned. Like on the picture below:
But if i disable C++ and JS scan, C# code scanning well.
Is there any way to combine these into 1 analysis, or should I create 2 or 3 projects for each language in SonarQube?