feat(networking): Introduce Minecraft networking support with basic data reader and writers

This commit is contained in:
2026-03-01 12:40:10 +01:00
parent 2e9f4c1689
commit 0e5a907446
14 changed files with 761 additions and 39 deletions

View File

@@ -1,8 +1,8 @@
plugins {
java
`java-library`
jacoco
id("io.freefair.lombok")
id("de.siphalor.tweed5.unit-tests")
id("de.siphalor.tweed5.publishing")
id("de.siphalor.tweed5.local-runtime-only")
id("de.siphalor.tweed5.expanded-sources-jar")
@@ -13,12 +13,6 @@ java {
targetCompatibility = JavaVersion.VERSION_1_8
}
val testAgent = configurations.dependencyScope("mockitoAgent")
val testAgentClasspath = configurations.resolvable("testAgentClasspath") {
isTransitive = false
extendsFrom(testAgent.get())
}
lombok {
version = libs.versions.lombok.get()
}
@@ -39,40 +33,9 @@ dependencies {
testImplementation(libs.acl)
testImplementation(libs.slf4j.rt)
testImplementation(platform(libs.junit.platform))
testImplementation(libs.junit.core)
testRuntimeOnly(libs.junit.launcher)
testImplementation(libs.mockito)
testAgent(libs.mockito)
testImplementation(libs.assertj)
testImplementation(project(":generic-test-utils"))
}
tasks.compileTestJava {
sourceCompatibility = libs.versions.java.test.get()
targetCompatibility = libs.versions.java.test.get()
}
tasks.test {
val testAgentFiles = testAgentClasspath.map { it.files }
doFirst {
jvmArgs(testAgentFiles.get().map { file -> "-javaagent:${file.absolutePath}" })
}
dependsOn(testAgentClasspath)
finalizedBy(tasks.jacocoTestReport)
useJUnitPlatform()
systemProperties(
"junit.jupiter.execution.timeout.mode" to "disabled_on_debug",
"junit.jupiter.execution.timeout.testable.method.default" to "10s",
"junit.jupiter.execution.timeout.thread.mode.default" to "SEPARATE_THREAD",
)
}
tasks.jacocoTestReport {
dependsOn(tasks.test)
}
publishing {
publications {
create<MavenPublication>("lib") {

View File

@@ -0,0 +1,48 @@
plugins {
java
jacoco
}
val testAgent = configurations.dependencyScope("mockitoAgent")
val testAgentClasspath = configurations.resolvable("testAgentClasspath") {
isTransitive = false
extendsFrom(testAgent.get())
}
dependencies {
versionCatalogs.find("libs").ifPresent { libs ->
testImplementation(platform(libs.findLibrary("junit.platform").get()))
testImplementation(libs.findLibrary("junit.core").get())
testRuntimeOnly(libs.findLibrary("junit.launcher").get())
testImplementation(libs.findLibrary("mockito").get())
testAgent(libs.findLibrary("mockito").get())
testImplementation(libs.findLibrary("assertj").get())
}
}
tasks.compileTestJava {
versionCatalogs.find("libs").ifPresent { libs ->
sourceCompatibility = libs.findVersion("java.test").get().requiredVersion
targetCompatibility = libs.findVersion("java.test").get().requiredVersion
}
}
tasks.test {
val testAgentFiles = testAgentClasspath.map { it.files }
doFirst {
jvmArgs(testAgentFiles.get().map { file -> "-javaagent:${file.absolutePath}" })
}
dependsOn(testAgentClasspath)
finalizedBy(tasks.jacocoTestReport)
useJUnitPlatform()
systemProperties(
"junit.jupiter.execution.timeout.mode" to "disabled_on_debug",
"junit.jupiter.execution.timeout.testable.method.default" to "10s",
"junit.jupiter.execution.timeout.thread.mode.default" to "SEPARATE_THREAD",
)
}
tasks.jacocoTestReport {
dependsOn(tasks.test)
}