2018-02-07 17:06:23 +00:00
|
|
|
apply plugin: 'checkstyle'
|
|
|
|
check.dependsOn 'checkstyle'
|
|
|
|
|
|
|
|
checkstyle {
|
2021-10-30 09:23:51 +00:00
|
|
|
toolVersion = '9.0.1'
|
2018-02-07 17:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
task checkstyle(type: Checkstyle) {
|
|
|
|
description = "Check Java style with Checkstyle"
|
|
|
|
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
|
|
|
|
source = javaSources()
|
|
|
|
classpath = files()
|
|
|
|
ignoreFailures = true
|
|
|
|
}
|
|
|
|
|
|
|
|
def javaSources() {
|
|
|
|
def files = []
|
|
|
|
android.sourceSets.each { sourceSet ->
|
|
|
|
sourceSet.java.each { javaSource ->
|
|
|
|
javaSource.getSrcDirs().each {
|
|
|
|
if (it.exists()) {
|
|
|
|
files.add(it)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return files
|
|
|
|
}
|