Add gradle task to quickly test/debug code changes (#902)

This commit is contained in:
EnZaXD 2024-10-29 15:00:34 +01:00 committed by GitHub
parent 368f450e11
commit 3e8086e136
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 29 additions and 1 deletions

3
.gitignore vendored
View File

@ -107,3 +107,6 @@ nbdist/
nbactions.xml nbactions.xml
nb-configuration.xml nb-configuration.xml
.nb-gradle/ .nb-gradle/
### Run Folder (ViaProxy) ###
common/run/

View File

@ -24,3 +24,27 @@ dependencies {
java { java {
withJavadocJar() withJavadocJar()
} }
// Task to quickly test/debug code changes using https://github.com/ViaVersion/ViaProxy
// For further instructions see the ViaProxy repository README
tasks.register<JavaExec>("runViaProxy") {
dependsOn(tasks.shadowJar)
val viaProxyConfiguration = configurations.create("viaProxy")
viaProxyConfiguration.dependencies.add(dependencies.create(rootProject.libs.viaProxy.get().copy().setTransitive(false)))
mainClass.set("net.raphimc.viaproxy.ViaProxy")
classpath = viaProxyConfiguration
workingDir = file("run")
doFirst {
val jarsDir = file("$workingDir/jars")
jarsDir.mkdirs()
file("$jarsDir/${project.name}.jar").writeBytes(tasks.shadowJar.get().archiveFile.get().asFile.readBytes())
}
doLast {
file("$workingDir/jars/${project.name}.jar").delete()
file("$workingDir/logs").deleteRecursively()
}
}

View File

@ -16,7 +16,7 @@ checkerQual = "3.39.0"
paper = "1.16.5-R0.1-SNAPSHOT" paper = "1.16.5-R0.1-SNAPSHOT"
velocity = "3.1.1" velocity = "3.1.1"
fabricLoader = "0.11.6" fabricLoader = "0.11.6"
viaProxy = "3.3.5-SNAPSHOT"
[libraries] [libraries]
@ -31,3 +31,4 @@ checkerQual = { group = "org.checkerframework", name = "checker-qual", version.r
paper = { group = "com.destroystokyo.paper", name = "paper-api", version.ref = "paper" } paper = { group = "com.destroystokyo.paper", name = "paper-api", version.ref = "paper" }
velocity = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" } velocity = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
fabricLoader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabricLoader" } fabricLoader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabricLoader" }
viaProxy = { group = "net.raphimc", name = "ViaProxy", version.ref = "viaProxy" }