-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
116 lines (104 loc) · 3.17 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
107
108
109
110
111
112
113
114
115
116
plugins {
id 'base'
id 'groovy'
id 'war'
id 'jacoco'
}
repositories {
mavenCentral()
jcenter()
maven { url 'http://repo.jenkins-ci.org/releases/' }
maven { url 'https://jitpack.io' }
}
configurations { codacy }
dependencies {
compile group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.4.15'
compile group: 'org.jenkins-ci.plugins', name: 'credentials-binding', version: '1.16'
testCompile group: 'com.lesfurets', name: 'jenkins-pipeline-unit', version: '1.0'
testCompile group: 'junit', name: 'junit', version: '4.11'
codacy group: 'com.github.codacy', name: 'codacy-coverage-reporter', version: '2.0.1'
}
sourceSets {
main {
groovy {
srcDirs = ['src', 'vars']
exclude '**/validefy.groovy'
}
}
test {
groovy {
srcDirs = ['test']
}
resources {
srcDirs = ['test/resources']
}
}
}
clean.doFirst {
println "Removing build dir ..."
delete "${buildDir}"
println "Removing docs artifacts ..."
delete fileTree(rootDir) {
include "docs/web/*.html"
include "docs/web/*.ico"
include "docs/web/*.gif"
include "docs/web/*.css"
include "docs/web/package-list"
include "docs/web/DefaultPackage/"
}
}
compileGroovy.dependsOn clean
compileGroovy.options.compilerArgs += ['-proc:none']
compileTestGroovy.options.compilerArgs += ['-proc:none']
test {
testLogging {
events "skipped", "failed"
exceptionFormat "short"
showExceptions true
showCauses true
if(project.hasProperty('test_debug') && (project.getProperty('test_debug') == "true")) {
events "passed", "skipped", "failed", "standardError", "standardOut"
exceptionFormat "full"
}
afterSuite { desc, result ->
if (!desc.parent) {
logger.lifecycle "\nResults: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
}
}
}
}
groovydoc {
dependsOn compileGroovy
docTitle = description
source = sourceSets.main.groovy
destinationDir = new File('docs/web')
classpath = configurations.compile
}
war {
dependsOn groovydoc
from 'docs/web'
webInf {
from 'docs/web/WEB-INF'
}
webXml = file('docs/web/WEB-INF/web.xml')
}
build.dependsOn clean, war
jacocoTestReport {
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
sourceSets sourceSets.test
reports {
xml.enabled true
csv.enabled false
xml.destination file("${buildDir}/reports/jacoco/report.xml")
html.enabled true
}
}
task codacyCoverageUpload(type: JavaExec, dependsOn: jacocoTestReport) {
classpath = configurations.codacy
main 'com.codacy.CodacyCoverageReporter'
args = [
'-l', 'Java',
'-r', tasks.jacocoTestReport.reports.xml.destination,
'--projectToken', '2e3e7e02b3d249998caebe9398c80daf'
]
}