-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
181 lines (154 loc) · 4.76 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
plugins {
// Apply the groovy plugin to add support for Groovy
id 'groovy'
id 'jacoco'
id 'codenarc'
// Apply Gradle JPI plugin to simplify dependency management
id 'org.jenkins-ci.jpi' version "0.40.0-rc.2"
id 'nl.martijndwars.markdown' version '0.2.0' apply false
// adds taskTree debug tool
id "com.dorongold.task-tree" version "1.5"
}
repositories {
mavenCentral()
mavenLocal()
maven { url 'https://repo.jenkins-ci.org/releases/' }
jcenter()
}
allprojects {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
// Because this breaks things for some reason
configurations.all {
exclude group: 'com.ibm.icu', module: 'icu4j'
}
sourceSets {
// noinspection GroovyAssignabilityCheck
main {
groovy {
srcDirs = ['src', 'vars']
}
resources {
srcDirs = ['resources']
}
}
test {
groovy {
srcDirs = ['test/src', 'test/vars']
}
resources {
srcDirs = ['test/resources']
}
}
}
compileGroovy {
groovyOptions.configurationScript = file("config/groovyCompilerConfig.groovy")
//horrible no-good hack to add groovy-cps to groovyClasspath
groovyClasspath += sourceSets.main.compileClasspath
}
dependencies {
implementation "org.codehaus.groovy:groovy-all:${groovyVersion}"
implementation "com.cloudbees:groovy-cps:1.32@jar"
// Folder
implementation 'org.jenkins-ci.plugins:cloudbees-folder:6.1.2'
testImplementation 'org.spockframework:spock-core:1.3-groovy-2.4'
//testRuntime "net.bytebuddy:byte-buddy:1.9.3"
testRuntime 'cglib:cglib-nodep:3.3.0'
//testImplementation "com.homeaway.devtools.jenkins:jenkins-spock:${jenkinsSpockVersion}"
testImplementation 'ch.qos.logback:logback-core:1.2.3'
testImplementation 'ch.qos.logback:logback-classic:1.2.3'
testImplementation 'javax.servlet:javax.servlet-api:4.0.1'
testImplementation "org.jenkins-ci.main:jenkins-core:${jenkinsCoreVersion}"
testImplementation 'org.jenkins-ci.plugins.workflow:workflow-cps:2.77'
testImplementation 'org.jenkins-ci.plugins.workflow:workflow-cps-global-lib:2.17'
// provides basic steps like isUnix()
testImplementation 'org.jenkins-ci.plugins.workflow:workflow-basic-steps:2.16'
testImplementation 'org.jenkins-ci.plugins.workflow:workflow-durable-task-step:2.35'
// provides sshagent() step
testImplementation 'org.jenkins-ci.plugins:ssh-agent:1.16'
// provides withAWS() step
implementation "de.taimos:pipeline-aws:${pipelneAWSStepVersion}"
}
jenkinsPlugin {
jenkinsVersion = jenkinsCoreVersion
}
/**
* Global CodeNarc config
*/
codenarc {
toolVersion = codenarcVersion
ignoreFailures = !codenarcEnforce.toBoolean()
configFile = file('config/codenarc.groovy')
maxPriority1Violations = 0
maxPriority2Violations = 0
maxPriority3Violations = 0
}
/**
* Run CodeNarcMain and display Report to console
*/
task codenarcMainReport {
doLast {
println file("${codenarc.reportsDir}/main.txt").text
}
}
codenarcMain {
finalizedBy codenarcMainReport
reports {
text.enabled = true
html.enabled = true
xml.enabled = true
}
}
/**
* Run CodeNarcTest and display Report to console
*/
task codenarcTestReport {
doLast {
println file("${codenarc.reportsDir}/test.txt").text
}
}
codenarcTest {
finalizedBy codenarcTestReport
reports {
text.enabled = true
html.enabled = true
xml.enabled = true
}
}
//tasks.matching {}
tasks.named("codenarcTest") { shouldRunAfter("jacocoTestReport") }
tasks.named("codenarcMain") { shouldRunAfter("jacocoTestReport") }
jacocoTestReport {
dependsOn test
reports {
xml.enabled true
csv.enabled false
html.destination file("${buildDir}/reports/coverage")
}
}
test {
// Single-threading this in case Spock ever decides to do parallel testing
// we cannot support that due to Spock bugs
maxParallelForks = 1
systemProperties = ['root.loglevel': project.findProperty('testLogLevel') ?: 'ERROR',
'root.appender': 'Stdout',
'logdir' : logdir]
// Code Coverage Report
jacoco {
enabled = true
destinationFile = file("$buildDir/jacoco/${name}.exec")
includes = []
excludes = ['jdk.internal.*']
excludeClassLoaders = []
includeNoLocationClasses = true
sessionId = "<auto-generated value>"
dumpOnExit = true
//classDumpDir = file("$buildDir/classes/groovy/main")
output = JacocoTaskExtension.Output.FILE
address = "localhost"
port = 6300
jmx = true
}
finalizedBy jacocoTestReport
}