-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
200 lines (177 loc) · 6.23 KB
/
Copy pathbuild.gradle
File metadata and controls
200 lines (177 loc) · 6.23 KB
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
/*
* xnatx-batch-launch-plugin: build.gradle
* XNAT http://www.xnat.org
* Copyright (c) 2017-2021, Washington University School of Medicine
* All Rights Reserved
*
* Released under the Simplified BSD.
*/
buildscript {
ext {
vXnat = "1.9.2"
}
}
plugins {
id "eclipse"
id "groovy"
id "idea"
id "java-library"
id "maven-publish"
id "com.dorongold.task-tree" version "1.5"
id "com.palantir.git-version" version "0.12.1"
id "io.franzbecker.gradle-lombok" version "4.0.0"
id "io.spring.dependency-management" version "1.0.11.RELEASE"
id "net.linguica.maven-settings" version "0.5"
id "org.nrg.xnat.build.xnat-data-builder" version "${vXnat}"
}
group "org.nrg.xnatx.plugins"
version "0.9.0"
description "XNAT Batch Launch Plugin"
repositories {
mavenLocal()
maven { url "https://nrgxnat.jfrog.io/nrgxnat/libs-release" }
maven { url "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot" }
mavenCentral()
}
configurations {
all {
exclude group: "javax.sql"
exclude group: "javax.transaction"
exclude group: "javax.jms"
}
implementation.extendsFrom(implementAndInclude)
}
dependencies {
implementation platform("org.nrg:parent:${vXnat}")
// Even though container-service plugin version is specified in the parent
// BOM, it needs to be added here because the copyPlugins task in docker-compose
// won't resolve it properly against the BOM.
implementation "org.nrg.xnatx.plugins:container-service:3.2.0:fat"
implementation "org.nrg.xnat:web"
implementation "io.springfox:springfox-swagger2"
}
// 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": project.description,
"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
}
logger.info """
Building artifacts with manifest attributes:
* Build-Date: ${buildDate}
* Build-Number: ${buildNumber}
* Implementation-Version: ${version}
* Implementation-Sha-Full: ${gitHashFull}
* Implementation-Sha: ${gitHash}
* Implementation-Commit: ${commitDistance}
* Implementation-LastTag: ${lastTag}
* Implementation-Branch: ${branchName}
* Implementation-CleanTag: ${isCleanTag}
* Implementation-Dirty: ${isDirty}
"""
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
manifest {
from gitManifest
}
withSourcesJar()
withJavadocJar()
}
task xnatPluginJar(type: Jar) {
dependsOn sourcesJar, javadocJar
zip64 true
archiveClassifier.set "xpl"
manifest {
from gitManifest
}
// files and folders with "-dev" or "--xx" in their name
// will not be in the compiled jar
exclude "**/resources/**/*-dev**"
exclude "**/resources/**/*--xx**"
from {
configurations.implementAndInclude.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
with jar
}
publishing {
publications {
mavenJava(MavenPublication) {
artifacts {
artifact sourcesJar
artifact javadocJar
artifact xnatPluginJar
}
pom.withXml {
def root = asNode()
root.appendNode("name", "XNAT Batch Launch Plugin")
root.appendNode("url", "https://bitbucket.org/xnatx/xnatx-batch-launch-plugin")
root.appendNode("inceptionYear", "2019")
root.appendNode("scm").with {
appendNode("url", "https://bitbucket.org/xnatx/xnatx-batch-launch-plugin")
appendNode("connection", "scm:https://bitbucket.org/xnatx/xnatx-batch-launch-plugin")
appendNode("developerConnection", "scm:git@bitbucket.org:xnatx/xnatx-batch-launch-plugin.git")
}
root.appendNode("licenses").appendNode("license").with {
appendNode("name", "Simplified BSD 2-Clause License")
appendNode("url", "https://xnat.org/about/license.php")
appendNode("distribution", "repo")
}
root.appendNode("developers").with {
appendNode("developer").with {
appendNode("id", "mohana")
appendNode("name", "Mohana Ramaratnam")
appendNode("email", "mohana@radiologics.com")
}
}
}
}
}
repositories {
maven {
name = "XNAT_Artifactory"
if (project.version.endsWith("-SNAPSHOT")) {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot-local"
} else {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-release-local"
}
}
}
}
def propertyWithDefault(String name, Object value) {
hasProperty(name) ? property(name) : value
}