mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 13:15:35 +03:00
Add SpotBugs tasks
Closes #3759 Signed-off-by: Chris Narkiewicz <hello@ezaquarii.com>
This commit is contained in:
parent
83cdb1f28b
commit
d4788b0ad0
1 changed files with 34 additions and 0 deletions
34
build.gradle
34
build.gradle
|
@ -4,6 +4,7 @@
|
|||
// Due to this, the files layout is not the usual in new projects created with Android Studio / gradle. This file
|
||||
// merges declarations usually split in two separates build.gradle file, one for global settings of the project in
|
||||
// its root folder, another one for the app module in subfolder of root.
|
||||
import com.github.spotbugs.SpotBugsTask
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
|
@ -12,6 +13,9 @@ buildscript {
|
|||
maven {
|
||||
url 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||
}
|
||||
maven {
|
||||
url 'https://plugins.gradle.org/m2/'
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
|
@ -19,6 +23,7 @@ buildscript {
|
|||
classpath('com.dicedmelon.gradle:jacoco-android:0.1.4') {
|
||||
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
|
||||
}
|
||||
classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.6'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +32,7 @@ apply plugin: 'checkstyle'
|
|||
apply plugin: 'pmd'
|
||||
apply plugin: 'findbugs'
|
||||
apply plugin: 'jacoco-android'
|
||||
apply plugin: "com.github.spotbugs"
|
||||
|
||||
configurations.all {
|
||||
exclude group: 'com.google.firebase', module: 'firebase-core'
|
||||
|
@ -68,6 +74,10 @@ if (taskRequest.contains("Gplay") || taskRequest.contains("findbugs") || taskReq
|
|||
apply from: 'gplay.gradle'
|
||||
}
|
||||
|
||||
spotbugs {
|
||||
toolVersion = '3.1.12'
|
||||
}
|
||||
|
||||
android {
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
|
@ -200,6 +210,30 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
String variantName = variant.name
|
||||
String capVariantName = variantName.substring(0, 1).toUpperCase() + variantName.substring(1);
|
||||
tasks.register("spotbugs${capVariantName}", SpotBugsTask) {
|
||||
ignoreFailures = false
|
||||
effort = "max"
|
||||
reportLevel = "medium"
|
||||
classes = fileTree("$project.buildDir/intermediates/javac/${variantName}/compile${capVariantName}JavaWithJavac/classes/")
|
||||
excludeFilter = file("${project.rootDir}/findbugs-filter.xml")
|
||||
source = fileTree('src/main/java')
|
||||
classpath = files()
|
||||
include '**/*.java'
|
||||
exclude '**/gen/**'
|
||||
|
||||
reports {
|
||||
xml.enabled = false
|
||||
html.enabled = true
|
||||
html {
|
||||
destination = file("$project.buildDir/reports/spotbugs/spotbugs.html")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'
|
||||
|
||||
compileOptions {
|
||||
|
|
Loading…
Reference in a new issue