This repository was archived by the owner on Sep 17, 2024. It is now read-only.
forked from Piasy/AndroidCodeQualityConfig
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquality.gradle
More file actions
127 lines (112 loc) · 3.65 KB
/
quality.gradle
File metadata and controls
127 lines (112 loc) · 3.65 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
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', 'lint'
checkstyle {
// will fire "java.lang.ClassNotFoundException: com.puppycrawl.tools.checkstyle
// .CheckStyleTask" with version 6.10.1
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("${project.rootDir}/${project.getName()}/build/classes")
} else {
classes = files("${project.rootDir}/${project.getName()}/build/intermediates/classes")
}
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = false
html.enabled = true
xml {
destination "${project.rootDir}/${project.getName()}/build/reports/findbugs/findbugs.xml"
}
html {
destination "${project.rootDir}/${project.getName()}/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/**'
reports {
xml.enabled = false
html.enabled = true
xml {
destination "${project.rootDir}/${project.getName()}/build/reports/pmd/pmd.xml"
}
html {
destination "${project.rootDir}/${project.getName()}/build/reports/pmd/pmd.html"
}
}
}
// Comment it if config set in root project's build.gradle
//android {
// lintOptions {
// abortOnError true
// xmlReport true
// htmlReport true
// lintConfig file("${project.rootDir}/AndroidCodeQualityConfig/quality/lint/lint.xml")
// }
//
// testOptions.unitTests.all {
// testLogging {
// events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
// outputs.upToDateWhen { false }
// showStandardStreams = true
// }
// }
//}
// Comment it if config set in each module's build.gradle
afterEvaluate {
if (!isJava) {
android {
lintOptions {
abortOnError true
xmlReport true
htmlReport true
lintConfig file("${project.rootDir}/AndroidCodeQualityConfig/quality/lint/lint.xml")
}
testOptions.unitTests.all {
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
outputs.upToDateWhen { false }
showStandardStreams = true
}
}
}
}
}