-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathbuild.gradle
More file actions
267 lines (232 loc) · 9.79 KB
/
build.gradle
File metadata and controls
267 lines (232 loc) · 9.79 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
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
plugins {
id 'org.springframework.boot' version '4.0.5'
id 'io.spring.dependency-management' version '1.1.7'
id 'com.github.ben-manes.versions' version '0.54.0'
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.vanniktech.maven.publish' version '0.36.0'
id 'net.researchgate.release' version '3.1.0'
}
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar
group = 'com.digitalsanctuary'
description = 'Spring User Framework'
ext {
lombokVersion = '1.18.44'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
}
dependencies {
// Spring Boot starters
compileOnly 'org.springframework.boot:spring-boot-starter-actuator'
compileOnly 'org.springframework.boot:spring-boot-starter-data-jpa'
compileOnly 'org.springframework.boot:spring-boot-starter-jdbc'
compileOnly 'org.springframework.boot:spring-boot-starter-mail'
compileOnly 'org.springframework.boot:spring-boot-starter-oauth2-client'
compileOnly 'org.springframework.boot:spring-boot-starter-security'
compileOnly 'org.springframework.boot:spring-boot-starter-thymeleaf'
compileOnly 'org.springframework.boot:spring-boot-starter-web'
// Note: thymeleaf-extras-springsecurity6 is compatible with Spring Security 7
// No springsecurity7 artifact exists yet - Thymeleaf team uses springsecurity6 for 6.x+
compileOnly 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6:3.1.4.RELEASE'
compileOnly 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:4.0.1'
// Other dependencies (moved to test scope for library)
implementation 'org.passay:passay:2.0.0'
implementation 'com.google.guava:guava:33.6.0-jre'
implementation 'org.apache.commons:commons-text:1.15.0'
compileOnly 'jakarta.validation:jakarta.validation-api:3.1.1'
compileOnly 'org.springframework.retry:spring-retry:2.0.12'
// WebAuthn support (Passkey authentication)
compileOnly 'org.springframework.security:spring-security-webauthn'
// Lombok dependencies
compileOnly "org.projectlombok:lombok:$lombokVersion"
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
// Lombok dependencies for test classes
testCompileOnly "org.projectlombok:lombok:$lombokVersion"
testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion"
// Test dependencies
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa'
testImplementation 'org.springframework.boot:spring-boot-starter-mail'
testImplementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
testImplementation 'org.springframework.boot:spring-boot-starter-security'
testImplementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.springframework.security:spring-security-webauthn'
testImplementation 'org.springframework.retry:spring-retry:2.0.12'
testImplementation 'jakarta.validation:jakarta.validation-api:3.1.1'
testImplementation 'org.hibernate.validator:hibernate-validator:9.1.0.Final'
testImplementation 'com.h2database:h2:2.4.240'
// Spring Boot 4 test starters (modular test infrastructure)
testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa-test'
testImplementation 'org.springframework.boot:spring-boot-webmvc-test'
testImplementation 'org.springframework.boot:spring-boot-jdbc-test'
// Runtime dependencies moved to test scope for library
testRuntimeOnly 'org.springframework.boot:spring-boot-devtools'
testRuntimeOnly 'org.mariadb.jdbc:mariadb-java-client'
testRuntimeOnly 'org.postgresql:postgresql'
// Additional test dependencies for improved testing
testImplementation 'org.testcontainers:testcontainers:2.0.4'
testImplementation 'org.testcontainers:testcontainers-junit-jupiter:2.0.4'
testImplementation 'org.testcontainers:testcontainers-mariadb:2.0.4'
testImplementation 'org.testcontainers:testcontainers-postgresql:2.0.4'
testImplementation 'com.github.tomakehurst:wiremock:3.0.1'
testImplementation 'com.tngtech.archunit:archunit-junit5:1.4.1'
testImplementation 'org.assertj:assertj-core:3.27.7'
testImplementation 'io.rest-assured:rest-assured:6.0.0'
testImplementation 'com.icegreen:greenmail:2.1.8'
testImplementation 'org.awaitility:awaitility:4.3.0'
}
tasks.named('bootJar') {
enabled = false
}
test {
useJUnitPlatform()
jvmArgs '-XX:+EnableDynamicAgentLoading', '-Xshare:off'
// Enable parallel execution for faster test runs
systemProperty 'junit.jupiter.execution.parallel.enabled', 'true'
systemProperty 'junit.jupiter.execution.parallel.mode.default', 'concurrent'
systemProperty 'junit.jupiter.execution.parallel.mode.classes.default', 'concurrent'
// Use available CPU cores - 1 for parallel execution
systemProperty 'junit.jupiter.execution.parallel.config.strategy', 'dynamic'
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
def isExplicitTest = gradle.startParameter.taskNames.any {
it == 'test' || it == 'testAll' || it.startsWith('testJdk')
}
testLogging {
events "PASSED", "FAILED", "SKIPPED"
if (isExplicitTest) {
exceptionFormat = "full"
showStandardStreams true
} else {
exceptionFormat = "short"
}
}
}
tasks.named('jar') {
enabled = true
archiveBaseName.set('ds-spring-user-framework')
archiveClassifier.set('')
}
// Configure Javadoc to suppress warnings for missing constructor documentation
// This is necessary because Lombok generates constructors that cannot be documented
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:all,-missing', '-quiet')
}
def registerJdkTestTask(name, jdkVersion) {
tasks.register(name, Test) {
javaLauncher.set(javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(jdkVersion)
})
testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
useJUnitPlatform()
jvmArgs '-XX:+EnableDynamicAgentLoading', '-Xshare:off'
// Enable parallel execution for JDK-specific tests
systemProperty 'junit.jupiter.execution.parallel.enabled', 'true'
systemProperty 'junit.jupiter.execution.parallel.mode.default', 'concurrent'
systemProperty 'junit.jupiter.execution.parallel.mode.classes.default', 'concurrent'
systemProperty 'junit.jupiter.execution.parallel.config.strategy', 'dynamic'
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
def isExplicitTest = gradle.startParameter.taskNames.any {
it == 'test' || it == 'testAll' || it.startsWith('testJdk')
}
testLogging {
events "PASSED", "FAILED", "SKIPPED"
if (isExplicitTest) {
exceptionFormat = "full"
showStandardStreams true
} else {
exceptionFormat = "short"
}
}
doFirst {
println("Running tests with JDK $jdkVersion")
}
}
}
registerJdkTestTask('testJdk17', 17)
registerJdkTestTask('testJdk21', 21)
// Optional task that runs tests with multiple JDKs
tasks.register('testAll') {
dependsOn(tasks.named('testJdk17'), tasks.named('testJdk21'))
doFirst {
println("Running tests with both JDK 17 and JDK 21")
}
}
// Maven Central Publishing Tasks
mavenPublishing {
configure(new JavaLibrary(new JavadocJar.Javadoc(), true))
// publishToMavenCentral() is now configured via gradle.properties
signAllPublications()
coordinates("com.digitalsanctuary", "ds-spring-user-framework", project.version)
pom {
name = "DS Spring User Framework"
description = "Simple SpringBoot User Library built on top of Spring Security."
inceptionYear = "2024"
url = "https://github.com/devondragon/SpringUserFramework"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
id = "devondragon"
name = "Devon Hillard"
url = "https://github.com/devondragon/"
}
}
scm {
url = "https://github.com/devondragon/SpringUserFramework"
connection = "scm:git:git@github.com:devondragon/SpringUserFramework.git"
developerConnection = "scm:git:ssh://git@github.com:devondragon/SpringUserFramework.git"
}
}
}
tasks.named("publishMavenPublicationToMavenCentralRepository") {
dependsOn("signMavenPublication")
}
publishing {
repositories {
maven {
name = 'reposiliteRepository'
url = uri('https://reposilite.tr0n.io/private')
credentials(PasswordCredentials)
authentication {
basic(BasicAuthentication)
}
}
// more repositories can go here
}
}
// Maven Publishing Aliases
tasks.register("publishReposilite") {
dependsOn("publishMavenPublicationToReposiliteRepository")
}
tasks.register("publishMavenCentral") {
dependsOn("publishAndReleaseToMavenCentral")
}
tasks.register("publishLocal") {
dependsOn("publishToMavenLocal")
}
task generateAIChangelog(type: Exec) {
def newVersion = project.version
commandLine 'mise', 'x', '--', 'python', 'generate_changelog.py', newVersion
}
release {
beforeReleaseBuild.dependsOn generateAIChangelog
// afterReleaseBuild.dependsOn publishReposilite
afterReleaseBuild.dependsOn publishMavenCentral
}