-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathbuild.gradle
207 lines (178 loc) · 6.28 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
plugins {
id 'org.springframework.boot' version '3.4.1'
id 'io.spring.dependency-management' version '1.1.7'
id 'com.github.ben-manes.versions' version '0.51.0'
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.vanniktech.maven.publish' version '0.30.0'
id 'net.researchgate.release' version '3.1.0'
}
import com.vanniktech.maven.publish.SonatypeHost
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar
group = 'com.digitalsanctuary.springuser'
// version = '3.0.0-SNAPSHOT'
description = 'Spring User Framework'
ext {
springBootVersion = '3.4.1'
lombokVersion = '1.18.36'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
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:$springBootVersion"
compileOnly 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6:3.1.3.RELEASE'
compileOnly 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:3.3.0'
// Other dependencies
runtimeOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client:3.5.1'
runtimeOnly 'org.postgresql:postgresql'
implementation 'org.passay:passay:1.6.6'
implementation 'com.google.guava:guava:33.4.0-jre'
compileOnly 'org.springframework.boot:spring-boot-starter-actuator'
compileOnly 'jakarta.validation:jakarta.validation-api:3.1.0'
// Lombok dependencies
compileOnly "org.projectlombok:lombok:$lombokVersion"
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor:$springBootVersion"
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:$springBootVersion"
testImplementation "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'com.h2database:h2:2.3.232'
}
tasks.named('bootJar') {
enabled = false
}
test {
useJUnitPlatform()
testLogging {
events "PASSED", "FAILED", "SKIPPED"
}
}
tasks.named('jar') {
enabled = true
archiveBaseName.set('ds-spring-ai-client')
archiveClassifier.set('')
}
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()
testLogging {
events "PASSED", "FAILED", "SKIPPED"
}
doFirst {
println("Running tests with JDK $jdkVersion")
}
}
}
registerJdkTestTask('testJdk17', 17)
registerJdkTestTask('testJdk21', 21)
// Task that runs both test tasks
tasks.register('testAll') {
dependsOn(tasks.named('testJdk17'), tasks.named('testJdk21'))
doFirst {
println("Running tests with both JDK 17 and JDK 21")
}
}
// Make the default 'test' task depend on 'testAll'
tasks.test {
dependsOn(tasks.named('testAll'))
doFirst {
println("Delegating to 'testAll'")
}
// Prevent the default test behavior
testClassesDirs = files()
classpath = files()
}
// Maven Central Publishing Tasks
mavenPublishing {
configure(new JavaLibrary(new JavadocJar.Javadoc(), true))
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
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:[email protected]:devondragon/SpringUserFramework.git"
developerConnection = "scm:git:ssh://[email protected]: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
}