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

sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 6bcec3a69455f6ddfe4e2e6be015be5bdaa1a101
Author: Paul King <[email protected]>
AuthorDate: Tue Jan 21 23:41:16 2020 +1000

    use newer (but experimental) gradle spotbugs plugin
    
    (cherry picked from commit d6c5fcfef4c5e198ec37680cb6a0619ee0f3b6b1)
---
 build.gradle          | 11 ++++++-----
 gradle/quality.gradle | 28 +++++++++++++++-------------
 2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/build.gradle b/build.gradle
index 70d4f62..7c5f266 100644
--- a/build.gradle
+++ b/build.gradle
@@ -46,10 +46,11 @@ buildscript {
 
 plugins {
     id 'me.champeau.buildscan-recipes' version '0.2.3'
-    // upgrade spotbugs upon fix of: 
https://github.com/spotbugs/spotbugs-gradle-plugin/issues/166
-    id 'com.github.spotbugs' version '3.0.0'
-    id "com.github.ben-manes.versions" version '0.27.0'
-    id "com.github.blindpirate.osgi" version "0.0.1"
+    // id 'com.github.spotbugs' version '3.0.0' // fails due to Guava 
conflict: https://github.com/spotbugs/spotbugs-gradle-plugin/issues/166
+    // id 'com.github.spotbugs' version '1.6.9' // not compatible with Gradle 6
+    id 'jp.skypencil.spotbugs.snom' version '0.4.13' // work in progress 
replacement of above
+    id 'com.github.ben-manes.versions' version '0.27.0'
+    id 'com.github.blindpirate.osgi' version '0.0.1'
 }
 
 buildScanRecipes {
@@ -424,7 +425,7 @@ if (!JavaVersion.current().java9Compatible) {
 
 // Workaround to be able to access SpotBugsTask from external gradle script.
 // More info: 
https://discuss.gradle.org/t/buildscript-dependencies-in-external-script/23243
-project.extensions.extraProperties.set('SpotBugsTask', 
com.github.spotbugs.SpotBugsTask)
+project.extensions.extraProperties.set('SpotBugsTask', 
com.github.spotbugs.snom.SpotBugsTask)
 
 apply from: 'gradle/test.gradle'
 apply from: 'gradle/groovydoc.gradle'
diff --git a/gradle/quality.gradle b/gradle/quality.gradle
index dec9db9..2696a86 100644
--- a/gradle/quality.gradle
+++ b/gradle/quality.gradle
@@ -19,12 +19,13 @@
 import groovy.text.markup.MarkupTemplateEngine
 import groovy.text.markup.TemplateConfiguration
 
-allprojects {
+allprojects { proj ->
     apply plugin: "org.nosphere.apache.rat"
     //apply plugin: "com.github.hierynomus.license"
     apply plugin: 'checkstyle'
     apply plugin: 'codenarc'
-    apply plugin: 'com.github.spotbugs'
+//    apply plugin: 'com.github.spotbugs'
+    apply plugin: 'jp.skypencil.spotbugs.snom'
     configurations.codenarc {
         // because we will rely on the version we build
         // because version ranges are evil
@@ -42,6 +43,10 @@ allprojects {
     
     dependencies {
         codenarc "org.codenarc:CodeNarc:1.5"
+        spotbugs 'com.github.spotbugs:spotbugs:3.1.11'
+        if (proj.name.contains('jaxb') && 
JavaVersion.current().isJava9Compatible()) {
+            spotbugs 'javax.xml.bind:jaxb-api:2.3.0'
+        }
         codenarc project(":groovy-templates")
     }
 
@@ -132,23 +137,20 @@ allprojects {
         }
     }
 
-    spotbugs {
-        toolVersion = '3.1.7'
-        // continue build despite warnings
-        ignoreFailures = true
-        //defining source set is needless
-        //just run ./gradlew spotbugsMain then it will parse src/main/java.
-        //To parse test cases, you need to use ./gradlew spotbugsTest.
-    }
-
-    // To generate an HTML report instead of XML
     tasks.withType(SpotBugsTask) {
+        // TODO work out why the following aren't being set automatically
+        if (proj.name.contains('jaxb')) {
+            reportsDir = file("$buildDir/reports/spotbugs")
+            projectName = proj.name
+            release = rootProject.version
+        }
+        ignoreFailures = true
         effort = 'max'
+        maxHeapSize = '2g'
         reports {
             xml.enabled = false
             html.enabled = true
         }
-        maxHeapSize '2g'
     }
 }
 

Reply via email to