config/android-checkstyle.gradle
author Da Risk <da_risk@geekorum.com>
Sat, 09 May 2020 17:25:21 -0400
changeset 5 152b4a7735a6
parent 1 831cffa9c991
child 6 99ad8c14fec2
permissions -rw-r--r--
Fix SyncInProgressLiveData

apply plugin: 'checkstyle'
check.dependsOn 'checkstyle'

checkstyle {
    toolVersion = '6.19'
}

task checkstyle(type: Checkstyle) {
    description = "Check Java style with Checkstyle"
    configFile = file("${project.rootDir}/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
}