-
Notifications
You must be signed in to change notification settings - Fork 1
/
quality.gradle
105 lines (84 loc) · 2.71 KB
/
quality.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
apply plugin: 'pmd'
apply plugin: 'findbugs'
apply plugin: 'checkstyle'
def isTravis = "true".equals(System.getenv("TRAVIS"))
pmd {
ruleSetFiles = files("${project.rootDir}/config/pmd/pmd-ruleset.xml")
}
findbugs {
includeFilter = file("${project.rootDir}/config/findbugs/findbugs-config.xml")
excludeFilter = file("${project.rootDir}/config/findbugs/findbugs-excludes.xml")
}
checkstyle {
toolVersion = "6.16"
showViolations isTravis
}
android.lintOptions {
abortOnError true
lintConfig file("${project.rootDir}/config/lint/lint.xml")
textReport isTravis
textOutput 'stdout'
}
task pmd (type: Pmd) {
description 'Run pmd'
group 'verification'
source = fileTree('src/main/java')
consoleOutput = isTravis
ignoreFailures = false
reports {
xml.enabled = false
html.enabled = !isTravis
}
}
task findbugs (type: FindBugs, dependsOn: assemble) {
description 'Run findbugs'
group 'verification'
classes = fileTree('build/intermediates/classes/')
source = fileTree('src/main/java/')
classpath = files()
includeFilter = file("$rootProject.projectDir/config/findbugs/findbugs-config.xml")
excludeFilter = file("$rootProject.projectDir/config/findbugs/findbugs-excludes.xml")
ignoreFailures = false
reports {
xml.enabled = false
html.enabled = true
}
}
task checkstyle(type: Checkstyle) {
description 'Run checkstyle'
group 'verification'
configFile file("${project.rootDir}/config/checkstyle/checkstyle.xml")
configProperties = [rootDir: "${project.rootDir}"]
source 'src'
include '**/*.java'
exclude '**/gen/**'
classpath = files()
}
check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'
apply plugin: 'jacoco'
task jacocoTestReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') {
group = 'reporting'
description = 'Generate Jacoco coverage reports after running tests.'
reports {
xml.enabled = true
html.enabled = true
}
jacocoClasspath = configurations['androidJacocoAnt']
def fileFilter = ['**/R.class',
'**/R$*.class',
'**/*$ViewInjector*.*',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*Test*.*',
'**/*$InjectAdapter.class',
'**/*$ModuleAdapter.class',
'**/*$$*',
'android/**/*.*']
def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
def mainSrc = "${project.projectDir}/src/main/java"
sourceDirectories = files([mainSrc])
classDirectories = files([debugTree])
executionData = files(["${buildDir}/jacoco/testDebugUnitTest.exec",
"${buildDir}/outputs/code-coverage/connected/coverage.ec"
])
}