Created
May 16, 2017 10:31
-
-
Save nickwph/de0dd805e29fe3bcba476b6126459259 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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