|
1
|
1 |
apply plugin: 'checkstyle'
|
|
|
2 |
check.dependsOn 'checkstyle'
|
|
|
3 |
|
|
|
4 |
checkstyle {
|
|
|
5 |
toolVersion = '6.19'
|
|
|
6 |
}
|
|
|
7 |
|
|
|
8 |
task checkstyle(type: Checkstyle) {
|
|
|
9 |
description = "Check Java style with Checkstyle"
|
|
|
10 |
configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
|
|
|
11 |
source = javaSources()
|
|
|
12 |
classpath = files()
|
|
|
13 |
ignoreFailures = true
|
|
|
14 |
}
|
|
|
15 |
|
|
|
16 |
def javaSources() {
|
|
|
17 |
def files = []
|
|
|
18 |
android.sourceSets.each { sourceSet ->
|
|
|
19 |
sourceSet.java.each { javaSource ->
|
|
|
20 |
javaSource.getSrcDirs().each {
|
|
|
21 |
if (it.exists()) {
|
|
|
22 |
files.add(it)
|
|
|
23 |
}
|
|
|
24 |
}
|
|
|
25 |
}
|
|
|
26 |
}
|
|
|
27 |
return files
|
|
|
28 |
}
|