-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
180 lines (155 loc) · 5.11 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
plugins {
id 'io.spring.dependency-management' version '1.1.7'
id 'com.github.ben-manes.versions' version '0.52.0'
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.vanniktech.maven.publish' version '0.31.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.cf.turnstile'
// version '1.1.6-SNAPSHOT'
description = 'SpringBoot Cloudflare Turnstile Library'
ext {
springBootVersion = '3.4.4'
lombokVersion = '1.18.36'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
}
dependencies {
// Spring Boot dependencies
compileOnly "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
compileOnly "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
// 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"
// Testing dependencies
testImplementation "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
testImplementation "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
testImplementation "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
}
test {
useJUnitPlatform()
}
tasks.named('jar') {
enabled = true
archiveBaseName.set('ds-spring-cf-turnstile')
archiveClassifier.set('')
}
// Run tests with different JDK versions
tasks.register('testJdk17', Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
}
testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
useJUnitPlatform()
doFirst {
println("Running tests with JDK 17")
}
}
tasks.register('testJdk21', Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(21)
}
testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
useJUnitPlatform()
doFirst {
println("Running tests with JDK 21")
}
}
// Task that runs both test tasks
tasks.register('testAll') {
dependsOn(tasks.named('testJdk17'), tasks.named('testJdk21'))
}
// Ensure the default 'test' task triggers both test tasks
tasks.test {
dependsOn(tasks.named('testAll'))
}
// Maven Central Publishing Tasks
mavenPublishing {
configure(new JavaLibrary(new JavadocJar.Javadoc(), true))
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
signAllPublications()
coordinates("com.digitalsanctuary", "ds-spring-cf-turnstile", project.version)
pom {
name = "Spring Cloudflare Turnstile Library"
description = "SpringBoot Cloudflare Turnstile Library"
inceptionYear = "2024"
url = "https://github.com/devondragon/SpringCFTurnstile"
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/SpringCFTurnstile"
connection = "scm:git:[email protected]:devondragon/SpringCFTurnstile.git"
developerConnection = "scm:git:ssh://[email protected]:devondragon/SpringCFTurnstile.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")
// doFirst {
// project.gradle.startParameter.configurationCache = false
// }
}
tasks.register("publishLocal") {
dependsOn("publishToMavenLocal")
// doFirst {
// project.gradle.startParameter.refreshDependencies = true
// }
}
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
}