diff --git a/app/build.gradle b/app/build.gradle index 3009b43a3..aac40c5b0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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") } } } diff --git a/build.gradle b/build.gradle index d5158151d..ec00336cc 100644 --- a/build.gradle +++ b/build.gradle @@ -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