Replace findbugs with spotbugs and fix configuration for latest gradle

This commit is contained in:
cpfeiffer 2019-09-19 22:31:49 +02:00
parent f36a58e1f1
commit 235c3fb599
2 changed files with 22 additions and 8 deletions

View File

@ -1,5 +1,5 @@
apply plugin: "com.android.application"
apply plugin: "findbugs"
apply plugin: "com.github.spotbugs"
apply plugin: "pmd"
def ABORT_ON_CHECK_FAILURE = false
@ -99,7 +99,7 @@ gradle.beforeProject {
preBuild.dependsOn(":GBDaoGenerator:genSources")
}
check.dependsOn "findbugs", "pmd", "lint"
check.dependsOn "spotbugsMain", "pmd", "lint"
task pmd(type: Pmd) {
ruleSetFiles = files("${project.rootDir}/config/pmd/pmd-ruleset.xml")
@ -142,22 +142,32 @@ task pmd(type: Pmd) {
}
}
task findbugs(type: FindBugs) {
// this is just for spotbugs to let the plugin create the task
sourceSets {
main {
java.srcDirs = []
}
}
spotbugs {
toolVersion = "3.1.12"
ignoreFailures = !ABORT_ON_CHECK_FAILURE
effort = "default"
reportLevel = "medium"
}
tasks.withType(com.github.spotbugs.SpotBugsTask) {
source = fileTree('src/main/java')
classes = files("${project.rootDir}/app/build/intermediates/javac/debug/classes")
excludeFilter = new File("${project.rootDir}/config/findbugs/findbugs-filter.xml")
classes = files("${project.rootDir}/app/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes")
source = fileTree("src/main/java/")
classpath = files()
reports {
xml.enabled = false
html.enabled = true
xml {
destination file ("$project.buildDir/reports/findbugs/findbugs-output.xml")
destination file ("$project.buildDir/reports/spotbugs/spotbugs-output.xml")
}
html {
destination file ("$project.buildDir/reports/findbugs/findbugs-output.html")
destination file ("$project.buildDir/reports/spotbugs/spotbugs-output.html")
}
}
}

View File

@ -4,9 +4,13 @@ buildscript {
repositories {
jcenter()
google()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:2.0.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files