-
Notifications
You must be signed in to change notification settings - Fork 51
/
build.gradle
61 lines (53 loc) · 1.82 KB
/
build.gradle
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'pmd'
defaultTasks 'clean', 'compileJava', 'test', 'checkstyleMain', 'pmd'
repositories {
mavenCentral()
}
configurations {
pmdConf
}
dependencies {
testCompile 'junit:junit:4.12'
pmdConf group: 'pmd', name: 'pmd', version: '4.3'
}
test {
ignoreFailures = true
}
checkstyle {
toolVersion "7.6.1"
ignoreFailures = true
}
task pmd (dependsOn: compileJava) {
doLast {
println 'Running PMD/CPD static code analysis'
ant {
if (!buildDir.isDirectory()) {
buildDir.mkdirs()
}
reportFolder = new File(rootDir, "build/reports/pmd-cpd")
if (!reportFolder.isDirectory()) {
reportFolder.mkdirs()
}
taskdef(name: 'pmd', classname: 'net.sourceforge.pmd.ant.PMDTask', classpath: configurations.pmdConf.asPath)
taskdef(name: 'cpd', classname: 'net.sourceforge.pmd.cpd.CPDTask', classpath: configurations.pmdConf.asPath)
pmd(shortFilenames: 'true',
failonruleviolation: 'false',
rulesetfiles: 'rulesets/basic.xml, rulesets/braces.xml, rulesets/clone.xml, rulesets/coupling.xml, rulesets/codesize.xml, rulesets/design.xml, rulesets/migrating.xml, rulesets/naming.xml, rulesets/strictexception.xml, rulesets/strings.xml, rulesets/unusedcode.xml') {
formatter(type: 'xml', toFile: 'build/reports/pmd-cpd/pmd.xml')
fileset(dir: "src/main/java") {
include(name: '**/*.java')
}
}
cpd(minimumTokenCount: 30, format: 'xml',
ignoreLiterals: 'true',
ignoreIdentifiers: 'true',
outputFile: 'build/reports/pmd-cpd/cpd.xml') {
fileSet(dir: "src/main/java") {
include(name: '**/*.java')
}
}
}
}
}