-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
257 lines (227 loc) · 7.59 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
/*
* xnat-ldap-auth-plugin: build.gradle
* XNAT http://www.xnat.org
* Copyright (c) 2018, Washington University School of Medicine
* All Rights Reserved
*
* Released under the Simplified BSD.
*/
buildscript {
ext {
vXnat = "1.7.5"
vGitPlugin = "0.12.0-rc2"
vLombokPlugin = "1.14"
vDepMgmtPlugin = "1.0.6.RELEASE"
}
repositories {
mavenLocal()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-release"
name "XNAT Release Repository"
}
maven {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot"
name "XNAT Snapshot Repository"
}
}
dependencies {
classpath "gradle.plugin.com.palantir.gradle.gitversion:gradle-git-version:${vGitPlugin}"
classpath "io.franzbecker:gradle-lombok:${vLombokPlugin}"
classpath "io.spring.gradle:dependency-management-plugin:${vDepMgmtPlugin}"
classpath "org.nrg.xnat.build:xnat-data-builder:${vXnat}"
}
}
apply plugin: "application"
apply plugin: "com.palantir.git-version"
apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "io.franzbecker.gradle-lombok"
apply plugin: "io.spring.dependency-management"
apply plugin: "jacoco"
apply plugin: "java"
apply plugin: "maven"
apply plugin: "maven-publish"
apply plugin: "xnat-data-builder"
group "org.nrg.xnat.auth"
version "1.0.0"
repositories {
mavenLocal()
maven {
url "http://maven.imagej.net/content/groups/public"
name "ImageJ Maven Repository"
}
jcenter()
mavenCentral()
maven {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-release"
name "XNAT Release Repository"
}
maven {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot"
name "XNAT Snapshot Repository"
}
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencyManagement.imports {
mavenBom "org.nrg:parent:${vXnat}"
}
dependencies {
annotationProcessor "org.nrg:framework"
implementation("org.nrg.xnat:web") {
transitive = false
}
implementation("org.nrg.xnat:xnat-data-models") {
transitive = false
}
implementation("org.nrg.xdat:core") {
transitive = false
}
implementation("org.nrg:prefs") {
transitive = false
}
implementation("org.nrg:framework") {
transitive = false
}
implementation "org.springframework:spring-web"
implementation "org.springframework.security:spring-security-config"
implementation "org.springframework.security:spring-security-ldap"
implementation "org.apache.commons:commons-lang3"
implementation "org.hibernate.javax.persistence:hibernate-jpa-2.1-api"
implementation "com.google.guava:guava"
implementation "org.slf4j:slf4j-api"
implementation "log4j:log4j"
implementation "org.springframework.security:spring-security-web"
implementation "javax.servlet:javax.servlet-api"
compileOnly "com.google.code.findbugs:jsr305"
compileOnly "org.apache.ivy:ivy:2.4.0"
compileOnly("stratum:stratum") {
transitive = false
}
testImplementation "junit:junit"
testImplementation "org.springframework:spring-test"
}
idea {
module {
inheritOutputDirs = false
outputDir = compileJava.destinationDir
testOutputDir = compileTestJava.destinationDir
}
}
if (hasProperty("rt.17.jar")) {
// Solution for bootstrap classpath warning and possible issues with compatibility with 1.7 libraries
// was taken from this post on discuss.gradle.org: http://bit.ly/24xD9j0
def rt17jar = property "rt.17.jar"
logger.info "Using ${rt17jar} as the bootstrap class path jar."
gradle.projectsEvaluated {
tasks.withType(JavaCompile) { task ->
task.options.fork = true
task.options.compilerArgs << "-XDignore.symbol.file"
task.options.bootstrapClasspath = files(rt17jar)
}
}
} else {
logger.warn "No value was set for the rt.17.jar build property, using the default bootstrap class path. You should consider setting rt.17.jar to indicate a jar file containing the Java 1.7 run-time library:\n"
logger.warn " ./gradlew -Prt.17.jar=rt-1.7.0_45.jar war\n"
}
jar {
baseName = "xnat-${project.name}"
manifest {
attributes "Application-Name": "XNAT LDAP Authentication Provider",
"Build-Date": new Date(),
"Implementation-Sha": gitVersion(),
"Implementation-Version": version
}
}
compileJava {
options.fork = false
}
configurations {
compile.extendsFrom(compileAndInclude)
}
jacoco {
toolVersion = dependencyManagement.importedProperties["jacoco.version"] as String
}
jacocoTestReport {
dependsOn test
reports {
xml.enabled = false
csv.enabled = false
html.destination file("${buildDir}/jacocoHtml")
}
}
lombok {
version = dependencyManagement.importedProperties["lombok.version"]
sha256 = dependencyManagement.importedProperties["lombok.checksum"]
}
task fatJar(type: Jar) {
zip64 true
baseName = project.name + "-all"
from {
configurations.compileAndInclude.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
with jar
}
publishing.publications {
mavenJava(MavenPublication) {
from components.java
pom.withXml {
def root = asNode()
root.appendNode("name", "XNAT LDAP Authentication Plugin")
root.appendNode("url", "https://bitbucket.org/xnatx/xnat-ldap-auth-plugin")
root.appendNode("inceptionYear", "2018")
def scm = root.appendNode("scm")
scm.appendNode("url", "https://bitbucket.org/xnatx/xnat-ldap-auth-plugin")
scm.appendNode("connection", "scm:https://bitbucket.org/xnatx/xnat-ldap-auth-plugin")
scm.appendNode("developerConnection", "scm:[email protected]:xnatx/xnat-ldap-auth-plugin.git")
def license = root.appendNode("licenses").appendNode("license")
license.appendNode("name", "Simplified BSD 2-Clause License")
license.appendNode("url", "http://xnat.org/about/license.php")
license.appendNode("distribution", "repo")
root.appendNode("developers").with {
def rherrick = appendNode("developer")
rherrick.appendNode("id", "rherrick")
rherrick.appendNode("name", "Rick Herrick")
rherrick.appendNode("email", "[email protected]")
}
}
}
}
publishing.repositories {
maven {
credentials {
// These properties must be set in the ~/.gradle/gradle.properties file or passed on the Gradle command
// line in the form -PrepoUsername=foo -PrepoPassword=bar.
username propertyWithDefault("repoUsername", "username")
password propertyWithDefault("repoPassword", "password")
}
if (project.version.endsWith("-SNAPSHOT")) {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot-local"
} else {
url "https://nrgxnat.jfrog.io/nrgxnat/libs-release-local"
}
}
}
sourceSets {
main {
java {
srcDir "src/main/java"
srcDir "build/xnat-generated/src/main/java"
}
resources {
srcDir "src/main/resources"
srcDir "build/xnat-generated/src/main/resources"
}
}
}
def propertyWithDefault(String name, Object value) {
hasProperty(name) ? property(name) : value
}