Skip to content

Commit

Permalink
Support sonarqube-gradle-plugin 2.8 or newer
Browse files Browse the repository at this point in the history
They have changed the SonarPropertyComputer's parameter
from a Map<Project, ActionBroadcast<SonarQubeProperties>>
to a Map<String, ActionBroadcast<SonarQubeProperties>>
  • Loading branch information
timotei committed Oct 8, 2020
1 parent 1864537 commit 997746c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ plugins {
id 'net.researchgate.release' version '2.6.0'
id 'groovy'
}

group = 'com.ullink.gradle'
description 'Uses sonar-scanner-msbuild to do static analysis with Sonarqube.'

dependencies {
compile(
[group: 'de.undercouch', name: 'gradle-download-task', version: '3.4.3'],
[group: 'org.sonarsource.scanner.gradle', name: 'sonarqube-gradle-plugin', version: '2.7']
[group: 'org.sonarsource.scanner.gradle', name: 'sonarqube-gradle-plugin', version: '2.8']
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.gradle.api.tasks.Exec
import org.sonarqube.gradle.ActionBroadcast
import org.sonarqube.gradle.SonarPropertyComputer
import org.sonarqube.gradle.SonarQubeExtension

import org.sonarqube.gradle.SonarQubeProperties
/**
* Uses SonarScanner for MSBuild to run the Sonarqube analysis.
* See https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild
Expand All @@ -29,7 +29,7 @@ class SonarScannerMsbuildPlugin implements Plugin<Project> {
'sonar.working.directory' // is automatically set and cannot be overridden on the command line
]

def actionBroadcast = new ActionBroadcast()
def actionBroadcast = new ActionBroadcast<SonarQubeProperties>()

@Override
void apply(Project project) {
Expand Down Expand Up @@ -95,7 +95,6 @@ class SonarScannerMsbuildPlugin implements Plugin<Project> {
}

private static def buildArgs(Map<String, Object> properties) {

def mandatoryArgs = MANDATORY_ARGS.collect { key, value ->
"/${key}:${properties[value]}"
}
Expand All @@ -110,9 +109,9 @@ class SonarScannerMsbuildPlugin implements Plugin<Project> {
}

private def computeSonarProperties(Project project) {
def actionBradcastMap = [:]
actionBradcastMap.put(project, actionBroadcast)
def propertyComputer = new SonarPropertyComputer(actionBradcastMap, project)
Map<String, ActionBroadcast<SonarQubeProperties>> actionBroadcastMap = [:]
actionBroadcastMap.put(project.getPath(), actionBroadcast)
def propertyComputer = new SonarPropertyComputer(actionBroadcastMap, project)
return propertyComputer.computeSonarProperties()
}
}

0 comments on commit 997746c

Please sign in to comment.