File: codeQuality.gradle

package info (click to toggle)
gradle 1.5-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 36,408 kB
  • ctags: 34,655
  • sloc: java: 148,313; xml: 23,958; sh: 291; makefile: 53; cpp: 30; jsp: 11
file content (32 lines) | stat: -rw-r--r-- 1,027 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
apply plugin: 'checkstyle'
apply plugin: 'codenarc'

def configDir = new File(buildscript.sourceFile.parentFile.parentFile, 'config')

ext.checkstyleConfigDir = "$configDir/checkstyle"

checkstyle {
    configFile = new File(checkstyleConfigDir, "checkstyle.xml")
    configProperties.checkstyleConfigDir = checkstyleConfigDir
}

codenarc {
    configFile = new File(configDir, "codenarc.xml")
}

plugins.withType(GroovyBasePlugin) {
    sourceSets.all { sourceSet ->
        task "${sourceSet.getTaskName('checkstyle', 'groovy')}"(type: Checkstyle) {
            configFile = new File(checkstyleConfigDir, "checkstyle-groovy.xml")
            source sourceSet.allGroovy
            classpath = sourceSet.compileClasspath
            reports.xml.destination new File(checkstyle.reportsDir, "${sourceSet.name}-groovy.xml")
        }
    }
}

task codeQuality {
    dependsOn tasks.matching { task ->
        [org.gradle.api.plugins.quality.CodeNarc, org.gradle.api.plugins.quality.Checkstyle].any { it.isInstance(task) }
    }
}