forked from spring-attic/spring-security-saml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
297 lines (248 loc) · 8.4 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
/*
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
buildscript {
repositories {
maven { url "https://repo.spring.io/plugins-release" }
jcenter()
gradlePluginPortal()
}
dependencies {
classpath("org.springframework.build.gradle:propdeps-plugin:0.0.7")
classpath("org.springframework.build.gradle:spring-io-plugin:0.0.3.RELEASE")
classpath("org.gradle.api.plugins:gradle-tomcat-plugin:1.2.4")
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.1.0'
classpath 'io.spring.gradle:spring-build-conventions:0.0.23.RELEASE'
}
}
apply plugin: 'io.spring.convention.root'
def coreProjects = subprojects.findAll { !it.name.contains("sample") }
configure(allprojects) { project ->
group = "org.springframework.security.extensions"
ext.slf4jVersion = "1.7.25"
ext.springVersion = "5.2.0.RELEASE"
ext.springSecurityVersion = "5.2.0.RELEASE"
ext.bcprovVersion = "1.64"
ext.bcpkixVersion = "1.64"
ext.openSamlVersion = "3.4.3"
ext.commonsLoggingVersion = "1.2"
ext.gradleScriptDir = "${rootProject.projectDir}/gradle"
ext.junitVersion = "5.1.0"
ext.jaxbApiVersion = "2.3.1"
ext.mockitoVersion = "3.1.0"
ext.byteBuddyVersion = "1.9.10"
apply plugin: "propdeps"
apply plugin: "java"
apply from: "${gradleScriptDir}/ide.gradle"
apply plugin: 'org.junit.platform.gradle.plugin'
compileJava {
sourceCompatibility=1.8
targetCompatibility=1.8
}
compileTestJava {
sourceCompatibility=1.8
targetCompatibility=1.8
}
test {
systemProperty("java.awt.headless", "true")
maxParallelForks = project.maxParallelForks as int
}
repositories {
mavenCentral()
}
dependencies {
testCompile(group: "org.junit.jupiter", name: "junit-jupiter-api", version: "$junitVersion")
testCompile(group: "org.junit.jupiter", name: "junit-jupiter-engine", version: "$junitVersion")
}
ext.javadocLinks = [
] as String[]
}
configure(subprojects) { subproject ->
apply from: "${gradleScriptDir}/publish-maven.gradle"
}
configure(coreProjects) { p ->
apply plugin: 'spring-io'
ext.springIoVersion = project.hasProperty('platformVersion') ? platformVersion : 'Brussels-SR6'
configurations {
springIoTestRuntime {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.name == 'servlet-api') {
details.useTarget 'javax.servlet:javax.servlet-api:3.1.0'
}
}
}
// springIo knows all transitive dependencies for Spring Security 4
springSecurity4TestRuntime.extendsFrom springIoTestRuntime
// springIo does not yet use Spring Security 4, so force it to be Spring Security 4
springSecurity4TestRuntime.incoming.beforeResolve { resolvable ->
springSecurity4TestRuntime.resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'org.springframework.security') {
details.useVersion '4.0.0.RELEASE'
}
}
}
}
task springSecurity4Test(type: Test) {
jvmArgs = ['-ea', '-Xmx500m', '-XX:MaxPermSize=128M']
classpath = sourceSets.test.output + sourceSets.main.output + configurations.springSecurity4TestRuntime
reports {
html.destination = project.file("$project.buildDir/reports/spring-io-springsecurity4-tests/")
junitXml.destination = project.file("$project.buildDir/spring-io-springsecurity4-test-results/")
}
}
check.dependsOn springSecurity4Test
dependencies {
springIoVersions "io.spring.platform:platform-versions:${springIoVersion}@properties"
}
jar {
manifest.attributes["Created-By"] =
"${System.getProperty("java.version")} (${System.getProperty("java.specification.vendor")})"
manifest.attributes["Implementation-Title"] = p.name
manifest.attributes["Implementation-Version"] = p.version
from("${rootProject.projectDir}/docs/dist") {
include "license.txt"
into "META-INF"
expand(copyright: new Date().format("yyyy"), version: project.version)
}
}
javadoc {
description = "Generates project-level javadoc for use in -javadoc jar"
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = project.name
options.links(project.ext.javadocLinks)
// suppress warnings due to cross-module @see and @link references;
// note that global 'api' task does display all warnings.
logging.captureStandardError LogLevel.INFO
logging.captureStandardOutput LogLevel.INFO // suppress "## warnings" message
}
task sourcesJar(type: Jar, dependsOn:classes) {
classifier = "sources"
from sourceSets.main.allJava.srcDirs
include "**/*.java", "**/*.aj"
}
task javadocJar(type: Jar) {
classifier = "javadoc"
from javadoc
}
artifacts {
archives sourcesJar
archives javadocJar
}
}
configure(rootProject) {
description = "Spring Security SAML"
// don't publish the default jar for the root project
configurations.archives.artifacts.clear()
task api(type: Javadoc) {
group = "Documentation"
description = "Generates aggregated Javadoc API documentation."
title = "${rootProject.description} ${version} API"
dependsOn {
coreProjects.collect {
it.tasks.getByName("jar")
}
}
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = rootProject.description
options.splitIndex = true
options.links(project.ext.javadocLinks)
source coreProjects.collect { project ->
project.sourceSets.main.allJava
}
destinationDir = new File(buildDir, "api")
doFirst {
classpath += files(coreProjects.collect { it.sourceSets.main.compileClasspath })
}
}
task docsZip(type: Zip) {
group = "Distribution"
baseName = "spring-security-saml"
classifier = "docs"
description = "Builds -${classifier} archive containing api and reference " +
"for deployment at https://docs.spring.io/spring-security-saml/docs."
from (api) {
into "api"
}
}
task distZip(type: Zip, dependsOn: [docsZip]) {
group = "Distribution"
baseName = "spring-security-saml"
classifier = "dist"
description = "Builds -${classifier} archive, containing all jars and docs, " +
"suitable for community download page."
ext.baseDir = "${baseName}-${project.version}"
from("docs/dist") {
include "readme.txt"
include "license.txt"
include "notice.txt"
into "${baseDir}"
expand(copyright: new Date().format("yyyy"), version: project.version)
}
from(zipTree(docsZip.archivePath)) {
into "${baseDir}/docs"
}
from("sample") {
include "src/**/*"
include "pom.xml"
into "${baseDir}/sample"
}
coreProjects.each { subproject ->
into ("${baseDir}/libs") {
from subproject.jar
if (subproject.tasks.findByPath("sourcesJar")) {
from subproject.sourcesJar
}
if (subproject.tasks.findByPath("javadocJar")) {
from subproject.javadocJar
}
}
}
}
// Create an distribution that contains all dependencies (required and optional).
// Not published by default; only for use when building from source.
task depsZip(type: Zip, dependsOn: distZip) { zipTask ->
group = "Distribution"
baseName = "spring-security-saml"
classifier = "dist-with-deps"
description = "Builds -${classifier} archive, containing everything " +
"in the -${distZip.classifier} archive plus all runtime dependencies."
from zipTree(distZip.archivePath)
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(":${zipTask.name}")) {
def projectNames = rootProject.subprojects*.name
def artifacts = new HashSet()
coreProjects.each { subproject ->
(subproject.configurations.runtime.resolvedConfiguration.resolvedArtifacts +
subproject.configurations.optional.resolvedConfiguration.resolvedArtifacts).each { artifact ->
def dependency = artifact.moduleVersion.id
if (!projectNames.contains(dependency.name)) {
artifacts << artifact.file
}
}
}
zipTask.from(artifacts) {
into "${distZip.baseDir}/deps"
}
}
}
}
artifacts {
archives docsZip
archives distZip
}
}