-
-
Save damonYuan/29ec0c94466006e3091e323786e14298 to your computer and use it in GitHub Desktop.
Android checkstyle gradle script
This file contains hidden or 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