forked from apereo/cas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
408 lines (350 loc) · 13.3 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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
description = "Apereo Central Authentication Service $version"
defaultTasks "clean", "build"
ext {
publishSnapshots = Boolean.getBoolean("publishSnapshots")
publishReleases = Boolean.getBoolean("publishReleases")
sonatypeUsername = System.getProperty("sonatypeUsername")
sonatypePassword = System.getProperty("sonatypePassword")
forceBom = Boolean.getBoolean('forceBom')
enableRemoteDebugging = Boolean.getBoolean("enableRemoteDebugging")
continuousIntegrationBuild = Boolean.getBoolean("CI") || Boolean.getBoolean("TRAVIS") || Boolean.getBoolean("CONTINUOUS_INTEGRATION")
publishingRelease = publishReleases && rootProject.sonatypeUsername != null && rootProject.sonatypePassword != null
/*
Open the Git repository in the current directory.
Get commit id of HEAD.
*/
git = org.ajoberstar.grgit.Grgit.open(dir: file('.').canonicalPath)
def gitHead = git.head()
currentRevision = gitHead.id
currentAbbreviatedRevision = gitHead.abbreviatedId
}
def isArtifactSigningRequired = {
return (publishReleases && sonatypeUsername != null && sonatypePassword != null)
}
apply from: rootProject.file("gradle/overrides.gradle")
apply from: rootProject.file("gradle/dependencies.gradle")
apply plugin: "com.github.kt3k.coveralls"
buildscript {
repositories {
mavenLocal()
jcenter()
maven { url "https://maven.eveoh.nl/content/repositories/releases" }
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://repo.spring.io/plugins-release" }
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
classpath "com.netflix.nebula:gradle-lint-plugin:8.3.2"
classpath "io.franzbecker:gradle-lombok:1.11"
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
classpath "io.spring.gradle:propdeps-plugin:0.0.10.RELEASE"
classpath "org.ajoberstar:grgit:2.1.0"
classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.0.13"
classpath "io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE"
classpath "com.moowork.gradle:gradle-node-plugin:1.2.0"
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlinVersion"
}
}
if (rootProject.continuousIntegrationBuild) {
buildScan {
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
licenseAgree = 'yes'
}
}
allprojects {
apply plugin: "idea"
apply plugin: "eclipse"
apply plugin: "maven"
apply plugin: "signing"
apply plugin: 'com.github.ben-manes.versions'
apply plugin: "jacoco"
if (!rootProject.publishSnapshots) {
apply plugin: "nebula.lint"
gradleLint.rules = ["dependency-parentheses", "dependency-tuple"]
}
if (project.name == "cas-server-support-bom") {
logger.info "Skipping pom generation for [$project.name], letting it create <dependency-management> entries on its own."
} else {
apply from: rootProject.file("gradle/maven.gradle")
}
signing {
required = isArtifactSigningRequired
sign configurations.archives
}
idea {
module {
downloadSources = false
downloadJavadoc = false
excludeDirs = [file(".gradle")]
["classes", "bin", "docs", "dependency-cache", "libs", "reports", "resources", "test-results", "tmp"].each {
excludeDirs << file("$buildDir/$it")
}
}
}
signArchives.enabled = rootProject.publishingRelease || rootProject.publishSnapshots
/*
Do NOT publish test dependencies into the final POM.
*/
conf2ScopeMappings.mappings.remove(configurations.findByName("testCompileOnly"))
conf2ScopeMappings.mappings.remove(configurations.findByName("testRuntimeOnly"))
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
}
subprojects {
task allDependenciesInsight(type: DependencyInsightReportTask,
description: "Produce insight information for all dependencies") {
doLast {}
}
task allDependencies(type: DependencyReportTask,
description: "Display a graph of all project dependencies") {
doLast {}
}
apply plugin: "kotlin"
apply plugin: "kotlin-spring"
apply plugin: "java-library"
if (!Boolean.getBoolean("skipErrorProneCompiler")) {
apply plugin: "net.ltgt.errorprone"
}
apply plugin: "checkstyle"
apply plugin: "io.franzbecker.gradle-lombok"
apply plugin: "findbugs"
apply plugin: "propdeps"
apply plugin: "propdeps-maven"
apply plugin: "propdeps-idea"
apply plugin: "propdeps-eclipse"
apply from: rootProject.file("gradle/tasks.gradle")
ext.libraries = rootProject.ext.libraries
repositories {
mavenLocal()
mavenCentral()
maven { url "https://build.shibboleth.net/nexus/content/repositories/releases" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url "https://repo.spring.io/plugins-release/" }
maven { url "https://dl.bintray.com/uniconiam/maven" }
maven { url "https://jitpack.io" }
jcenter()
}
tasks.withType(JavaCompile) {
// The last argument to disable parameter names is a workaround for: https://github.com/google/error-prone/issues/780
options.compilerArgs += ['-XepAllErrorsAsWarnings', '-Xep:MissingOverride:OFF', '-Xep:ParameterName:OFF']
}
test {
enabled = !Boolean.getBoolean("skipTests")
useJUnit()
scanForTestClasses = false
ignoreFailures = Boolean.getBoolean("ignoreTestFailures")
include "**/*Tests.*"
exclude "**/Abstract*.*","**/Base*.*"
maxParallelForks = 1
classpath = it.classpath + files("${projectDir}/src/main/resources") + files("${projectDir}/src/test/resources")
testLogging {
events = ["FAILED", "STANDARD_OUT"]
exceptionFormat = "full"
showStandardStreams = Boolean.getBoolean("showStandardStreams")
showExceptions = true
showCauses = true
}
}
configurations {
tests
}
configurations.all {
resolutionStrategy {
if (!Boolean.getBoolean("skipVersionConflict")) {
failOnVersionConflict()
}
preferProjectModules()
cacheDynamicVersionsFor 5, 'days'
cacheChangingModulesFor 5, 'days'
/**
* Required for all JRadius modules
*/
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == "gnu-getopt") {
details.useTarget group: "gnu.getopt", name: "java-getopt", version: details.requested.version
}
}
}
exclude(group: "ch.qos.logback", module: "logback-core")
exclude(group: "ch.qos.logback", module: "logback-classic")
exclude(group: "cglib", module: "cglib")
exclude(group: "cglib", module: "cglib-full")
}
artifacts {
tests testJar
if (!rootProject.publishSnapshots) {
archives sourcesJar
archives javadocJar
archives resourcesJar
archives testJar
}
}
sourceSets {
test.resources.srcDirs = ["${projectDir}/src/test/resources", "${projectDir}/src/test/java"]
}
ext.buildDate = null
ext.buildJarFile = new File(project.buildDir, "libs/${project.name}-${project.version}.jar")
compileJava.options.compilerArgs << '-parameters'
compileJava.options.fork = true
if (Boolean.getBoolean("enableIncremental")) {
compileJava.options.incremental = true
}
def currentTime = java.time.ZonedDateTime.now()
compileJava.doLast {
buildDate = currentTime
jar.manifest {
attributes("Implementation-Date": project.buildDate)
}
}
tasks.jar.onlyIf {
project.buildDate != null || !project.buildJarFile.exists()
}
compileKotlin {
kotlinOptions.jvmTarget = "$targetCompatibility"
kotlinOptions.javaParameters = true
}
compileTestKotlin {
kotlinOptions.jvmTarget = "$targetCompatibility"
}
lombok {
version = "$lombokVersion"
}
jar {
manifest {
attributes("Implementation-Title": project.name,
"Implementation-Vendor": project.group,
"Created-By": project.group,
"Specification-Version": rootProject.currentRevision,
"Implementation-Version": project.version)
}
}
checkstyle {
configFile new File(rootDir, "style/checkstyle-rules.xml")
configProperties = ["checkstyle.suppressions.file": new File(rootDir, "style/checkstyle-suppressions.xml")]
ignoreFailures false
showViolations true
toolVersion "${checkstyleVersion}"
}
checkstyleTest {
enabled = !Boolean.getBoolean("skipCheckstyle")
}
checkstyleMain {
enabled = !Boolean.getBoolean("skipCheckstyle")
}
findbugs {
toolVersion = "${findbugsVersion}"
sourceSets = [sourceSets.main]
ignoreFailures = false
reportsDir = file("$project.buildDir/findbugsReports")
effort = "max"
reportLevel = "low"
includeFilter = file("$rootProject.projectDir/style/findbugs-rules.xml")
}
findbugsMain {
enabled = !Boolean.getBoolean("skipFindbugs")
reports {
xml.enabled = false
html.enabled = true
}
}
findbugsTest {
enabled = !Boolean.getBoolean("skipFindbugs")
}
dependencies {
//optional libraries.springcomponentindexer
implementation libraries.aspectj
implementation libraries.validationapi
api libraries.kotlin
api libraries.log4j
api libraries.guava
api libraries.commons
api libraries.jodatime
api libraries.inspektr
api libraries.persondirectory
api libraries.spring
api libraries.jackson
api libraries.httpclient
api libraries.quartz
api libraries.hibernate
api libraries.springcloud
api libraries.springboot
provided libraries.javax
if (!Boolean.getBoolean("skipFindbugs")) {
findbugs libraries.findbugs
findbugs configurations.findbugsPlugins.dependencies
findbugsPlugins libraries.findbugscontrib
findbugsPlugins libraries.findbugssec
}
testImplementation libraries.tests
}
}
task wrapper(type: Wrapper, description: "Gradle wrapper") {
gradleVersion = project.gradleVersion
}
task javadoc(type: Javadoc, description: "Aggregate all Javadocs into a single directory", overwrite: true) {
source subprojects.collect { project -> project.sourceSets.main.allJava }
destinationDir = new File(buildDir, "javadoc")
classpath = files(subprojects.collect { project -> project.sourceSets.main.compileClasspath })
}
task aggregateJavadocsIntoJar(type: Jar, dependsOn: javadoc, description: "Aggregate all Javadocs into a single directory") {
classifier = "javadoc"
from javadoc
}
task rootSourcesJar(type: Jar, description: "Build JAR for the root CAS module") {
baseName = "${project.archivesBaseName}"
from rootProject.file("src")
}
task gradleHome(description: "Display GRADLE_HOME environment variable") {
doFirst {
println "\nexport GRADLE_HOME=" + gradle.gradleHomeDir
}
}
artifacts {
archives aggregateJavadocsIntoJar
archives rootSourcesJar
}
task jacocoAggregateReport(type: JacocoReport, description: "Aggregate all test reports into a single directory") {
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(files(subprojects.sourceSets.main.output).collect {
fileTree(dir: it,
include: '**/*.class',
exclude: [
'**/**Configuration.class',
'**/**Configuration$**',
'**/**Application.class',
'**/**Application$**',
'**/**WebflowConfigurer.class',
'**/**WebflowConfigurer$**',
'**/**Exception.class',
'**/**Exception$**',
'**/**Properties.class',
'**/**Properties$**'
])
})
executionData = files(subprojects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
}
doFirst {
executionData = files(executionData.findAll {
it.exists()
})
}
}
coveralls {
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoAggregateReport/jacocoAggregateReport.xml"
sourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs).files.absolutePath
}
tasks.coveralls {
group = "Coverage reports"
description = "Uploads the aggregated coverage report to Coveralls"
dependsOn jacocoAggregateReport
}