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

This commit is contained in:
RK_01 2024-10-29 14:00:55 +01:00 committed by GitHub
parent 7985b39ed5
commit a0c0b7eff2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 29 additions and 2 deletions

3
.gitignore vendored
View File

@ -110,3 +110,6 @@ nb-configuration.xml
### MacOS ###
.DS_Store
### Run Folder ###
common/run/

View File

@ -18,3 +18,26 @@ java {
tasks.named<Jar>("sourcesJar") {
from(project(":viaversion-api").sourceSets.main.get().allSource)
}
// Task to quickly test/debug code changes using ViaProxy
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

@ -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]