diff --git a/.gitignore b/.gitignore index ab25b348..316241dc 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,6 @@ nbdist/ nbactions.xml nb-configuration.xml .nb-gradle/ + +### Run Folder (ViaProxy) ### +common/run/ diff --git a/common/build.gradle.kts b/common/build.gradle.kts index bb927cf6..d326ad8f 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -24,3 +24,27 @@ dependencies { java { withJavadocJar() } + +// Task to quickly test/debug code changes using https://github.com/ViaVersion/ViaProxy +// For further instructions see the ViaProxy repository README +tasks.register("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() + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3c46969e..29850cb3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,7 +16,7 @@ checkerQual = "3.39.0" paper = "1.16.5-R0.1-SNAPSHOT" velocity = "3.1.1" fabricLoader = "0.11.6" - +viaProxy = "3.3.5-SNAPSHOT" [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" } velocity = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" } fabricLoader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabricLoader" } +viaProxy = { group = "net.raphimc", name = "ViaProxy", version.ref = "viaProxy" }