| apply plugin: 'checkstyle' |
| |
| checkstyle { |
| configFile rootProject.file('checkstyle.xml') |
| showViolations true |
| } |
| |
| android.libraryVariants.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 |
| } |