mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-16 23:20:16 -05:00
Improve FindBugs Gradle task
Based on https://github.com/square/sqlbrite/blob/master/gradle/android-findbugs.gradle
This commit is contained in:
parent
f96ffdcd4e
commit
b45065a5b2
@ -1,14 +1,29 @@
|
|||||||
apply plugin: 'findbugs'
|
apply plugin: 'findbugs'
|
||||||
|
|
||||||
check.dependsOn 'findbugs'
|
afterEvaluate {
|
||||||
task findbugs(type: FindBugs, dependsOn: ['compileDebugJava', 'compileDebugTestJava']) {
|
def variants = plugins.hasPlugin('com.android.application') ?
|
||||||
ignoreFailures = true
|
android.applicationVariants : android.libraryVariants
|
||||||
classes = fileTree('build/intermediates/classes/debug/') +
|
|
||||||
fileTree('build/intermediates/classes/test/debug/')
|
variants.each { variant ->
|
||||||
source = project.android.sourceSets.main.java.getSrcDirs() +
|
def task = project.task("findBugs${variant.name.capitalize()}", type: FindBugs) {
|
||||||
project.android.sourceSets.androidTest.java.getSrcDirs()
|
group = 'verification'
|
||||||
classpath = files()
|
description = "Run FindBugs for the ${variant.description}."
|
||||||
effort = 'max'
|
|
||||||
includeFilter = file("$rootProject.projectDir/config/findbugs/include_filter.xml")
|
effort = 'max'
|
||||||
excludeFilter = file("$rootProject.projectDir/config/findbugs/exclude_filter.xml")
|
ignoreFailures = true
|
||||||
|
|
||||||
|
includeFilter = file("$rootProject.projectDir/config/findbugs/include_filter.xml")
|
||||||
|
excludeFilter = file("$rootProject.projectDir/config/findbugs/exclude_filter.xml")
|
||||||
|
|
||||||
|
def variantCompile = variant.javaCompile
|
||||||
|
|
||||||
|
classes = fileTree(variantCompile.destinationDir)
|
||||||
|
source = variantCompile.source
|
||||||
|
classpath = variantCompile.classpath.plus(project.files(android.bootClasspath))
|
||||||
|
|
||||||
|
dependsOn(variantCompile)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.getByName('check').dependsOn(task)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user