forked from spring-attic/spring-security-saml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
257 lines (216 loc) · 7.1 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
/*
* 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.
*
*/
plugins {
id 'io.spring.dependency-management' version "1.1.4"
}
def coreProjects = subprojects.findAll { !it.name.contains("sample") }
configure(allprojects) { project ->
group = "de.governikus.spring.security.extensions"
ext.slf4jVersion = "2.0.7"
ext.springVersion = "6.0.10"
ext.springSecurityVersion = "6.1.1"
ext.bcprovVersion = "1.78.1"
ext.bcpkixVersion = "1.78.1"
ext.openSamlVersion = "4.3.0"
ext.gradleScriptDir = "${rootProject.projectDir}/gradle"
ext.junitVersion = "5.9.3"
ext.jaxbApiVersion = "4.0.2"
ext.mockitoVersion = "5.0.0"
ext.byteBuddyVersion = "1.12.8"
ext.httpClient = "5.2.1"
apply plugin: "java"
apply from: "${gradleScriptDir}/ide.gradle"
compileJava {
sourceCompatibility=17
targetCompatibility=17
}
compileTestJava {
sourceCompatibility=17
targetCompatibility=17
}
test {
useJUnitPlatform()
systemProperty("java.awt.headless", "true")
maxParallelForks = project.maxParallelForks as int
}
repositories {
mavenCentral()
maven { url "https://build.shibboleth.net/nexus/content/repositories/releases" }
}
dependencies {
testImplementation (group: "org.junit.jupiter", name: "junit-jupiter-api", version: "$junitVersion")
testImplementation (group: "org.junit.jupiter", name: "junit-jupiter-engine", version: "$junitVersion")
testImplementation (group: "org.junit.jupiter", name: "junit-jupiter-params", version: "$junitVersion")
testImplementation (group: "org.junit.platform", name: "junit-platform-launcher", version: "1.8.2")
}
ext.javadocLinks = [
] as String[]
}
configure(subprojects) { subproject ->
apply from: "${gradleScriptDir}/publish-maven.gradle"
}
configure(coreProjects) { p ->
configurations {
testImplementation.extendsFrom compileOnly
}
jar {
manifest {
attributes(
"Created-By": "${System.getProperty("java.version")} (${System.getProperty("java.specification.vendor")})",
"Implementation-Title": p.name,
"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 {
failOnError = false
description = "Generates project-level javadoc for use in -javadoc jar"
options {
memberLevel = JavadocMemberLevel.PROTECTED
author = true
header = project.name
}
logging.captureStandardError LogLevel.INFO
logging.captureStandardOutput LogLevel.INFO
}
tasks.register('sourcesJar', Jar) {
dependsOn classes
archiveClassifier = "sources"
from sourceSets.main.allJava.srcDirs
include "**/*.java", "**/*.aj"
}
tasks.register('javadocJar', Jar) {
archiveClassifier = "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) {
failOnError = false
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"
archiveBaseName = "spring-security-saml"
archiveClassifier = "docs"
description = "Builds -${archiveClassifier} 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"
archiveBaseName = "spring-security-saml"
archiveClassifier = "dist"
description = "Builds -${archiveClassifier} archive, containing all jars and docs, " +
"suitable for community download page."
ext.baseDir = "${archiveBaseName}-${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"
archiveBaseName = "spring-security-saml"
archiveClassifier = "dist-with-deps"
description = "Builds -${archiveClassifier } archive, containing everything " +
"in the -${distZip.archiveClassifier } archive plus all runtime dependencies."
from zipTree(distZip.archiveFile)
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
}
}