forked from SteamWar/SteamWar
Fix steamwar.devserver.gradle
This commit is contained in:
@@ -73,5 +73,5 @@ tasks.register<DevServer>("DevVelocity") {
|
|||||||
description = "Run a Dev Velocity"
|
description = "Run a Dev Velocity"
|
||||||
dependsOn(":VelocityCore:shadowJar")
|
dependsOn(":VelocityCore:shadowJar")
|
||||||
dependsOn(":VelocityCore:Persistent:jar")
|
dependsOn(":VelocityCore:Persistent:jar")
|
||||||
template = "Velocity"
|
template = "DevVelocity"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,13 @@ class DevServer extends DefaultTask {
|
|||||||
|
|
||||||
if (worldName == null) worldName = properties.get("worldName")
|
if (worldName == null) worldName = properties.get("worldName")
|
||||||
host = properties.get("host")
|
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 {
|
doLast {
|
||||||
uploadDependencies()
|
uploadDependencies()
|
||||||
@@ -75,7 +82,7 @@ class DevServer extends DefaultTask {
|
|||||||
super()
|
super()
|
||||||
doLast {
|
doLast {
|
||||||
if (processInput != null) {
|
if (processInput != null) {
|
||||||
processInput.write("stop\n")
|
processInput.write(template.endsWith("Velocity") ? "end\n" : "stop\n")
|
||||||
processInput.flush()
|
processInput.flush()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,28 +101,22 @@ class DevServer extends DefaultTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def archive = archiveTask.archiveFile.get().asFile
|
def archive = archiveTask.archiveFile.get().asFile
|
||||||
println("Uploading $archive to ~/plugins/${template}")
|
println("Uploading $archive to ~/$template/plugins")
|
||||||
new ProcessBuilder("scp", archive.absolutePath, "$host:~/plugins/$template/${archive.name.replace("-all", "")}").start().waitFor()
|
new ProcessBuilder("scp", archive.absolutePath, "$host:~/$template/plugins/${archive.name.replace("-all", "")}").start().waitFor()
|
||||||
println("Uploaded $archive to ~/plugins/${template}")
|
println("Uploaded $archive to ~/$template/plugins")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void startDevServer() {
|
void startDevServer() {
|
||||||
def devPy = new StringBuilder()
|
def devPy = new StringBuilder().append("./dev.py")
|
||||||
if (template.endsWith("Velocity")) { // TODO Add this to the dev.py!
|
if (port != null) devPy.append(" --port $port")
|
||||||
devPy.append("cd DevVelocity")
|
if (worldName != null) devPy.append(" -w $template/$worldName")
|
||||||
devPy.append("; java -jar Velocity.jar --port 25566")
|
devPy.append(" -p $template/plugins")
|
||||||
} else {
|
if (jar != null) devPy.append(" --jar $jar")
|
||||||
devPy.append("dev.py")
|
println("Starting $template with command ${devPy.toString()}")
|
||||||
if (port != null) devPy.append(" --port $port")
|
devPy.append(" $template")
|
||||||
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 process = new ProcessBuilder("ssh", host, "-T", devPy.toString()).start();
|
def process = new ProcessBuilder("ssh", host, "-T", devPy.toString()).start()
|
||||||
def running = true;
|
def running = true;
|
||||||
def processOutput = new BufferedReader(new InputStreamReader(process.inputStream))
|
def processOutput = new BufferedReader(new InputStreamReader(process.inputStream))
|
||||||
new Thread({
|
new Thread({
|
||||||
|
|||||||
Reference in New Issue
Block a user