From 30be06b8e59e53995ffd41f2ded3df5dce06917e Mon Sep 17 00:00:00 2001 From: "Vladislav Ryzhov (Akvelon INC)" Date: Fri, 19 Mar 2021 12:13:12 +0300 Subject: [PATCH 1/5] Added new inputs in task.json. Changed helpMarkDown for findbugs plugin input. Added spotbugsTool instance to gradletask --- Tasks/GradleV2/gradletask.ts | 4 +++- Tasks/GradleV2/task.json | 43 ++++++++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/Tasks/GradleV2/gradletask.ts b/Tasks/GradleV2/gradletask.ts index 95b827c7495c..dcca992a1515 100644 --- a/Tasks/GradleV2/gradletask.ts +++ b/Tasks/GradleV2/gradletask.ts @@ -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'); @@ -260,7 +261,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); diff --git a/Tasks/GradleV2/task.json b/Tasks/GradleV2/task.json index 540f7dcb92de..7010f65bd2f3 100644 --- a/Tasks/GradleV2/task.json +++ b/Tasks/GradleV2/task.json @@ -16,7 +16,7 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 181, + "Minor": 185, "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`", @@ -309,7 +309,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", @@ -322,6 +322,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", + "type": "radio", + "label": "Spotbugs plugin for Gradle 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": "Spotbugs for Gradle plugin version", + "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)", From 011626578048443f30a61c8076d81296f909c4de Mon Sep 17 00:00:00 2001 From: "Vladislav Ryzhov (Akvelon INC)" Date: Fri, 19 Mar 2021 17:31:12 +0300 Subject: [PATCH 2/5] Updated task.loc.json --- .../resources.resjson/en-US/resources.resjson | 8 +++- Tasks/GradleV2/task.loc.json | 41 ++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson b/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson index a24e95530d07..a8583b0e2d48 100644 --- a/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson @@ -47,9 +47,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 for Gradle 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": "Spotbugs for Gradle plugin version", + "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.", diff --git a/Tasks/GradleV2/task.loc.json b/Tasks/GradleV2/task.loc.json index 0ffbfeb3a5f6..c89730852738 100644 --- a/Tasks/GradleV2/task.loc.json +++ b/Tasks/GradleV2/task.loc.json @@ -16,7 +16,7 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 181, + "Minor": 185, "Patch": 0 }, "releaseNotes": "ms-resource:loc.releaseNotes", @@ -322,6 +322,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", From fdb0b95037e8e21863579b2f03483ac890465edb Mon Sep 17 00:00:00 2001 From: "Vladislav Ryzhov (Akvelon INC)" Date: Mon, 29 Mar 2021 16:23:12 +0300 Subject: [PATCH 3/5] Corrected label for spotbugsGradlePluginVersion input --- .../GradleV2/Strings/resources.resjson/en-US/resources.resjson | 2 +- Tasks/GradleV2/task.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson b/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson index a8583b0e2d48..18db3556b7cb 100644 --- a/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson @@ -52,7 +52,7 @@ "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 for Gradle version", + "loc.input.label.spotBugsGradlePluginVersionChoice": "Spotbugs plugin version for Gradle", "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": "Spotbugs for Gradle plugin version", "loc.input.help.spotbugsGradlePluginVersion": "Refer to https://plugins.gradle.org/plugin/com.github.spotbugs for all available versions.", diff --git a/Tasks/GradleV2/task.json b/Tasks/GradleV2/task.json index 7010f65bd2f3..4804741fa60f 100644 --- a/Tasks/GradleV2/task.json +++ b/Tasks/GradleV2/task.json @@ -355,7 +355,7 @@ "spotbugsGradlePluginVersion" ], "type": "string", - "label": "Spotbugs for Gradle plugin version", + "label": "Spotbugs plugin version for Gradle", "required": true, "defaultValue": "4.7.0", "helpMarkDown": "Refer to https://plugins.gradle.org/plugin/com.github.spotbugs for all available versions.", From 2f164231dae096ff5194410410ca1bb884242910 Mon Sep 17 00:00:00 2001 From: "Vladislav Ryzhov (Akvelon INC)" Date: Fri, 2 Apr 2021 18:14:18 +0300 Subject: [PATCH 4/5] Corrected input labels and npm package version --- .../Strings/resources.resjson/en-US/resources.resjson | 4 ++-- Tasks/GradleV2/package.json | 2 +- Tasks/GradleV2/task.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson b/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson index c9c9c1528003..b71377b426a2 100644 --- a/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson @@ -54,9 +54,9 @@ "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 for Gradle", + "loc.input.label.spotBugsGradlePluginVersionChoice": "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": "Spotbugs for Gradle plugin version", + "loc.input.label.spotbugsGradlePluginVersion": "Spotbugs plugin version", "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.", diff --git a/Tasks/GradleV2/package.json b/Tasks/GradleV2/package.json index 1a828c5d8669..b1c0973ebdcd 100644 --- a/Tasks/GradleV2/package.json +++ b/Tasks/GradleV2/package.json @@ -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" diff --git a/Tasks/GradleV2/task.json b/Tasks/GradleV2/task.json index 0455af695073..055b8293755f 100644 --- a/Tasks/GradleV2/task.json +++ b/Tasks/GradleV2/task.json @@ -351,7 +351,7 @@ { "name": "spotBugsGradlePluginVersionChoice", "type": "radio", - "label": "Spotbugs plugin for Gradle version", + "label": "Plugin version", "required": true, "defaultValue": "specify", "options": { @@ -368,7 +368,7 @@ "spotbugsGradlePluginVersion" ], "type": "string", - "label": "Spotbugs plugin version for Gradle", + "label": "Spotbugs plugin version", "required": true, "defaultValue": "4.7.0", "helpMarkDown": "Refer to https://plugins.gradle.org/plugin/com.github.spotbugs for all available versions.", From f92c8024f6b804757cd600c6219c9c23f6f4b4fd Mon Sep 17 00:00:00 2001 From: "Vladislav Ryzhov (Akvelon INC)" Date: Mon, 5 Apr 2021 18:34:45 +0300 Subject: [PATCH 5/5] Updated task version and changed labels --- .../Strings/resources.resjson/en-US/resources.resjson | 4 ++-- Tasks/GradleV2/task.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson b/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson index b71377b426a2..4e92fbd54b78 100644 --- a/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson @@ -54,9 +54,9 @@ "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": "Plugin version", + "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": "Spotbugs plugin version", + "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.", diff --git a/Tasks/GradleV2/task.json b/Tasks/GradleV2/task.json index 055b8293755f..ac940f7cd378 100644 --- a/Tasks/GradleV2/task.json +++ b/Tasks/GradleV2/task.json @@ -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`", @@ -351,7 +351,7 @@ { "name": "spotBugsGradlePluginVersionChoice", "type": "radio", - "label": "Plugin version", + "label": "Spotbugs plugin version", "required": true, "defaultValue": "specify", "options": { @@ -368,7 +368,7 @@ "spotbugsGradlePluginVersion" ], "type": "string", - "label": "Spotbugs plugin version", + "label": "Version number", "required": true, "defaultValue": "4.7.0", "helpMarkDown": "Refer to https://plugins.gradle.org/plugin/com.github.spotbugs for all available versions.",