forked from YuvDwi/Steve
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
369 lines (312 loc) · 9.88 KB
/
Copy pathbuild.gradle
File metadata and controls
369 lines (312 loc) · 9.88 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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'checkstyle'
id 'com.github.spotbugs' version '6.0.26'
id 'jacoco'
}
version = '1.0.0'
group = 'com.minewright'
base {
archivesName = 'minewright'
}
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
// Fix UTF-8 encoding for Windows (prevents mojibake)
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.compilerArgs += [
'-Xlint:all',
'-Xlint:-processing',
'-Xlint:-deprecation', // Suppress deprecation warnings from Minecraft API
'-Xlint:-removal' // Suppress removal warnings from Minecraft API
]
}
// Javadoc configuration
javadoc {
options.encoding = 'UTF-8'
options.addStringOption('Xdoclint:none', '-quiet')
}
minecraft {
mappings channel: 'official', version: '1.20.1'
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
mods {
minewright {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
mods {
minewright {
source sourceSets.main
}
}
}
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
mavenCentral()
}
dependencies {
minecraft 'net.minecraftforge:forge:1.20.1-47.4.16'
// GraalVM (relocated to avoid conflicts)
implementation('org.graalvm.polyglot:polyglot:24.1.2') {
exclude group: 'org.graalvm.truffle'
exclude group: 'org.graalvm.sdk'
}
implementation('org.graalvm.polyglot:js:24.1.2') {
exclude group: 'org.graalvm.truffle'
exclude group: 'org.graalvm.sdk'
}
// Resilience4j
implementation 'io.github.resilience4j:resilience4j-circuitbreaker:2.3.0'
implementation 'io.github.resilience4j:resilience4j-retry:2.3.0'
implementation 'io.github.resilience4j:resilience4j-ratelimiter:2.3.0'
implementation 'io.github.resilience4j:resilience4j-bulkhead:2.3.0'
// Caffeine cache
implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8'
// Apache Commons
implementation 'commons-codec:commons-codec:1.17.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.4'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.4'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.4'
// Mockito for testing
testImplementation 'org.mockito:mockito-core:5.15.2'
testImplementation 'org.mockito:mockito-junit-jupiter:5.15.2'
}
test {
useJUnitPlatform()
ignoreFailures = true // Allow build to pass while we fix test issues
testLogging {
events = ["passed", "skipped", "failed"]
exceptionFormat = "full"
showStandardStreams = false
}
// Set heap size for tests
jvmArgs '-Xmx2G'
// Enable JaCoCo coverage
finalizedBy jacocoTestReport
}
// JaCoCo configuration
jacoco {
toolVersion = "0.8.11"
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = true
csv.required = false
xml.outputLocation = file("$buildDir/reports/jacoco/test/jacocoTestReport.xml")
html.outputLocation = file("$buildDir/reports/jacoco/test/html")
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
// Configuration classes
'**/config/**',
// Entity classes (data holders)
'**/entity/**',
// Client-side GUI code (hard to test)
'**/client/**',
// Generated code
'**/generated/**',
// Test classes
'**/*Test*',
'**/test/**',
// Minecraft integration points (require full game context)
'**/integration/minecraft/**',
// Message classes (simple data holders)
'**/communication/message/**',
// Event classes (simple data holders)
'**/event/dto/**',
// Exception classes (simple logic)
'**/exception/**'
])
}))
}
}
// Coverage verification with thresholds
jacocoTestCoverageVerification {
dependsOn jacocoTestReport
violationRules {
rule {
enabled = true
limit {
minimum = 0.40 // 40% minimum coverage (current goal)
}
}
// Per-package rules (more lenient for now)
rule {
enabled = true
element = 'PACKAGE'
includes = ['com.minewright.action']
limit {
minimum = 0.50 // Core action system should be well tested
}
}
rule {
enabled = true
element = 'PACKAGE'
includes = ['com.minewright.execution']
limit {
minimum = 0.50 // Execution engine should be well tested
}
}
rule {
enabled = true
element = 'PACKAGE'
includes = ['com.minewright.security']
limit {
minimum = 0.80 // Security code requires high coverage
}
}
rule {
enabled = true
element = 'PACKAGE'
includes = ['com.minewright.memory']
limit {
minimum = 0.30 // Memory system (lenient for now)
}
}
rule {
enabled = true
element = 'PACKAGE'
includes = ['com.minewright.behavior']
limit {
minimum = 0.30 // Behavior trees (lenient for now)
}
}
rule {
enabled = true
element = 'PACKAGE'
includes = ['com.minewright.htn']
limit {
minimum = 0.30 // HTN planner (lenient for now)
}
}
rule {
enabled = true
element = 'PACKAGE'
includes = ['com.minewright.pathfinding']
limit {
minimum = 0.30 // Pathfinding (lenient for now)
}
}
}
}
// Make check task depend on coverage verification (optional - comment out if too strict)
// check.dependsOn jacocoTestCoverageVerification
// Task to generate coverage report without failing on thresholds
task jacocoCoverageReport {
dependsOn jacocoTestReport
description = 'Generate JaCoCo coverage report without failing on thresholds'
group = 'verification'
}
// Checkstyle configuration
checkstyle {
toolVersion = '10.21.2'
configFile = file('config/checkstyle/checkstyle.xml')
ignoreFailures = true // TODO: Gradually enforce - currently 4,562 warnings. See docs/audits/CHECKSTYLE_SPOTBUGS_ANALYSIS.md
maxWarnings = 4000 // Gradually reduce to 0 over 8 weeks
maxErrors = 0
}
checkstyleMain {
source = 'src/main/java'
}
checkstyleTest {
source = 'src/test/java'
}
// SpotBugs configuration
spotbugs {
ignoreFailures = true // TODO: Gradually enforce - currently ~400 issues. See docs/audits/CHECKSTYLE_SPOTBUGS_ANALYSIS.md
showProgress = true
excludeFilter = file('config/spotbugs/spotbugs-exclude.xml')
}
spotbugsMain {
reports {
html {
required = true
outputLocation = file("$buildDir/reports/spotbugs/main.html")
}
}
}
spotbugsTest {
enabled = false
}
// Shadow configuration with relocation and exclusions
shadowJar {
archiveClassifier = 'all'
configurations = [project.configurations.runtimeClasspath]
zip64 = true
// Relocate GraalVM packages to avoid conflicts with any built-in versions
relocate 'org.graalvm', 'com.minewright.shaded.org.graalvm'
relocate 'com.oracle.truffle', 'com.minewright.shaded.com.oracle.truffle'
// Exclude Minecraft/Forge and other problematic paths
exclude 'net/minecraft/**'
exclude 'com/mojang/**'
exclude 'cpw/mods/**'
exclude 'joptsimple/**'
exclude 'META-INF/versions/**'
exclude 'META-INF/native-image/**'
exclude 'META-INF/resources/**'
exclude 'module-info.class'
manifest {
attributes([
'Specification-Title': 'MineWright',
'Specification-Vendor': 'MineWright',
'Specification-Version': '1',
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'MineWright'
])
}
mergeServiceFiles {
exclude 'META-INF/services/com.oracle.truffle.**'
exclude 'META-INF/services/org.graalvm.**'
}
}
jar {
manifest {
attributes([
'Specification-Title': 'MineWright',
'Specification-Vendor': 'MineWright',
'Specification-Version': '1',
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'MineWright'
])
}
}
reobf {
jar { }
// Shadow JAR is optional - only needed for distribution
// shadowJar { }
}
// Make shadow JAR optional - only run when explicitly requested
// tasks.reobfShadowJar.dependsOn shadowJar
// tasks.build.dependsOn reobfShadowJar
// For distribution, run: ./gradlew shadowJar reobfShadowJar
publishing {
publications {
mavenJava(MavenPublication) {
artifact shadowJar
}
}
repositories {
maven {
url = "file://${project.projectDir}/mcmodsrepo"
}
}
}