Skip to content
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

[GradleV2] Add spotbugs plugin inputs to Gradle task #14625

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@
"loc.input.label.checkstyleAnalysisEnabled": "Run Checkstyle",
"loc.input.help.checkstyleAnalysisEnabled": "Run the Checkstyle tool with the default Sun checks. Results are uploaded as build artifacts.",
"loc.input.label.findbugsAnalysisEnabled": "Run FindBugs",
"loc.input.help.findbugsAnalysisEnabled": "Use the FindBugs static analysis tool to look for bugs in the code. Results are uploaded as build artifacts.",
"loc.input.help.findbugsAnalysisEnabled": "Use the FindBugs static analysis tool to look for bugs in the code. Results are uploaded as build artifacts. In Gradle 6.0 this plugin was removed. Use spotbugs plugin instead. [More info](https://docs.gradle.org/current/userguide/upgrading_version_5.html#the_findbugs_plugin_has_been_removed)",
"loc.input.label.pmdAnalysisEnabled": "Run PMD",
"loc.input.help.pmdAnalysisEnabled": "Use the PMD Java static analysis tool to look for bugs in the code. Results are uploaded as build artifacts.",
"loc.input.label.spotBugsAnalysisEnabled": "Run SpotBugs",
"loc.input.help.spotBugsAnalysisEnabled": "Enable this option to run spotBugs. This plugin works with Gradle v5.6 or later. [More info](https://spotbugs.readthedocs.io/en/stable/gradle.html#use-spotbugs-gradle-plugin)",
"loc.input.label.spotBugsGradlePluginVersionChoice": "Spotbugs plugin version",
"loc.input.help.spotBugsGradlePluginVersionChoice": "The Spotbugs Gradle plugin version to use. You can declare it in your Gradle configuration file, or specify a version here.",
"loc.input.label.spotbugsGradlePluginVersion": "Version number",
"loc.input.help.spotbugsGradlePluginVersion": "Refer to https://plugins.gradle.org/plugin/com.github.spotbugs for all available versions.",
"loc.messages.sqCommon_CreateTaskReport_MissingField": "Failed to create TaskReport object. Missing field: %s",
"loc.messages.sqCommon_WaitingForAnalysis": "Waiting for the SonarQube server to analyse the build.",
"loc.messages.sqCommon_NotWaitingForAnalysis": "Build not configured to wait for the SonarQube analysis. Detailed quality gate status will not be available.",
Expand Down
4 changes: 3 additions & 1 deletion Tasks/GradleV2/gradletask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { BuildOutput, BuildEngine } from 'azure-pipelines-tasks-codeanalysis-com
import { PmdTool } from 'azure-pipelines-tasks-codeanalysis-common/Common/PmdTool';
import { CheckstyleTool } from 'azure-pipelines-tasks-codeanalysis-common/Common/CheckstyleTool';
import { FindbugsTool } from 'azure-pipelines-tasks-codeanalysis-common/Common/FindbugsTool';
import { SpotbugsTool } from 'azure-pipelines-tasks-codeanalysis-common/Common/SpotbugsTool';
import { CodeCoverageEnablerFactory } from 'azure-pipelines-tasks-codecoverage-tools/codecoveragefactory';
import { ICodeCoverageEnabler } from 'azure-pipelines-tasks-codecoverage-tools/codecoverageenabler';
import ccUtil = require('azure-pipelines-tasks-codecoverage-tools/codecoverageutilities');
Expand Down Expand Up @@ -262,7 +263,8 @@ async function run() {
let codeAnalysisOrchestrator: CodeAnalysisOrchestrator = new CodeAnalysisOrchestrator(
[new CheckstyleTool(buildOutput, 'checkstyleAnalysisEnabled'),
new FindbugsTool(buildOutput, 'findbugsAnalysisEnabled'),
new PmdTool(buildOutput, 'pmdAnalysisEnabled')]);
new PmdTool(buildOutput, 'pmdAnalysisEnabled'),
new SpotbugsTool(buildOutput, "spotBugsAnalysisEnabled")]);

