Skip to content

Instantly share code, notes, and snippets.

@robints
Created June 29, 2016 03:15
Show Gist options
  • Save robints/acfefd19337edde6e10a7c96bbbcc20a to your computer and use it in GitHub Desktop.
Save robints/acfefd19337edde6e10a7c96bbbcc20a to your computer and use it in GitHub Desktop.

Revisions

  1. robints created this gist Jun 29, 2016.
    18 changes: 18 additions & 0 deletions checkstyle.gradle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    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
    }