Add gradle task to quickly test/debug code changes

This commit is contained in:
FlorianMichael 2024-10-29 14:56:19 +01:00
parent 6fd7b8caab
commit b1afee85c9
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
2 changed files with 27 additions and 0 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@ hs_err_pid*
.gradle/
build/
out/
common/run/

View File

@ -17,3 +17,29 @@ sourceSets {
}
}
}
// Task to quickly test/debug code changes using https://github.com/ViaVersion/ViaProxy
// For further instructions see the ViaProxy repository README
tasks.register("runViaProxy", JavaExec) {
dependsOn tasks.jar
def viaProxyConfiguration = configurations.create("viaProxy")
viaProxyConfiguration.dependencies.add(dependencies.create("net.raphimc:ViaProxy:3.3.5-SNAPSHOT") {
transitive = false
})
mainClass = "net.raphimc.viaproxy.ViaProxy"
classpath = viaProxyConfiguration
workingDir = file("run")
doFirst {
def jarsDir = file("$workingDir/jars")
jarsDir.mkdirs()
file("$jarsDir/${project.name}.jar").bytes = tasks.jar.archiveFile.get().asFile.bytes
}
doLast {
file("$workingDir/jars/${project.name}.jar").delete()
file("$workingDir/logs").deleteDir()
}
}