-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
106 lines (89 loc) · 3.14 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'cobertura'
apply plugin: 'checkstyle'
// Configuración
sourceCompatibility = 1.7
version = '0.1'
test.ignoreFailures = true
defaultTasks 'clean', 'compileJava', 'test', 'cobertura', 'checkstyleMain', 'pmd'
repositories {
mavenCentral()
}
configurations {
pmdConf
}
sourceSets {
acceptanceTest {
java.srcDir file('src/acceptance-tests/java')
resources.srcDir file('src/acceptance-tests/resources')
}
}
dependencies {
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
testCompile 'junit:junit:4.+'
testCompile group: 'org.hamcrest', name: 'hamcrest-core', version: '1.2.1'
pmdConf group: 'pmd', name: 'pmd', version: '4.3'
acceptanceTestCompile sourceSets.main.output
acceptanceTestCompile configurations.testCompile
acceptanceTestCompile sourceSets.test.output
acceptanceTestRuntime configurations.testRuntime
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'net.saliman', name: 'gradle-cobertura-plugin', version: '2.2.2'
}
}
// Tareas
task acceptanceTest(type: Test) {
description = "Corre los tests de aceptación"
testClassesDir = sourceSets.acceptanceTest.output.classesDir
classpath = sourceSets.acceptanceTest.runtimeClasspath
acceptanceTest.reports.html.destination = file("$buildDir/reports/acceptance-tests")
}
task wrapper(type: Wrapper) {
gradleVersion = '1.9'
}
jar {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}
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')
}
}
}
}