Add steamwar.properties 'worldName' and 'host'

Remove some options
This commit is contained in:
2025-04-17 15:24:12 +02:00
parent 32703c6659
commit 9001e83321
2 changed files with 25 additions and 19 deletions
+25 -14
View File
@@ -32,20 +32,30 @@ class DevServer extends DefaultTask {
@Optional
Integer port = null
@Input
@Optional
Boolean profile = false
@Input
@Optional
Boolean forceUpgrade = false
@Input
@Optional
String jar = null
DevServer() {
super()
doFirst {
List<Project> projects = []
projects.add(project)
while (projects.first.parent != null) {
projects.add(0, projects.first.parent)
}
def properties = new Properties()
projects.forEach {
def file = new File(it.projectDir, "steamwar.properties")
if (file.exists()) {
properties.load(new FileInputStream(file))
}
}
if (worldName == null) worldName = properties.get("worldName")
host = properties.get("host")
}
doLast {
uploadDependencies()
startDevServer()
@@ -54,7 +64,10 @@ class DevServer extends DefaultTask {
}
@Internal
BufferedWriter processInput;
BufferedWriter processInput
@Internal
String host
class Finalizer extends DefaultTask {
@@ -82,14 +95,14 @@ class DevServer extends DefaultTask {
def archive = archiveTask.archiveFile.get().asFile
println("Uploading $archive to ~/plugins/${template}")
new ProcessBuilder("scp", archive.absolutePath, "sw:~/plugins/$template/${archive.name.replace("-all", "")}").start().waitFor()
new ProcessBuilder("scp", archive.absolutePath, "$host:~/plugins/$template/${archive.name.replace("-all", "")}").start().waitFor()
println("Uploaded $archive to ~/plugins/${template}")
}
}
void startDevServer() {
def devPy = new StringBuilder()
if (template.endsWith("Velocity")) {
if (template.endsWith("Velocity")) { // TODO Add this to the dev.py!
devPy.append("cd DevVelocity")
devPy.append("; java -jar Velocity.jar --port 25566")
} else {
@@ -97,14 +110,12 @@ class DevServer extends DefaultTask {
if (port != null) devPy.append(" --port $port")
if (worldName != null) devPy.append(" -w $worldName")
devPy.append(" -p plugins/$template")
if (profile) devPy.append(" --profile")
if (forceUpgrade) devPy.append(" --forceUpgrade")
if (jar != null) devPy.append(" --jar $jar")
println("Starting $template with command ${devPy.toString()}")
devPy.append(" $template")
}
def process = new ProcessBuilder("ssh", "sw", "-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({