-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathquality.gradle
115 lines (99 loc) · 3.27 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
106
107
108
109
110
111
112
113
114
115
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'pmd'
def isJava = plugins.hasPlugin('java')
// Add checkstyle, findbugs, pmd and lint to the check task.
// Comment it if already set in root project's build.gradle.
check.dependsOn 'checkstyle', 'findbugs', 'pmd'
if (!isJava) {
check.dependsOn 'lint'
}
checkstyle {
toolVersion '7.4'
configFile file("${project.rootDir}/AndroidCodeQualityConfig/quality/checkstyle/checkstyle.xml")
configProperties.checkstyleSuppressionFilterPath = file(
"${project.rootDir}/AndroidCodeQualityConfig/quality/checkstyle/suppressions.xml")
.absolutePath
}
task checkstyle(type: Checkstyle, group: 'verification') {
source 'src'
include '**/*.java'
exclude '**/gen/**'
exclude '**/test/**'
exclude '**/androidTest/**'
exclude '**/R.java'
exclude '**/BuildConfig.java'
classpath = files()
}
findbugs {
toolVersion = "3.0.1"
ignoreFailures = false
effort = "max"
reportLevel = "high"
excludeFilter = new File("${project.rootDir}/AndroidCodeQualityConfig/quality/findbugs/findbugs-filter.xml")
}
task findbugs(type: FindBugs, dependsOn: "assemble", group: 'verification') {
if (isJava) {
classes = files("$projectDir.absolutePath/build/classes")
} else {
classes = files("$projectDir.absolutePath/build/intermediates/classes")
}
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
// FindBugs tasks can only have one report enabled
xml.enabled = false
html.enabled = !xml.enabled
xml {
destination file("$projectDir.absolutePath/build/reports/findbugs/findbugs.xml")
}
html {
destination file("$projectDir.absolutePath/build/reports/findbugs/findbugs.html")
}
}
classpath = files()
}
pmd {
toolVersion = '5.5.2'
ignoreFailures = false
ruleSetFiles = files("${project.rootDir}/AndroidCodeQualityConfig/quality/pmd/pmd-ruleset.xml")
ruleSets = []
}
task pmd(type: Pmd, group: 'verification') {
source 'src'
include '**/*.java'
exclude('**/gen/**', '**/debug/**')
reports {
xml.enabled = true
html.enabled = true
xml {
destination file("$projectDir.absolutePath/build/reports/pmd/pmd.xml")
}
html {
destination file("$projectDir.absolutePath/build/reports/pmd/pmd.html")
}
}
}
if (!isJava) {
android {
lintOptions {
disable 'NewApi' // gradle build will compile code use `Objects.requireNonNull()` for lambda
abortOnError true
xmlReport true
xmlOutput project.file('build/reports/lint/lint-report.xml')
htmlReport true
htmlOutput project.file('build/reports/lint/lint-report.html')
lintConfig file("${project.rootDir}/AndroidCodeQualityConfig/quality/lint/lint.xml")
}
testOptions.unitTests.all {
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
outputs.upToDateWhen { false }
showStandardStreams = true
}
jvmArgs '-noverify'
}
}
}
apply from: rootProject.file('AndroidCodeQualityConfig/jacoco.gradle')