diff --git a/build.gradle b/build.gradle index 4917a09386..4a7936ac20 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:7.0.3' classpath 'com.hiya:jacoco-android:0.2' - classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.5' + classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.9' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.18.1" classpath "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2 @@ -224,26 +224,6 @@ android { } } - android.applicationVariants.all { variant -> - String variantName = variant.name - String capVariantName = variantName.substring(0, 1).toUpperCase() + variantName.substring(1) - tasks.register("spotbugs${capVariantName}Report", SpotBugsTask) { - ignoreFailures = true // should continue checking - effort = "max" - reportLevel = "medium" - classes = fileTree("$project.buildDir/intermediates/javac/${variantName}/classes/") - excludeFilter = file("${project.rootDir}/spotbugs-filter.xml") - - reports { - xml.enabled = false - html { - enabled = true - destination = file("$project.buildDir/reports/spotbugs/spotbugs.html") - } - } - } - } - check.dependsOn 'checkstyle', 'spotbugsGplayDebugReport', 'pmd', 'lint', 'ktlint', 'detekt' buildFeatures { @@ -476,3 +456,26 @@ shot { jacoco { toolVersion = "$jacoco_version" } + +spotbugs { + ignoreFailures = true // should continue checking + effort = "max" + reportLevel = "medium" +} + +tasks.withType(SpotBugsTask){task -> + String variantNameCap = task.name.replace("spotbugs", "") + String variantName = variantNameCap.substring(0, 1).toLowerCase() + variantNameCap.substring(1) + + dependsOn "compile${variantNameCap}Sources" + + excludeFilter = file("${project.rootDir}/spotbugs-filter.xml") + classes = fileTree("$project.buildDir/intermediates/javac/${variantName}/classes/") + reports { + xml.enabled = false + html { + enabled = true + destination = file("$project.buildDir/reports/spotbugs/spotbugs.html") + } + } +} diff --git a/scripts/analysis/findbugs-results.txt b/scripts/analysis/findbugs-results.txt index 1caed7b767..231a7d578e 100644 --- a/scripts/analysis/findbugs-results.txt +++ b/scripts/analysis/findbugs-results.txt @@ -1 +1 @@ -351 +638 diff --git a/scripts/analysis/findbugs-up.rb b/scripts/analysis/findbugs-up.rb index 0e22755f0e..e66583ac16 100644 --- a/scripts/analysis/findbugs-up.rb +++ b/scripts/analysis/findbugs-up.rb @@ -47,16 +47,7 @@ require 'xmlsimple' # run FindBugs puts "running FindBugs..." -system './gradlew assembleGplayDebug 1>/dev/null' - -# confirm that assemble ran w/out error -result = $?.to_i -if result != 0 - puts "FAIL: failed to run ./gradlew assembleGplayDebug" - exit 1 -end - -system './gradlew spotbugsGplayDebugReport 1>/dev/null 2>&1' +system './gradlew spotbugsGplayDebug 1>/dev/null 2>&1' # find FindBugs report file findbugs_reports = Dir.glob(FINDBUGS_REPORT_FILE)