From 335649fa873dd02d385a888be473e466efb03691 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Thu, 17 Apr 2025 20:36:16 +0200 Subject: [PATCH] Fix steamwar.devserver.gradle --- VelocityCore/build.gradle.kts | 2 +- buildSrc/src/steamwar.devserver.gradle | 37 +++++++++++++------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/VelocityCore/build.gradle.kts b/VelocityCore/build.gradle.kts index 90d43d36..f81416a3 100644 --- a/VelocityCore/build.gradle.kts +++ b/VelocityCore/build.gradle.kts @@ -73,5 +73,5 @@ tasks.register("DevVelocity") { description = "Run a Dev Velocity" dependsOn(":VelocityCore:shadowJar") dependsOn(":VelocityCore:Persistent:jar") - template = "Velocity" + template = "DevVelocity" } diff --git a/buildSrc/src/steamwar.devserver.gradle b/buildSrc/src/steamwar.devserver.gradle index 734bc88d..d38f465a 100644 --- a/buildSrc/src/steamwar.devserver.gradle +++ b/buildSrc/src/steamwar.devserver.gradle @@ -55,6 +55,13 @@ class DevServer extends DefaultTask { if (worldName == null) worldName = properties.get("worldName") host = properties.get("host") + + if (worldName == null) { + throw new GradleException("Please supply the 'worldName' in a 'steamwar.properties' files either in this project dir or any parent project!") + } + if (host == null) { + throw new GradleException("Please supply the 'host' in a 'steamwar.properties' files either in this project dir or any parent project!") + } } doLast { uploadDependencies() @@ -75,7 +82,7 @@ class DevServer extends DefaultTask { super() doLast { if (processInput != null) { - processInput.write("stop\n") + processInput.write(template.endsWith("Velocity") ? "end\n" : "stop\n") processInput.flush() } } @@ -94,28 +101,22 @@ class DevServer extends DefaultTask { } def archive = archiveTask.archiveFile.get().asFile - println("Uploading $archive to ~/plugins/${template}") - new ProcessBuilder("scp", archive.absolutePath, "$host:~/plugins/$template/${archive.name.replace("-all", "")}").start().waitFor() - println("Uploaded $archive to ~/plugins/${template}") + println("Uploading $archive to ~/$template/plugins") + new ProcessBuilder("scp", archive.absolutePath, "$host:~/$template/plugins/${archive.name.replace("-all", "")}").start().waitFor() + println("Uploaded $archive to ~/$template/plugins") } } void startDevServer() { - def devPy = new StringBuilder() - if (template.endsWith("Velocity")) { // TODO Add this to the dev.py! - devPy.append("cd DevVelocity") - devPy.append("; java -jar Velocity.jar --port 25566") - } else { - devPy.append("dev.py") - if (port != null) devPy.append(" --port $port") - if (worldName != null) devPy.append(" -w $worldName") - devPy.append(" -p plugins/$template") - if (jar != null) devPy.append(" --jar $jar") - println("Starting $template with command ${devPy.toString()}") - devPy.append(" $template") - } + def devPy = new StringBuilder().append("./dev.py") + if (port != null) devPy.append(" --port $port") + if (worldName != null) devPy.append(" -w $template/$worldName") + devPy.append(" -p $template/plugins") + if (jar != null) devPy.append(" --jar $jar") + println("Starting $template with command ${devPy.toString()}") + devPy.append(" $template") - def process = new ProcessBuilder("ssh", host, "-T", devPy.toString()).start(); + def process = new ProcessBuilder("ssh", host, "-T", devPy.toString()).start() def running = true; def processOutput = new BufferedReader(new InputStreamReader(process.inputStream)) new Thread({