Skip to content

Instantly share code, notes, and snippets.

@nickwph
Created May 16, 2017 10:31
Show Gist options
  • Save nickwph/de0dd805e29fe3bcba476b6126459259 to your computer and use it in GitHub Desktop.
Save nickwph/de0dd805e29fe3bcba476b6126459259 to your computer and use it in GitHub Desktop.
/**
* Created by Nicholas Wong <[email protected]>.
* Github Gist: https://gist.github.com/nickwph/de0dd805e29fe3bcba476b6126459259
* Gradle build file to set up variables for checkstyle.
*/
apply plugin: 'checkstyle'
checkstyle {
configFile file('checkstyle-config.xml')
showViolations true
ignoreFailures true
}
android.applicationVariants.all { variant ->
def name = variant.buildType.name
def checkstyle = project.tasks.create "checkstyle${name.capitalize()}", Checkstyle
checkstyle.dependsOn variant.javaCompile
checkstyle.source variant.javaCompile.source
checkstyle.classpath = project.fileTree(variant.javaCompile.destinationDir)
checkstyle.exclude('**/BuildConfig.java')
checkstyle.exclude('**/R.java')
project.tasks.getByName("check").dependsOn checkstyle
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment