You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by vl...@apache.org on 2020/08/20 21:25:55 UTC

[jmeter] branch master updated: Update org.sonarqube Gradle plugin to 3.0 (from 2.7.1)

This is an automated email from the ASF dual-hosted git repository.

vladimirsitnikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new a0ed3e0  Update org.sonarqube Gradle plugin to 3.0 (from 2.7.1)
a0ed3e0 is described below

commit a0ed3e0e0c205257f25d359e2c7df91847f815c7
Author: Vladimir Sitnikov <si...@gmail.com>
AuthorDate: Fri Aug 21 00:25:38 2020 +0300

    Update org.sonarqube Gradle plugin to 3.0 (from 2.7.1)
---
 build.gradle.kts  | 22 +++++++++++++++++-----
 gradle.properties |  2 +-
 xdocs/changes.xml |  1 +
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/build.gradle.kts b/build.gradle.kts
index 6eb8d38..2bbc5f4 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -187,11 +187,15 @@ sonarqube {
     }
 }
 
-fun SonarQubeProperties.add(name: String, value: String) {
-    properties.getOrPut(name) { mutableSetOf<String>() }
+fun SonarQubeProperties.add(name: String, valueProvider: () -> String) {
+    properties.getOrPut(name) { mutableSetOf<Any>() }
         .also {
             @Suppress("UNCHECKED_CAST")
-            (it as MutableCollection<String>).add(value)
+            (it as MutableCollection<Any>).add(object {
+                // SonarQube calls toString when converting properties to values
+                // (see SonarQubeProperties), so we use that to emulate "lazy properties"
+                override fun toString() = valueProvider()
+            })
         }
 }
 
@@ -238,7 +242,11 @@ if (enableSpotBugs) {
         sonarqube {
             properties {
                 spotBugTasks.configureEach {
-                    add("sonar.java.spotbugs.reportPaths", reports.named("xml").get().destination.toString())
+                    add("sonar.java.spotbugs.reportPaths") {
+                        // Note: report is created with lower-case xml, and then
+                        // the created entry MUST be retrieved as upper-case XML
+                        reports.named("XML").get().destination.toString()
+                    }
                 }
             }
         }
@@ -528,7 +536,11 @@ allprojects {
                     description = "$description (skipped by default, to enable it add -Dspotbugs)"
                 }
                 reports {
-                    create(if (reportsForHumans()) "html" else "xml")
+                    // xml goes for SonarQube, so we always create it just in case
+                    create("xml")
+                    if (reportsForHumans()) {
+                        create("html")
+                    }
                 }
                 enabled = enableSpotBugs
             }
diff --git a/gradle.properties b/gradle.properties
index 30fd04d..7636b6c 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -45,7 +45,7 @@ com.github.vlsi.checksum-dependency.version=1.70
 com.github.vlsi.vlsi-release-plugins.version=1.70
 org.jetbrains.gradle.plugin.idea-ext.version=0.5
 org.nosphere.apache.rat.version=0.5.3
-org.sonarqube.version=2.7.1
+org.sonarqube.version=3.0
 
 # Dependencies
 accessors-smart.version=1.2
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index 9f573ac..0efdc28 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -135,6 +135,7 @@ applications when JMeter is starting up.</p>
     <li><pr>612</pr>Correct typos in <code>README.me</code>. Based on patches by Pooja Chandak (poojachandak002 at gmail.com)</li>
     <li><pr>613</pr>Add documentation for Darklaf properties. Jannis Weis</li>
     <li>Update SpotBugs to 4.1.2 (from 4.1.1), upgrade spotbugs-gradle-plugin to 4.5.0 (from 2.0.0)</li>
+    <li>Update org.sonarqube Gradle plugin to 3.0 (from 2.7.1)</li>
 </ul>
 
  <!-- =================== Bug fixes =================== -->