SteamWar/BauSystem
Archiviert
13
0

Add build.gradle uploadProject

Dieser Commit ist enthalten in:
yoyosource 2021-04-11 10:16:09 +02:00
Ursprung a499ab09eb
Commit 3104696f59

Datei anzeigen

@ -61,8 +61,15 @@ dependencies {
} }
task buildProject { task buildProject {
description 'Build this repo' description 'Build this project'
group "Build" group "Steamwar"
dependsOn build
}
task finalizeProject {
description 'Finalize this project'
group "Steamwar"
doLast { doLast {
if ("${buildDir}" == null) { if ("${buildDir}" == null) {
@ -74,4 +81,38 @@ task buildProject {
file(libs + "/" + uberJarName).renameTo(file(libs + "/" + jarName)) file(libs + "/" + uberJarName).renameTo(file(libs + "/" + jarName))
} }
} }
build.finalizedBy(buildProject) build.finalizedBy(finalizeProject)
task uploadProject {
description 'Upload this project'
group "Steamwar"
doLast {
shell("scp ${libs}/${jarName} steamwar:~/Dev1.15/plugins")
if (!answer("Start DEV server?")) {
return
}
shell("ssh steamwar \"./mc Dev1.15\"")
}
}
/**
* Executes a shell command and returns the stdout result.
*
* @param command the command to execute (cannot contain pipes)
* @return the trimmed result from stdout, stderr and the exit value
*/
def shell(String command) {
def proc = ['bash', '-c', command].execute()
def out = new StringBuilder()
def err = new StringBuilder()
proc.waitForProcessOutput(out, err)
return [out.toString().trim(), err.toString().trim(), proc.exitValue()]
}
def answer(String question) {
while (System.in.available() > 0) System.in.read()
println(question)
return "Yy".contains(((char)System.in.read()).toString())
}