-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make SonarQube pick up the Cobertura Code Coverage file #1823
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ var gb = tl.createToolRunner(wrapperScript); | |
|
||
gb.argString(tl.getInput('options', false)); | ||
gb.arg(tl.getDelimitedInput('tasks', ' ', true)); | ||
gb = sqGradle.applyEnabledSonarQubeArguments(gb); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved the SQ logic after the CC logic |
||
|
||
// update JAVA_HOME if user selected specific JDK version or set path manually | ||
var javaHomeSelection = tl.getInput('javaHomeSelection', true); | ||
|
@@ -62,15 +62,19 @@ if (specifiedJavaHome) { | |
var ccTool = tl.getInput('codeCoverageTool'); | ||
var isCodeCoverageOpted = (typeof ccTool != "undefined" && ccTool && ccTool.toLowerCase() != 'none'); | ||
|
||
var summaryFile: string = null; | ||
|
||
if (isCodeCoverageOpted) { | ||
var summaryFile: string = null; | ||
var reportDirectory: string = null; | ||
enableCodeCoverage() | ||
} | ||
else { | ||
tl.debug("Option to enable code coverage was not selected and is being skipped."); | ||
} | ||
|
||
gb = sqGradle.applyEnabledSonarQubeArguments(gb); | ||
gb = sqGradle.applySonarQubeCodeCoverageArguments(gb, isCodeCoverageOpted, ccTool, summaryFile ); | ||
|
||
var publishJUnitResults = tl.getBoolInput('publishJUnitResults'); | ||
var testResultsFiles = tl.getInput('testResultsFiles', true); | ||
|
||
|
@@ -121,7 +125,7 @@ function enableCodeCoverage() { | |
|
||
if (ccTool.toLowerCase() == "jacoco") { | ||
var summaryFileName = "summary.xml"; | ||
|
||
if (isMultiModule) { | ||
var reportingTaskName = "jacocoRootReport"; | ||
} | ||
|
@@ -134,7 +138,7 @@ function enableCodeCoverage() { | |
var reportingTaskName = "cobertura"; | ||
} | ||
|
||
summaryFile = path.join(reportDirectory, summaryFileName); | ||
summaryFile = path.join(reportDirectory, summaryFileName); | ||
var buildFile = path.join(buildRootPath, "build.gradle"); | ||
|
||
tl.rmRF(reportDirectory, true); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
"version": { | ||
"Major": 1, | ||
"Minor": 0, | ||
"Patch": 40 | ||
"Patch": 41 | ||
}, | ||
"demands": [ | ||
"java" | ||
|
@@ -210,7 +210,7 @@ | |
"type": "string", | ||
"label": "SonarQube Project Name", | ||
"required": true, | ||
"helpMarkDown": "The SonarQube project name, i.e. sonar.projectName. If not set, the plugin will select its own default. See: http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Gradle", | ||
"helpMarkDown": "The SonarQube project name, i.e. sonar.projectName.", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated change - the plugin will not set anything by default because the project name, key and version are mandatory. |
||
"groupName": "CodeAnalysis", | ||
"visibleRule": "sqAnalysisEnabled = true" | ||
}, | ||
|
@@ -219,7 +219,7 @@ | |
"type": "string", | ||
"label": "SonarQube Project Key", | ||
"required": true, | ||
"helpMarkDown": "The SonarQube project unique key, i.e. sonar.projectKey. If not set, the plugin will select its own default. See: http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Gradle", | ||
"helpMarkDown": "The SonarQube project unique key, i.e. sonar.projectKey.", | ||
"groupName": "CodeAnalysis", | ||
"visibleRule": "sqAnalysisEnabled = true" | ||
}, | ||
|
@@ -228,7 +228,7 @@ | |
"type": "string", | ||
"label": "SonarQube Project Version", | ||
"required": true, | ||
"helpMarkDown": "The SonarQube project version, i.e. sonar.projectVersion. If not set, the plugin will select its own default. See: http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Gradle", | ||
"helpMarkDown": "The SonarQube project version, i.e. sonar.projectVersion.", | ||
"groupName": "CodeAnalysis", | ||
"visibleRule": "sqAnalysisEnabled = true" | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
"version": { | ||
"Major": 1, | ||
"Minor": 0, | ||
"Patch": 40 | ||
"Patch": 41 | ||
}, | ||
"demands": [ | ||
"java" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small unrelated change - I'm adding the "sonarqube" argument before the -I arg so that all the task arguments are grouped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AshwiniChalla - just as an aside, we found that you can pass init Gradle scripts that contain plugins. This way we didn't have to change the user's gradle.build file.