android-checkstyle.gradle 645 B

12345678910111213141516171819202122232425262728
  1. apply plugin: 'checkstyle'
  2. check.dependsOn 'checkstyle'
  3. checkstyle {
  4. toolVersion = '10.12.5'
  5. }
  6. task checkstyle(type: Checkstyle) {
  7. description = "Check Java style with Checkstyle"
  8. configFile = rootProject.file("config/checkstyle/checkstyle.xml")
  9. source = javaSources()
  10. classpath = files()
  11. ignoreFailures = true
  12. }
  13. def javaSources() {
  14. def files = []
  15. android.sourceSets.each { sourceSet ->
  16. sourceSet.java.each { javaSource ->
  17. javaSource.getSrcDirs().each {
  18. if (it.exists()) {
  19. files.add(it)
  20. }
  21. }
  22. }
  23. }
  24. return files
  25. }