diff --git a/.gitignore b/.gitignore index a638baf11..7287f8bab 100644 --- a/.gitignore +++ b/.gitignore @@ -109,4 +109,7 @@ nb-configuration.xml .nb-gradle/ ### MacOS ### -.DS_Store \ No newline at end of file +.DS_Store + +### Run Folder ### +common/run/ diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 0997957e6..1fdb33b8d 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -18,3 +18,26 @@ java { tasks.named("sourcesJar") { from(project(":viaversion-api").sourceSets.main.get().allSource) } + +// Task to quickly test/debug code changes using ViaProxy +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 4bb3cf09a..dc4686133 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -19,7 +19,7 @@ checkerQual = "3.48.1" paper = "1.20.4-R0.1-SNAPSHOT" legacyBukkit = "1.8.8-R0.1-SNAPSHOT" velocity = "3.1.1" - +viaProxy = "3.3.5-SNAPSHOT" [libraries] @@ -40,6 +40,7 @@ checkerQual = { group = "org.checkerframework", name = "checker-qual", version.r paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" } legacyBukkit = { group = "org.bukkit", name = "bukkit", version.ref = "legacyBukkit" } velocity = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" } +viaProxy = { group = "net.raphimc", name = "ViaProxy", version.ref = "viaProxy" } [bundles]