-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
79 lines (66 loc) · 2.26 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
apply plugin: 'java'
apply plugin: 'eclipse'
//apply plugin: 'cobertura'
apply plugin: 'checkstyle'
// Configuración
sourceCompatibility = 1.5
version = '0.1'
test.ignoreFailures = true
defaultTasks 'clean', 'compileJava', 'test', /*'cobertura',*/ 'checkstyleMain', 'pmd'
repositories {
mavenCentral()
}
configurations {
pmdConf
}
dependencies {
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
testCompile group: 'junit', name: 'junit', version: '4.+'
pmdConf group: 'pmd', name: 'pmd', version: '4.3'
}
/*buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'net.saliman', name: 'gradle-cobertura-plugin', version: '1.1.0'
}
}*/
// Tareas
checkstyle {
configFile = new File(rootDir, "src/test/resources/sun_checks.xml")
ignoreFailures = true
}
/*cobertura {
coverageFormats = ['html', 'xml']
}*/
task pmd (dependsOn: compileJava) << {
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')
}
}
}
}