From 319ba195e46ad69174d536e22b6809dfef939782 Mon Sep 17 00:00:00 2001 From: TacoTheDank Date: Sat, 26 Dec 2020 20:34:44 -0500 Subject: [PATCH] Rudimentary migration of findbugs to spotbugs --- .github/workflows/android.yml | 4 +-- app/build.gradle | 26 +++++++++---------- app/config/{findbugs => spotbugs}/exclude.xml | 4 +-- build.gradle | 3 +++ 4 files changed, 20 insertions(+), 17 deletions(-) rename app/config/{findbugs => spotbugs}/exclude.xml (78%) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index ab9d4a2a1..65164e773 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -23,5 +23,5 @@ jobs: run: ./gradlew lintRelease - name: Run unit tests run: ./gradlew testReleaseUnitTest - - name: FindBugs - run: ./gradlew findbugs + - name: SpotBugs + run: ./gradlew spotbugs diff --git a/app/build.gradle b/app/build.gradle index bb4894c46..8281e9a4f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,9 +1,13 @@ -apply plugin: 'com.android.application' -apply plugin: 'findbugs' +import com.github.spotbugs.snom.SpotBugsTask -findbugs { - sourceSets = [] +apply plugin: 'com.android.application' +apply plugin: 'com.github.spotbugs' + +spotbugs { ignoreFailures = false + effort = 'max' + excludeFilter = file("./config/spotbugs/exclude.xml") + reportsDir = file("$buildDir/reports/spotbugs/") } android { @@ -73,18 +77,14 @@ dependencies { testImplementation 'org.robolectric:robolectric:4.0.2' } -task findbugs(type: FindBugs, dependsOn: 'assembleDebug') { +tasks.withType(SpotBugsTask) { - description 'Run findbugs' + description 'Run spotbugs' group 'verification' - classes = fileTree('build/intermediates/javac/debug/compileDebugJavaWithJavac/classes') - source = fileTree('src/main/java') - classpath = files() - - effort = 'max' - - excludeFilter = file("./config/findbugs/exclude.xml") + //classes = fileTree('build/intermediates/javac/debug/compileDebugJavaWithJavac/classes') + //source = fileTree('src/main/java') + //classpath = files() reports { xml.enabled = false diff --git a/app/config/findbugs/exclude.xml b/app/config/spotbugs/exclude.xml similarity index 78% rename from app/config/findbugs/exclude.xml rename to app/config/spotbugs/exclude.xml index 8f7997b7c..ebedfe3af 100644 --- a/app/config/findbugs/exclude.xml +++ b/app/config/spotbugs/exclude.xml @@ -1,4 +1,4 @@ - + @@ -7,4 +7,4 @@ - + diff --git a/build.gradle b/build.gradle index e5e7e895a..90a00d30e 100644 --- a/build.gradle +++ b/build.gradle @@ -5,10 +5,12 @@ buildscript { google() jcenter() maven { url "https://jitpack.io" } + maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath 'com.android.tools.build:gradle:4.1.1' + classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.6.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -20,6 +22,7 @@ allprojects { google() jcenter() maven { url "https://jitpack.io" } + maven { url "https://plugins.gradle.org/m2/" } } }