Add plugins option to DevServer Task

This commit is contained in:
2025-04-18 08:00:55 +02:00
parent 4edfd32ff5
commit 76e00b07db
+11 -5
View File
@@ -28,6 +28,10 @@ class DevServer extends DefaultTask {
@Input @Input
String template = null String template = null
@Input
@Optional
String plugins = null
@Input @Input
@Optional @Optional
Integer port = null Integer port = null
@@ -101,6 +105,8 @@ class DevServer extends DefaultTask {
} }
void uploadDependencies() { void uploadDependencies() {
def base = plugins == null ? "$template/plugins" : plugins
println("Uploading to ~/$base")
this.dependsOn.forEach { this.dependsOn.forEach {
Project resolved Project resolved
AbstractArchiveTask archiveTask AbstractArchiveTask archiveTask
@@ -112,10 +118,10 @@ class DevServer extends DefaultTask {
} }
def archive = archiveTask.archiveFile.get().asFile def archive = archiveTask.archiveFile.get().asFile
println("Uploading $archive to ~/$template/plugins") println("Uploading $archive")
new ProcessBuilder("ssh", host, "-T", "rm $template/plugins/${archive.name.replace("-all", "")}").start().waitFor() new ProcessBuilder("ssh", host, "-T", "rm $base/${archive.name.replace("-all", "")}").start().waitFor()
new ProcessBuilder("scp", archive.absolutePath, "$host:~/$template/plugins/${archive.name.replace("-all", "")}").start().waitFor() new ProcessBuilder("scp", archive.absolutePath, "$host:~/$base/${archive.name.replace("-all", "")}").start().waitFor()
println("Uploaded $archive to ~/$template/plugins") println("Uploaded $archive")
} }
} }
@@ -123,7 +129,7 @@ class DevServer extends DefaultTask {
def devPy = new StringBuilder().append("dev.py") def devPy = new StringBuilder().append("dev.py")
if (port != null) devPy.append(" --port $port") if (port != null) devPy.append(" --port $port")
if (worldName != null) devPy.append(" -w $template/$worldName") if (worldName != null) devPy.append(" -w $template/$worldName")
devPy.append(" -p $template/plugins") if (plugins != null) devPy.append(" -p $plugins")
if (jar != null) devPy.append(" --jar $jar") if (jar != null) devPy.append(" --jar $jar")
println("Starting $template with command ${devPy.toString()}") println("Starting $template with command ${devPy.toString()}")
devPy.append(" $template") devPy.append(" $template")