forked from sockeqwe/mosby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
findbugs.gradle
48 lines (35 loc) · 1.24 KB
/
findbugs.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
apply plugin: 'findbugs'
afterEvaluate {
def variants = plugins.hasPlugin('com.android.application') ? android.applicationVariants :
android.libraryVariants
variants.each { variant ->
def task = tasks.create("findBugs${variant.name.capitalize()}", FindBugs)
task.group = 'verification'
task.description = "Run FindBugs for the ${variant.description}."
task.effort = 'max'
task.reportLevel = 'high'
task.reports {
xml {
enabled = false
}
html {
enabled = true
}
}
def variantCompile = variant.javaCompile
task.classes = fileTree(variantCompile.destinationDir)
task.source = variantCompile.source
task.classpath = variantCompile.classpath.plus(project.files(android.bootClasspath))
def variantDir = file(variantCompile.destinationDir)
def pathToFilter = variantDir.parentFile.parentFile.parentFile.parentFile.toString() +
"/findbugs-filter.xml"
def filterFile = file(pathToFilter)
println("File should $pathToFilter " + filterFile.exists())
if (filterFile.exists()) {
task.excludeFilter = filterFile
println("File filter $filterFile")
}
task.dependsOn(variantCompile)
tasks.getByName('check').dependsOn(task)
}
}