1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-06 13:17:59 +02:00

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: "com.android.application"
apply plugin: "findbugs" apply plugin: "com.github.spotbugs"
apply plugin: "pmd" apply plugin: "pmd"
def ABORT_ON_CHECK_FAILURE = false def ABORT_ON_CHECK_FAILURE = false
@ -99,7 +99,7 @@ gradle.beforeProject {
preBuild.dependsOn(":GBDaoGenerator:genSources") preBuild.dependsOn(":GBDaoGenerator:genSources")
} }
check.dependsOn "findbugs", "pmd", "lint" check.dependsOn "spotbugsMain", "pmd", "lint"
task pmd(type: Pmd) { task pmd(type: Pmd) {
ruleSetFiles = files("${project.rootDir}/config/pmd/pmd-ruleset.xml") 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 ignoreFailures = !ABORT_ON_CHECK_FAILURE
effort = "default" effort = "default"
reportLevel = "medium" 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") 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 { reports {
xml.enabled = false xml.enabled = false
html.enabled = true html.enabled = true
xml { xml {
destination file ("$project.buildDir/reports/findbugs/findbugs-output.xml") destination file ("$project.buildDir/reports/spotbugs/spotbugs-output.xml")
} }
html { 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 { repositories {
jcenter() jcenter()
google() google()
maven {
url 'https://plugins.gradle.org/m2/'
}
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.5.0' 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 // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files