-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
255 lines (224 loc) · 8.79 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
import groovy.transform.Field
import java.text.SimpleDateFormat
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'jacoco'
apply plugin: "io.spring.dependency-management"
apply plugin: 'org.owasp.dependencycheck'
apply plugin: 'com.github.ben-manes.versions'
//// Configuration
group = 'com.lilly.opensource.edat'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
sourceSets {
main {
groovy {
srcDirs = ['src', 'vars', 'sim']
}
}
test {
groovy { srcDirs = ['test/src', 'test/resources', 'test/vars', 'test/sim'] }
}
}
//// Build and Testing
compileGroovy {
options.compilerArgs << '-proc:none'
groovyOptions.configurationScript = file("gradle/config.groovy")
}
compileTestGroovy { options.compilerArgs << '-proc:none' }
test.testLogging {
exceptionFormat "full"
}
repositories {
mavenCentral()
jcenter()
maven { url 'https://repo1.maven.org/maven2/' }
maven { url 'https://repo.jenkins-ci.org/releases/' }
}
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
classpath 'org.owasp:dependency-check-gradle:5.3.2'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.28.0'
}
}
dependencyManagement {
imports {
mavenBom 'com.amazonaws:aws-java-sdk-bom:1.11.485'
}
}
dependencies {
implementation 'org.codehaus.groovy:groovy-all:2.4.15'
implementation 'org.jenkins-ci.main:jenkins-core:2.238'
implementation group: 'org.jenkins-ci.plugins.workflow', name: 'workflow-cps', version: '2.80', ext: 'jar'
implementation group: 'org.jenkins-ci.plugins', name: 'credentials-binding', version: '1.23', ext: 'jar'
implementation group: 'org.jenkins-ci.plugins', name: 'branch-api', version: '2.0.21', ext: 'jar'
implementation group: 'org.jenkins-ci.plugins', name: 'cloudbees-folder', version: '6.7', ext: 'jar'
implementation group: 'org.jenkins-ci.plugins', name: 'scm-api', version: '2.3.0', ext: 'jar'
implementation group: 'org.jenkins-ci.plugins.workflow', name: 'workflow-step-api', version: '2.16', ext: 'jar'
implementation group: 'org.jenkins-ci.plugins.workflow', name: 'workflow-api', version: '2.28', ext: 'jar'
implementation group: 'org.jenkins-ci.plugins.workflow', name: 'workflow-job', version: '2.25', ext: 'jar'
implementation group: 'org.jenkins-ci.plugins.workflow', name: 'workflow-support', version: '2.23', ext: 'jar'
implementation group: 'org.jenkins-ci.plugins.workflow', name: 'workflow-multibranch', version: '2.20', ext: 'jar'
implementation group: 'com.openshift.jenkins.plugins', name: 'openshift-client', version: '1.0.22', ext: 'jar'
implementation group: 'com.cloudbees', name: 'groovy-cps', version: '1.24', ext: 'jar'
implementation group: 'org.jenkins-ci.plugins.workflow', name: 'workflow-durable-task-step', version: '2.26', ext: 'jar'
implementation group: 'org.jenkins-ci.plugins', name: 'durable-task', version: '1.28', ext: 'jar'
implementation group: 'com.amazonaws', name: 'aws-java-sdk-core', version: '1.11.803', ext: 'jar'
implementation group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.11.803', ext: 'jar'
implementation group: 'com.amazonaws', name: 'aws-java-sdk-sts', version: '1.11.803', ext: 'jar'
implementation group: 'org.jenkins-ci.plugins', name: 'cloudbees-folder', version: '6.7', ext: 'jar'
implementation group: 'org.apache.ivy', name: 'ivy', version: '2.4.0', ext: 'jar'
implementation group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1', ext: 'jar'
implementation group: 'org.spockframework', name: 'spock-core', version: '1.2-groovy-2.4', ext: 'jar'
implementation group: 'org.yaml', name: 'snakeyaml', version: '1.23', ext: 'jar'
testImplementation group: 'junit', name: 'junit', version: '4.12', ext: 'jar'
testRuntimeOnly group: 'net.bytebuddy', name: 'byte-buddy', version: '1.8.21', ext: 'jar'
testRuntimeOnly group: 'org.objenesis', name: 'objenesis', version: '2.6', ext: 'jar'
testRuntimeOnly group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25', ext: 'jar'
}
//// Sources and GroovyDoc Jars
task sourcesJar (type: Jar) {
archiveBaseName = project.name
classifier 'sources'
from sourceSets.main.allSource
}
def d = new Date()
def time = new SimpleDateFormat( "HH:mm '(GMT'Z')'" ).format( d )
def date = new SimpleDateFormat( 'MMMM dd, yyyy' ).format( d )
groovydoc {
windowTitle = 'Lilly Jenkins DSL Core'
docTitle = "Lilly Jenkins DSL ${version} API"
header = '<a href="https://github.com/elilillyco/jenkinsdsl" target="_blank">Lilly Jenkins DSL Core</a>'
footer = '<a href="https://github.com/elilillyco/jenkinsdsl" target="_blank">Lilly Jenkins DSL Core</a> API documentation was generated at ' + "$time on $date."
link 'http://download.oracle.com/javase/7/docs/api/', 'java.'
link 'http://docs.groovy-lang.org/latest/html/gapi/', 'groovy.', 'org.codehaus.groovy.'
}
task groovydocJar(type: Jar, dependsOn: groovydoc) {
archiveBaseName = project.name
classifier 'groovydoc'
from groovydoc.destinationDir
}
artifacts {
archives sourcesJar
archives groovydocJar
}
assemble.dependsOn sourcesJar, groovydocJar
//// Maven POM and Publications
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/elilillyco/jenkinsdsl")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
mavenJava(MavenPublication) {
from components.java
// artifact tasks.sourcesJar
// artifact tasks.groovydocJar
pom {
name = "Lilly's Jenkins DSL Core"
description = 'The Jenkins DSL is a project originally developed by engineers from Eli Lilly and Company and DMI\'s Application Development division as the foundation for all of Lilly\'s Enterprise Jenkins pipelines. '
url = 'http://github.com/elilillyco/jenkinsdsl'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'jarrettalexander77'
name = 'Jarrett Alexander'
email = '[email protected]'
url = 'https://github.com/jarrettalexander77'
}
developer {
id = 'lavanyach1'
name = 'Lavanya Chennareddy'
email = '[email protected]'
url = 'https://github.com/lavanyach1'
}
developer {
id = 'delvindefoe'
name = 'Delvin Defoe'
email = '[email protected]'
url = 'https://github.com/delvindefoe'
}
developer {
id = 'jrgarlick'
name = 'Jim Garlick'
email = '[email protected]'
url = 'https://github.com/jrgarlick'
}
developer {
id = 'NickLiffen'
name = 'Nick Liffen'
email = '[email protected]'
url = 'https://github.com/NickLiffen'
}
developer {
id = 'crupakheti'
name = 'Chandan Rupakheti'
email = '[email protected]'
url = 'https://github.com/crupakheti'
}
developer {
id = 'mszewczyk'
name = 'Marc Szewczyk'
email = '[email protected]'
url = 'https://github.com/mszewczyk'
}
}
scm {
connection = 'scm:git:https://github.com/EliLillyCo/jenkinsdsl.git'
developerConnection = 'scm:git:https://github.com/EliLillyCo/jenkinsdsl.git'
url = 'https://github.com/EliLillyCo/jenkinsdsl'
}
}
}
}
}
//// Jacoco Coverage
jacoco {
toolVersion = "0.8.5"
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.enabled true
}
}
test.finalizedBy(jacocoTestReport)
task codeCoverageInfo(dependsOn: jacocoTestReport) {
ext.srcFile = file("${reportsDir}/jacoco/test/jacocoTestReport.xml")
doLast {
println "Parsing code coverage data ..."
def parser = new XmlParser()
parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false);
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
parser.setFeature("http://xml.org/sax/features/namespaces", false)
def reportNode = parser.parse(srcFile)
reportNode.children().each {
if (it.name() == "counter") {
String type = it.@type
float missed = it.@missed as float
float covered = it.@covered as float
float percentage = covered / (missed + covered) * 100
println "Code Coverage[$type]: $percentage%"
}
}
}
}
jacocoTestReport.finalizedBy(codeCoverageInfo)