-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
182 lines (155 loc) · 5.08 KB
/
Copy pathbuild.gradle
File metadata and controls
182 lines (155 loc) · 5.08 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
plugins {
id 'io.spring.dependency-management' version '1.1.7'
id 'com.github.ben-manes.versions' version '0.60.0'
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.vanniktech.maven.publish' version '0.37.0'
id 'net.researchgate.release' version '3.1.0'
}
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar
group = 'com.digitalsanctuary.springaiclient'
// version '1.1.3'
description = 'Simple SpringBoot AI Client Library'
ext {
springBootVersion = '4.0.6'
lombokVersion = '1.18.46'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
}
dependencies {
// Spring Boot dependencies
compileOnly "org.springframework.boot:spring-boot-starter-web:$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"
testImplementation 'org.junit.jupiter:junit-jupiter:6.1.3'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
test {
useJUnitPlatform()
}
tasks.named('jar') {
enabled = true
archiveBaseName.set('ds-spring-ai-client')
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() is now configured via gradle.properties
signAllPublications()
coordinates("com.digitalsanctuary", "ds-spring-ai-client", project.version)
pom {
name = "DS Spring AI Client"
description = "Simple SpringBoot AI Client Library."
inceptionYear = "2024"
url = "https://github.com/devondragon/SpringAIClient"
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/SpringAIClient"
connection = "scm:git:git@github.com:devondragon/SpringAIClient.git"
developerConnection = "scm:git:ssh://git@github.com:devondragon/SpringAIClient.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
}