Skip to content

Commit b1afee8

Browse files
Add gradle task to quickly test/debug code changes
1 parent 6fd7b8c commit b1afee8

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ hs_err_pid*
1414
.gradle/
1515
build/
1616
out/
17+
common/run/

common/build.gradle

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,29 @@ sourceSets {
1717
}
1818
}
1919
}
20+
21+
// Task to quickly test/debug code changes using https://github.com/ViaVersion/ViaProxy
22+
// For further instructions see the ViaProxy repository README
23+
tasks.register("runViaProxy", JavaExec) {
24+
dependsOn tasks.jar
25+
26+
def viaProxyConfiguration = configurations.create("viaProxy")
27+
viaProxyConfiguration.dependencies.add(dependencies.create("net.raphimc:ViaProxy:3.3.5-SNAPSHOT") {
28+
transitive = false
29+
})
30+
31+
mainClass = "net.raphimc.viaproxy.ViaProxy"
32+
classpath = viaProxyConfiguration
33+
workingDir = file("run")
34+
35+
doFirst {
36+
def jarsDir = file("$workingDir/jars")
37+
jarsDir.mkdirs()
38+
file("$jarsDir/${project.name}.jar").bytes = tasks.jar.archiveFile.get().asFile.bytes
39+
}
40+
41+
doLast {
42+
file("$workingDir/jars/${project.name}.jar").delete()
43+
file("$workingDir/logs").deleteDir()
44+
}
45+
}

0 commit comments

Comments
 (0)