Add better uploadProject
Dieser Commit ist enthalten in:
Ursprung
2dcccd1e42
Commit
af2585a3cd
47
build.gradle
47
build.gradle
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
import org.codehaus.groovy.runtime.ProcessGroovyMethods
|
||||
|
||||
plugins {
|
||||
// Adding the base plugin fixes the following gradle warnings in IntelliJ:
|
||||
@ -97,15 +98,21 @@ if (project.hasProperty("hostname")) {
|
||||
group "Steamwar"
|
||||
|
||||
doLast {
|
||||
shell("scp ${libs}/${jarName} ${hostname}:~/Dev1.15/plugins")
|
||||
await(shell("scp ${libs}/${jarName} ${hostname}:~/Dev1.15/plugins"))
|
||||
if (!answer("Start DEV server?")) {
|
||||
return
|
||||
}
|
||||
shell("ssh ${hostname} \"./mc Dev1.15\"")
|
||||
serverStart()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def await(Process proc) {
|
||||
def out = new StringBuilder()
|
||||
def err = new StringBuilder()
|
||||
proc.waitForProcessOutput(out, err)
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a shell command and returns the stdout result.
|
||||
*
|
||||
@ -119,13 +126,39 @@ def shell(String command) {
|
||||
} else {
|
||||
proc = ["cmd", "/c", command].execute()
|
||||
}
|
||||
def out = new StringBuilder()
|
||||
def err = new StringBuilder()
|
||||
proc.waitForProcessOutput(out, err)
|
||||
|
||||
return [out.toString().trim(), err.toString().trim(), proc.exitValue()]
|
||||
return proc
|
||||
}
|
||||
|
||||
def serverStart() {
|
||||
def proc = shell("ssh ${hostname} \"./mc Dev1.15\"")
|
||||
|
||||
Thread outputThread = proc.consumeProcessOutputStream(System.out)
|
||||
outputThread.setName("OutputThread")
|
||||
|
||||
Thread inputThread = new Thread(new Runnable() {
|
||||
@Override
|
||||
void run() {
|
||||
// Reader reader = System.in.newReader()
|
||||
Writer writer = proc.getOutputStream().newWriter()
|
||||
while (true) {
|
||||
//String s = reader.readLine()
|
||||
Thread.sleep(10000)
|
||||
writer.write("stop\n")
|
||||
writer.flush()
|
||||
}
|
||||
}
|
||||
})
|
||||
inputThread.setName("InputThread")
|
||||
inputThread.start()
|
||||
|
||||
while (proc.alive) {
|
||||
Thread.sleep(10)
|
||||
}
|
||||
|
||||
outputThread.interrupt()
|
||||
inputThread.interrupt()
|
||||
};
|
||||
|
||||
def answer(String question) {
|
||||
while (System.in.available() > 0) System.in.read()
|
||||
println(question)
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren