@@ -8,11 +8,9 @@ buildscript {
8
8
plugins {
9
9
id " idea"
10
10
id " java"
11
- id " maven-publish"
12
- id " com.palantir.git-version" version " 0.12.1"
11
+ id " com.palantir.git-version" version " 3.1.0"
13
12
id " io.spring.dependency-management" version " 1.0.9.RELEASE"
14
13
id " io.franzbecker.gradle-lombok" version " 4.0.0"
15
- id " net.linguica.maven-settings" version " 0.5"
16
14
}
17
15
18
16
group " org.nrg.xnatx.plugins"
@@ -26,7 +24,6 @@ def vJavassist = "3.21.0-GA"
26
24
def vAwaitility = " 2.0.0"
27
25
28
26
repositories {
29
- mavenLocal()
30
27
maven { url " https://nrgxnat.jfrog.io/nrgxnat/libs-release" }
31
28
maven { url " https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot" }
32
29
mavenCentral()
@@ -207,42 +204,35 @@ tasks.register ( 'integrationTest', Test ) {
207
204
test
208
205
}
209
206
210
- // Pulls in the Jenkins BUILD_NUMBER environment variable if available.
211
- def buildDate = new Date ()
212
- def buildNumber = System . getenv(). BUILD_NUMBER ?. toInteger() ?: " Manual"
213
- def isDirty, branchName, gitHash, gitHashFull, commitDistance, lastTag, isCleanTag
214
-
207
+ // Build manifest from git repo information, if available
208
+ def gitDetails, isDirty
215
209
try {
216
- def gitDetails = versionDetails()
210
+ gitDetails = versionDetails()
217
211
isDirty = gitVersion(). endsWith " .dirty"
218
- branchName = gitDetails. branchName ?: " Unknown"
219
- gitHash = gitDetails. gitHash
220
- gitHashFull = gitDetails. gitHashFull
221
- commitDistance = gitDetails. commitDistance
222
- lastTag = gitDetails. lastTag
223
- isCleanTag = gitDetails. isCleanTag
224
- } catch (IllegalArgumentException e) {
212
+ } catch (ignored) {
225
213
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."
214
+ gitDetails = [
215
+ branchName : " Unknown" ,
216
+ gitHash : " None" ,
217
+ gitHashFull : " None" ,
218
+ commitDistance : 0 ,
219
+ lastTag : " None" ,
220
+ isCleanTag : false
221
+ ]
226
222
isDirty = true
227
- branchName = " Unknown"
228
- gitHash = " None"
229
- gitHashFull = " None"
230
- commitDistance = 0
231
- lastTag = " None"
232
- isCleanTag = false
233
223
}
234
224
235
- ext . gitManifest = manifest {
225
+ def sharedManifest = java . manifest {
236
226
attributes " Application-Name" : pluginAppName,
237
- " Build-Date" : buildDate ,
238
- " Build-Number" : buildNumber,
227
+ " Build-Date" : new Date () ,
228
+ " Build-Number" : System . getenv() . BUILD_NUMBER ?. toInteger() ?: " Manual " , // Pulls in the Jenkins BUILD_NUMBER environment variable if available.
239
229
" Implementation-Version" : project. version,
240
- " Implementation-Sha" : gitHash,
241
- " Implementation-Sha-Full" : gitHashFull,
242
- " Implementation-Commit" : commitDistance,
243
- " Implementation-LastTag" : lastTag,
244
- " Implementation-Branch" : branchName,
245
- " Implementation-CleanTag" : isCleanTag,
230
+ " Implementation-Sha" : gitDetails . gitHash,
231
+ " Implementation-Sha-Full" : gitDetails . gitHashFull,
232
+ " Implementation-Commit" : gitDetails . commitDistance,
233
+ " Implementation-LastTag" : gitDetails . lastTag,
234
+ " Implementation-Branch" : gitDetails . branchName ?: " Unknown " ,
235
+ " Implementation-CleanTag" : gitDetails . isCleanTag,
246
236
" Implementation-Dirty" : isDirty
247
237
}
248
238
@@ -257,8 +247,8 @@ task fatJar(type: Jar) {
257
247
exclude " META-INF/*.RSA"
258
248
}
259
249
duplicatesStrategy " exclude"
260
- manifest {
261
- from gitManifest
250
+ manifest = java . manifest {
251
+ from sharedManifest
262
252
}
263
253
with jar
264
254
}
@@ -268,9 +258,9 @@ sourceSets.main.java {
268
258
exclude " */AutoValue.java"
269
259
}
270
260
271
- jar {
272
- manifest {
273
- from gitManifest
261
+ jar {
262
+ manifest = java . manifest {
263
+ from sharedManifest
274
264
}
275
265
doLast {
276
266
if (! gradle. taskGraph. hasTask(" :fatJar" )) {
@@ -281,78 +271,73 @@ jar{
281
271
282
272
task sourceJar (type : Jar , dependsOn : classes) {
283
273
classifier = " sources"
284
- manifest {
285
- from gitManifest
274
+ manifest = java . manifest {
275
+ from sharedManifest
286
276
}
287
277
from sourceSets. main. allSource
288
278
}
289
279
290
280
task javadocJar (type : Jar , dependsOn : javadoc) {
291
281
classifier = " javadoc"
292
- manifest {
293
- from gitManifest
282
+ manifest = java . manifest {
283
+ from sharedManifest
294
284
}
295
285
from javadoc. destinationDir
296
286
}
297
287
298
- publishing {
299
- publications {
300
- mavenJava(MavenPublication ) {
301
- artifacts {
302
- artifact sourceJar
303
- artifact javadocJar
304
- artifact fatJar
305
- }
306
-
307
- pom. withXml {
308
- def root = asNode()
309
- root. appendNode(" name" , pluginAppName)
310
- root. appendNode(" description" , " XNAT plugin for launching and managing containers." )
311
- root. appendNode(" url" , " https://github.com/nrgxnat/container-service" )
312
- root. appendNode(" inceptionYear" , " 2016" )
313
-
314
- def scm = root. appendNode(" scm" )
315
- scm. appendNode(" url" , " https://github.com/nrgxnat/container-service" )
316
- scm. appendNode(" connection" , " scm:https://github.com/nrgxnat/container-service.git" )
317
- scm. appendNode(" developerConnection" , " scm:git@github.com:nrgxnat/container-service" )
318
-
319
- def license = root. appendNode(" licenses" ). appendNode(" license" )
320
- license. appendNode(" name" , " Simplified BSD 2-Clause License" )
321
- license. appendNode(" url" , " https://xnat.org/about/license.php" )
322
- license. appendNode(" distribution" , " repo" )
323
-
324
- def developers = root. appendNode(" developers" )
325
- def flavin = developers. appendNode(" developer" )
326
- flavin. appendNode(" id" , " jflavin" )
327
- flavin. appendNode(" name" , " John Flavin" )
328
- flavin. appendNode(" email" , " jflavin@wustl.edu" )
329
-
330
- def kelsey = developers. appendNode(" developer" )
331
- kelsey. appendNode(" id" , " kelseym" )
332
- kelsey. appendNode(" name" , " Matt Kelsey" )
333
- kelsey. appendNode(" email" , " kelseym@wustl.edu" )
334
-
335
- def will = developers. appendNode(" developer" )
336
- will. appendNode(" id" , " hortonw" )
337
- will. appendNode(" name" , " Will Horton" )
338
- will. appendNode(" email" , " hortonw@wustl.edu" )
339
- }
340
- }
341
- }
342
- repositories {
343
- maven {
344
- if (project. version. endsWith(" -SNAPSHOT" )) {
345
- url " https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot-local"
346
- } else {
347
- url " https://nrgxnat.jfrog.io/nrgxnat/libs-release-local"
348
- }
349
- // The value for name must match <id> in ~/.m2/settings.xml
350
- name = " XNAT_Artifactory"
351
- }
352
- }
353
- }
354
-
355
- def propertyWithDefault (def String property , def Object value ) {
356
- hasProperty(property) ? getProperty(property) : value
357
- }
358
-
288
+ // publishing {
289
+ // publications {
290
+ // mavenJava(MavenPublication) {
291
+ // artifacts {
292
+ // artifact sourceJar
293
+ // artifact javadocJar
294
+ // artifact fatJar
295
+ // }
296
+ //
297
+ // pom.withXml {
298
+ // def root = asNode()
299
+ // root.appendNode("name", pluginAppName)
300
+ // root.appendNode("description", "XNAT plugin for launching and managing containers.")
301
+ // root.appendNode("url", "https://github.com/nrgxnat/container-service")
302
+ // root.appendNode("inceptionYear", "2016")
303
+ //
304
+ // def scm = root.appendNode("scm")
305
+ // scm.appendNode("url", "https://github.com/nrgxnat/container-service")
306
+ // scm.appendNode("connection", "scm:https://github.com/nrgxnat/container-service.git")
307
+ // scm.appendNode("developerConnection", "scm:git@github.com:nrgxnat/container-service")
308
+ //
309
+ // def license = root.appendNode("licenses").appendNode("license")
310
+ // license.appendNode("name", "Simplified BSD 2-Clause License")
311
+ // license.appendNode("url", "https://xnat.org/about/license.php")
312
+ // license.appendNode("distribution", "repo")
313
+ //
314
+ // def developers = root.appendNode("developers")
315
+ // def flavin = developers.appendNode("developer")
316
+ // flavin.appendNode("id", "jflavin")
317
+ // flavin.appendNode("name", "John Flavin")
318
+ // flavin.appendNode("email", "jflavin@wustl.edu")
319
+ //
320
+ // def kelsey = developers.appendNode("developer")
321
+ // kelsey.appendNode("id", "kelseym")
322
+ // kelsey.appendNode("name", "Matt Kelsey")
323
+ // kelsey.appendNode("email", "kelseym@wustl.edu")
324
+ //
325
+ // def will = developers.appendNode("developer")
326
+ // will.appendNode("id", "hortonw")
327
+ // will.appendNode("name", "Will Horton")
328
+ // will.appendNode("email", "hortonw@wustl.edu")
329
+ // }
330
+ // }
331
+ // }
332
+ // repositories {
333
+ // maven {
334
+ // if (project.version.endsWith("-SNAPSHOT")) {
335
+ // url "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot-local"
336
+ // } else {
337
+ // url "https://nrgxnat.jfrog.io/nrgxnat/libs-release-local"
338
+ // }
339
+ // // The value for name must match <id> in ~/.m2/settings.xml
340
+ // name = "XNAT_Artifactory"
341
+ // }
342
+ // }
343
+ // }
0 commit comments