Skip to content

Commit a0c0b7e

Browse files
authored
Add gradle task to quickly test/debug code changes (ViaVersion#4211)
1 parent 7985b39 commit a0c0b7e

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,7 @@ nb-configuration.xml
109109
.nb-gradle/
110110

111111
### MacOS ###
112-
.DS_Store
112+
.DS_Store
113+
114+
### Run Folder ###
115+
common/run/

common/build.gradle.kts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,26 @@ java {
1818
tasks.named<Jar>("sourcesJar") {
1919
from(project(":viaversion-api").sourceSets.main.get().allSource)
2020
}
21+
22+
// Task to quickly test/debug code changes using ViaProxy
23+
tasks.register<JavaExec>("runViaProxy") {
24+
dependsOn(tasks.shadowJar)
25+
26+
val viaProxyConfiguration = configurations.create("viaProxy")
27+
viaProxyConfiguration.dependencies.add(dependencies.create(rootProject.libs.viaProxy.get().copy().setTransitive(false)))
28+
29+
mainClass.set("net.raphimc.viaproxy.ViaProxy")
30+
classpath = viaProxyConfiguration
31+
workingDir = file("run")
32+
33+
doFirst {
34+
val jarsDir = file("$workingDir/jars")
35+
jarsDir.mkdirs()
36+
file("$jarsDir/${project.name}.jar").writeBytes(tasks.shadowJar.get().archiveFile.get().asFile.readBytes())
37+
}
38+
39+
doLast {
40+
file("$workingDir/jars/${project.name}.jar").delete()
41+
file("$workingDir/logs").deleteRecursively()
42+
}
43+
}

gradle/libs.versions.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ checkerQual = "3.48.1"
1919
paper = "1.20.4-R0.1-SNAPSHOT"
2020
legacyBukkit = "1.8.8-R0.1-SNAPSHOT"
2121
velocity = "3.1.1"
22-
22+
viaProxy = "3.3.5-SNAPSHOT"
2323

2424
[libraries]
2525

@@ -40,6 +40,7 @@ checkerQual = { group = "org.checkerframework", name = "checker-qual", version.r
4040
paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" }
4141
legacyBukkit = { group = "org.bukkit", name = "bukkit", version.ref = "legacyBukkit" }
4242
velocity = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
43+
viaProxy = { group = "net.raphimc", name = "ViaProxy", version.ref = "viaProxy" }
4344

4445

4546
[bundles]

0 commit comments

Comments
 (0)