-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
361 lines (315 loc) · 12.6 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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
buildscript {
ext {
vXnat = "1.9.0"
pluginAppName = "XNAT Container Service"
}
}
plugins {
id "idea"
id "java"
id "maven-publish"
id "com.palantir.git-version" version "0.12.1"
id "io.spring.dependency-management" version "1.0.9.RELEASE"
id "io.franzbecker.gradle-lombok" version "4.0.0"
id "net.linguica.maven-settings" version "0.5"
}
group "org.nrg.xnatx.plugins"
version "3.6.0"
sourceCompatibility = 1.8
targetCompatibility = 1.8
def vMockito = "1.10.19"
def vJavassist = "3.21.0-GA"
def vAwaitility = "2.0.0"
repositories {
mavenLocal()
maven { url "https://nrgxnat.jfrog.io/nrgxnat/libs-release" }
maven { url "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot" }
mavenCentral()
}
dependencyManagement {
imports {
mavenBom("org.nrg:parent:${vXnat}") {
bomProperties([
"mockito.version": vMockito,
"javassist.version": vJavassist
])
}
}
}
def vDockerJava = "3.4.0.1"
def vAutoValue = "1.3"
def vKubernetesClient = "15.0.+"
def vPowerMock = "1.7.0"
def vGson = dependencyManagement.importedProperties["gson.version"]
def vJackson = dependencyManagement.importedProperties["jackson.version"]
def vSpringSecurity = dependencyManagement.importedProperties["spring-security.version"]
def vActiveMQ = dependencyManagement.importedProperties["activemq.version"]
def vBouncyCastle = "1.64" // Included in xnat-web via spring-security-jwt 1.1.1, see XNAT-7907
// Use this configuration to put dependencies into the fat jar
configurations {
implementation.extendsFrom(implementAndInclude)
all {
resolutionStrategy.force "org.mockito:mockito-core:${vMockito}"
}
}
dependencies {
annotationProcessor "org.nrg:framework"
annotationProcessor "com.google.auto.value:auto-value:${vAutoValue}"
compileOnly "com.google.auto.value:auto-value:${vAutoValue}"
implementAndInclude "com.github.docker-java:docker-java-core:${vDockerJava}"
implementAndInclude "com.github.docker-java:docker-java-transport-okhttp:${vDockerJava}"
implementAndInclude ("io.kubernetes:client-java:${vKubernetesClient}") {
exclude group: "com.google.code.gson"
exclude group: "com.google.code.findbugs", module: "jsr305"
exclude group: "commons-codec", module: "commons-codec"
exclude group: "commons-io", module: "commons-io"
exclude group: "org.apache.commons", module: "commons-compress"
exclude group: "org.apache.commons", module: "commons-lang3"
exclude group: "org.slf4j"
exclude group: "org.bouncycastle"
exclude group: "org.yaml", module: "snakeyaml"
exclude group: "com.squareup.okhttp3", module: "okhttp" // Included via docker-java-transport-okhttp
}
implementAndInclude ("io.kubernetes:client-java-api:${vKubernetesClient}") { // Explicitly including to exclude transitive deps
exclude group: "com.google.code.gson"
exclude group: "com.google.code.findbugs", module: "jsr305"
exclude group: "org.apache.commons", module: "commons-lang3"
}
implementAndInclude ("io.kubernetes:client-java-api-fluent:${vKubernetesClient}") { // To use Builder classes
exclude group: "com.google.code.gson"
exclude group: "com.google.code.findbugs", module: "jsr305"
exclude group: "org.apache.commons", module: "commons-lang3"
}
implementAndInclude "org.ahocorasick:ahocorasick:0.6.3"
implementation ("org.nrg.xnat:web") {
transitive = false
}
implementation "org.nrg:framework"
implementation ("org.nrg.xdat:core") {
transitive = false
}
implementation ("org.nrg.xnat:xnat-data-models") {
transitive = false
}
implementation "org.nrg:prefs"
implementation ("org.nrg:notify") {
exclude group: "cglib"
}
implementation ("org.nrg:config") {
exclude group: "cglib"
}
implementation ("org.nrg:automation") {
exclude group: "org.python"
exclude group: "cglib"
}
implementation ("cglib:cglib:2.2.2") {
exclude group: "asm"
}
implementation "org.springframework:spring-beans"
implementation "org.springframework:spring-context"
implementation "org.springframework:spring-core"
implementation "org.springframework:spring-tx"
implementation "org.springframework:spring-web"
implementation "org.springframework:spring-webmvc"
implementation "org.springframework:spring-jms"
implementation "org.springframework:spring-messaging"
implementation "javax.jms:javax.jms-api:2.0.1"
implementation "org.apache.activemq:activemq-all:${vActiveMQ}"
implementation "org.aspectj:aspectjweaver"
implementation "io.springfox:springfox-swagger2"
implementation "io.springfox:springfox-swagger-ui"
implementation "org.hibernate:hibernate-core"
implementation "com.vladmihalcea:hibernate-types-55"
implementation "com.fasterxml.jackson.core:jackson-annotations"
implementation "com.fasterxml.jackson.core:jackson-core"
implementation "com.fasterxml.jackson.core:jackson-databind"
implementation "com.fasterxml.jackson.module:jackson-module-jaxb-annotations:${vJackson}"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-guava:${vJackson}"
implementation "com.jayway.jsonpath:json-path"
implementation "org.slf4j:slf4j-api"
implementation "org.slf4j:slf4j-log4j12"
implementation "commons-lang:commons-lang"
implementation "javax.inject:javax.inject"
implementation "javax.servlet:javax.servlet-api"
implementation ("turbine:turbine") {
transitive = false
}
implementation ("org.apache.velocity:velocity") {
transitive = false
}
implementation ("xalan:xalan") {
transitive = false
}
implementation group: 'javax.interceptor', name: 'javax.interceptor-api', version: '1.2.2'
runtimeOnly "org.bouncycastle:bcpkix-jdk15on:$vBouncyCastle"
runtimeOnly "org.bouncycastle:bcprov-jdk15on:$vBouncyCastle"
runtimeOnly "commons-codec:commons-codec"
runtimeOnly "commons-io:commons-io"
runtimeOnly "org.apache.commons:commons-compress"
runtimeOnly "org.apache.commons:commons-lang3"
runtimeOnly "org.apache.httpcomponents:httpclient"
runtimeOnly "com.google.code.gson:gson:${vGson}"
runtimeOnly "com.google.code.findbugs:jsr305"
runtimeOnly "org.yaml:snakeyaml:1.15+"
testImplementation "junit:junit"
testImplementation "org.hamcrest:hamcrest-library"
testImplementation "org.springframework:spring-test"
testImplementation "org.springframework.security:spring-security-test:${vSpringSecurity}"
testImplementation "org.springframework.security:spring-security-config"
testImplementation "org.mockito:mockito-core"
testImplementation "javax.servlet:javax.servlet-api"
testImplementation "com.h2database:h2"
testImplementation "org.springframework:spring-jdbc"
testImplementation "org.springframework:spring-orm"
testImplementation "org.apache.commons:commons-dbcp2"
testImplementation "commons-net:commons-net"
testImplementation "org.powermock:powermock-module-junit4:${vPowerMock}"
testImplementation "org.powermock:powermock-api-mockito:${vPowerMock}"
testImplementation "org.awaitility:awaitility:${vAwaitility}"
testImplementation "org.testcontainers:junit-jupiter:1.19.0"
testImplementation "org.testcontainers:postgresql:1.19.0"
}
test {
systemProperty "integration", System.getProperty('integration') == "true"
}
tasks.register ( 'unitTest', Test ) {
systemProperties['integration'] = "false"
test
}
tasks.register ( 'integrationTest', Test ) {
systemProperties['integration'] = "true"
test
}
// Pulls in the Jenkins BUILD_NUMBER environment variable if available.
def buildDate = new Date()
def buildNumber = System.getenv().BUILD_NUMBER?.toInteger() ?: "Manual"
def isDirty, branchName, gitHash, gitHashFull, commitDistance, lastTag, isCleanTag
try {
def gitDetails = versionDetails()
isDirty = gitVersion().endsWith ".dirty"
branchName = gitDetails.branchName ?: "Unknown"
gitHash = gitDetails.gitHash
gitHashFull = gitDetails.gitHashFull
commitDistance = gitDetails.commitDistance
lastTag = gitDetails.lastTag
isCleanTag = gitDetails.isCleanTag
} catch (IllegalArgumentException e) {
logger.info "Got an error trying to read VCS metadata from git. It's possible this project is not under VCS control. Using placeholder values for manifest entries."
isDirty = true
branchName = "Unknown"
gitHash = "None"
gitHashFull = "None"
commitDistance = 0
lastTag = "None"
isCleanTag = false
}
ext.gitManifest = manifest {
attributes "Application-Name": pluginAppName,
"Build-Date": buildDate,
"Build-Number": buildNumber,
"Implementation-Version": project.version,
"Implementation-Sha": gitHash,
"Implementation-Sha-Full": gitHashFull,
"Implementation-Commit": commitDistance,
"Implementation-LastTag": lastTag,
"Implementation-Branch": branchName,
"Implementation-CleanTag": isCleanTag,
"Implementation-Dirty": isDirty
}
task fatJar(type: Jar) {
zip64 true
classifier = "fat"
from {
configurations.implementAndInclude.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
duplicatesStrategy "exclude"
manifest {
from gitManifest
}
with jar
}
sourceSets.main.java {
srcDir "generated"
exclude "*/AutoValue.java"
}
jar{
manifest {
from gitManifest
}
doLast {
if (!gradle.taskGraph.hasTask(":fatJar")) {
logger.warn 'WARNING: You should generally run fatJar instead of jar task for this plugin'
}
}
}
task sourceJar(type: Jar, dependsOn: classes) {
classifier = "sources"
manifest {
from gitManifest
}
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
manifest {
from gitManifest
}
from javadoc.destinationDir
}
publishing {
publications {
mavenJava(MavenPublication) {
artifacts {
artifact sourceJar
artifact javadocJar
artifact fatJar
}
pom.withXml {
def root = asNode()
root.appendNode("name", pluginAppName)
root.appendNode("description", "XNAT plugin for launching and managing containers.")
root.appendNode("url", "https://github.com/nrgxnat/container-service")
root.appendNode("inceptionYear", "2016")
def scm = root.appendNode("scm")
scm.appendNode("url", "https://github.com/nrgxnat/container-service")
scm.appendNode("connection", "scm:https://github.com/nrgxnat/container-service.git")
scm.appendNode("developerConnection", "scm:[email protected]:nrgxnat/container-service")
def license = root.appendNode("licenses").appendNode("license")
license.appendNode("name", "Simplified BSD 2-Clause License")
license.appendNode("url", "https://xnat.org/about/license.php")
license.appendNode("distribution", "repo")
def developers = root.appendNode("developers")
def flavin = developers.appendNode("developer")
flavin.appendNode("id", "jflavin")
flavin.appendNode("name", "John Flavin")
flavin.appendNode("email", "[email protected]")
def kelsey = developers.appendNode("developer")
kelsey.appendNode("id", "kelseym")
kelsey.appendNode("name", "Matt Kelsey")
kelsey.appendNode("email", "[email protected]")
def will = developers.appendNode("developer")
will.appendNode("id", "hortonw")
will.appendNode("name", "Will Horton")
will.appendNode("email", "[email protected]")
}
}
}
repositories {
maven {
if (project.version.endsWith("-SNAPSHOT")) {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot-local"
} else {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-release-local"
}
// The value for name must match <id> in ~/.m2/settings.xml
name = "XNAT_Artifactory"
}
}
}
def propertyWithDefault(def String property, def Object value) {
hasProperty(property) ? getProperty(property) : value
}