// Enable SonarQube Analysis (if desired)
let isSonarQubeEnabled: boolean = tl.getBoolInput('sqAnalysisEnabled', false);
Expand Down
2 changes: 1 addition & 1 deletion Tasks/GradleV2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"azure-pipelines-task-lib": "^3.0.6-preview.0",
"azure-pipelines-tasks-codecoverage-tools": "2.0.2",
"azure-pipelines-tasks-java-common": "2.0.0-preview.0",
"azure-pipelines-tasks-codeanalysis-common": "2.0.0-preview.0"
"azure-pipelines-tasks-codeanalysis-common": "2.0.2"
},
"devDependencies": {
"typescript": "4.0.2"
Expand Down
43 changes: 41 additions & 2 deletions Tasks/GradleV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 185,
"Minor": 186,
"Patch": 0
},
"releaseNotes": "Configuration of the SonarQube analysis was moved to the [SonarQube](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube) or [SonarCloud](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud) extensions, in task `Prepare Analysis Configuration`",
Expand Down Expand Up @@ -322,7 +322,7 @@
"required": false,
"defaultValue": "false",
"groupName": "CodeAnalysis",
"helpMarkDown": "Use the FindBugs static analysis tool to look for bugs in the code. Results are uploaded as build artifacts."
"helpMarkDown": "Use the FindBugs static analysis tool to look for bugs in the code. Results are uploaded as build artifacts. In Gradle 6.0 this plugin was removed. Use spotbugs plugin instead. [More info](https://docs.gradle.org/current/userguide/upgrading_version_5.html#the_findbugs_plugin_has_been_removed)"
},
{
"name": "pmdAnalysisEnabled",
Expand All @@ -335,6 +335,45 @@
"defaultValue": "false",
"groupName": "CodeAnalysis",
"helpMarkDown": "Use the PMD Java static analysis tool to look for bugs in the code. Results are uploaded as build artifacts."
},
{
"name": "spotBugsAnalysisEnabled",
"aliases": [
"spotBugsAnalysis"
],
"type": "boolean",
"label": "Run SpotBugs",
"required": true,
"defaultValue": "false",
"groupName": "CodeAnalysis",
"helpMarkDown": "Enable this option to run spotBugs. This plugin works with Gradle v5.6 or later. [More info](https://spotbugs.readthedocs.io/en/stable/gradle.html#use-spotbugs-gradle-plugin)"
},
{
"name": "spotBugsGradlePluginVersionChoice",
EzzhevNikita marked this conversation as resolved.
Show resolved Hide resolved
"type": "radio",
"label": "Spotbugs plugin version",
"required": true,
"defaultValue": "specify",
"options": {
"specify": "Specify version number",
"build": "Use plugin applied in your build.gradle"
},
"helpMarkDown": "The Spotbugs Gradle plugin version to use. You can declare it in your Gradle configuration file, or specify a version here.",
"groupName": "CodeAnalysis",
"visibleRule": "spotBugsAnalysisEnabled = true"
},
{
"name": "spotbugsGradlePluginVersion",
"aliases": [
"spotbugsGradlePluginVersion"
],
"type": "string",
"label": "Version number",
"required": true,
"defaultValue": "4.7.0",
"helpMarkDown": "Refer to https://plugins.gradle.org/plugin/com.github.spotbugs for all available versions.",
"groupName": "CodeAnalysis",
"visibleRule": "spotBugsAnalysisEnabled = true && spotBugsGradlePluginVersionChoice = specify"
}
],
"instanceNameFormat": "gradlew $(tasks)",
Expand Down
39 changes: 39 additions & 0 deletions Tasks/GradleV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,45 @@
"defaultValue": "false",
"groupName": "CodeAnalysis",
"helpMarkDown": "ms-resource:loc.input.help.pmdAnalysisEnabled"
},
{
"name": "spotBugsAnalysisEnabled",
"aliases": [
"spotBugsAnalysis"
],
"type": "boolean",
"label": "ms-resource:loc.input.label.spotBugsAnalysisEnabled",
"required": true,
"defaultValue": "false",
"groupName": "CodeAnalysis",
"helpMarkDown": "ms-resource:loc.input.help.spotBugsAnalysisEnabled"
},
{
"name": "spotBugsGradlePluginVersionChoice",
"type": "radio",
"label": "ms-resource:loc.input.label.spotBugsGradlePluginVersionChoice",
"required": true,
"defaultValue": "specify",
"options": {
"specify": "Specify version number",
"build": "Use plugin applied in your build.gradle"
},
"helpMarkDown": "ms-resource:loc.input.help.spotBugsGradlePluginVersionChoice",
"groupName": "CodeAnalysis",
"visibleRule": "spotBugsAnalysisEnabled = true"
},
{
"name": "spotbugsGradlePluginVersion",
"aliases": [
"spotbugsGradlePluginVersion"
],
"type": "string",
"label": "ms-resource:loc.input.label.spotbugsGradlePluginVersion",
"required": true,
"defaultValue": "4.7.0",
"helpMarkDown": "ms-resource:loc.input.help.spotbugsGradlePluginVersion",
"groupName": "CodeAnalysis",
"visibleRule": "spotBugsAnalysisEnabled = true && spotBugsGradlePluginVersionChoice = specify"
}
],
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
Expand Down