-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
203 lines (176 loc) · 5.8 KB
/
build.gradle.kts
File metadata and controls
203 lines (176 loc) · 5.8 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
plugins {
java
`java-library`
`maven-publish`
id("com.github.spotbugs") version "6.0.26" apply false
id("com.diffplug.spotless") version "6.25.0" apply false
id("io.freefair.lombok") version "8.11" apply false
jacoco
}
allprojects {
group = "com.redis"
repositories {
mavenCentral()
maven {
url = uri("https://repo.spring.io/milestone")
}
maven {
url = uri("https://repo.spring.io/snapshot")
}
}
}
subprojects {
// Skip strict build rules for demo projects
if (name.startsWith("rag-")) {
apply(plugin = "java")
return@subprojects
}
apply(plugin = "java")
apply(plugin = "java-library")
apply(plugin = "maven-publish")
apply(plugin = "com.github.spotbugs")
apply(plugin = "com.diffplug.spotless")
apply(plugin = "jacoco")
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
withJavadocJar()
withSourcesJar()
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs.addAll(listOf(
"-parameters",
"-Xlint:all",
"-Xlint:-processing",
"-Werror"
))
options.release = 17
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
showStandardStreams = false
}
maxParallelForks = Runtime.getRuntime().availableProcessors()
}
// Explicitly declare test runtime dependencies to avoid Gradle 9.0 deprecation
configurations {
testRuntimeOnly {
extendsFrom(configurations.testImplementation.get())
}
}
tasks.withType<Javadoc> {
options {
(this as StandardJavadocDocletOptions).apply {
addBooleanOption("Xdoclint:all,-missing", true)
addBooleanOption("html5", true)
}
}
}
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
java {
googleJavaFormat("1.25.2")
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
}
// Configure SpotBugs
tasks.withType<com.github.spotbugs.snom.SpotBugsTask> {
excludeFilter.set(file("${rootProject.projectDir}/spotbugs-exclude.xml"))
}
// Disable SpotBugs for test code - test code has different requirements
tasks.named("spotbugsTest") {
enabled = false
}
tasks.jacocoTestReport {
dependsOn(tasks.test)
reports {
xml.required = true
html.required = true
}
}
tasks.jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = "0.80".toBigDecimal()
}
}
}
}
dependencies {
// Logging
implementation("org.slf4j:slf4j-api:2.0.16")
// Testing dependencies
testImplementation("org.junit.jupiter:junit-jupiter:5.11.4")
testImplementation("org.assertj:assertj-core:3.27.2")
testImplementation("org.mockito:mockito-core:5.15.2")
testImplementation("org.mockito:mockito-junit-jupiter:5.15.2")
testImplementation("org.testcontainers:testcontainers:1.20.4")
testImplementation("org.testcontainers:junit-jupiter:1.20.4")
testImplementation("com.redis:testcontainers-redis:2.2.2")
testImplementation("net.razorvine:pickle:1.4")
// Explicitly declare test runtime dependencies
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testRuntimeOnly("ch.qos.logback:logback-classic:1.5.15")
}
}
tasks.wrapper {
gradleVersion = "8.11.1"
distributionType = Wrapper.DistributionType.ALL
}
// Task to copy jar to notebooks directory for Jupyter
tasks.register<Copy>("copyJarToNotebooks") {
dependsOn(":core:jar")
from(project(":core").tasks.named<Jar>("jar").map { it.archiveFile })
into("notebooks")
}
// Make build depend on copying jar
tasks.named("build") {
dependsOn("copyJarToNotebooks")
}
// Add aggregated Javadoc generation
tasks.register<Javadoc>("aggregateJavadoc") {
description = "Generate aggregated Javadoc for all modules"
group = "documentation"
val coreProject = project(":core")
source(coreProject.the<SourceSetContainer>()["main"].allJava)
classpath = files(coreProject.the<SourceSetContainer>()["main"].compileClasspath)
setDestinationDir(layout.buildDirectory.dir("docs/javadoc/aggregate").get().asFile)
(options as StandardJavadocDocletOptions).apply {
title = "RedisVL ${project.version} API"
windowTitle = "RedisVL ${project.version}"
author(true)
version(true)
use(true)
splitIndex(true)
links(
"https://docs.oracle.com/en/java/javase/17/docs/api/",
"https://www.javadoc.io/doc/redis.clients/jedis/7.0.0/"
)
// Suppress warnings for Lombok-generated constructors
addStringOption("Xdoclint:-missing", "-quiet")
}
// Ensure Javadoc generation succeeds
isFailOnError = false
}
// Individual module Javadocs
tasks.register("generateModuleJavadocs") {
description = "Generate Javadoc for individual modules"
group = "documentation"
val coreProject = project(":core")
dependsOn(coreProject.tasks.named("javadoc"))
doLast {
copy {
from(coreProject.tasks.named<Javadoc>("javadoc").get().destinationDir)
into(layout.buildDirectory.dir("docs/javadoc/modules/core").get().asFile)
}
}
}