SteamWar/BauSystem
Archiviert
13
0

Update build.gradle for more flexible server start

Dieser Commit ist enthalten in:
yoyosource 2021-04-17 08:17:58 +02:00
Ursprung 7fc61812d6
Commit b815ac1ac0

Datei anzeigen

@ -101,20 +101,22 @@ task finalizeProject {
build.finalizedBy(finalizeProject) build.finalizedBy(finalizeProject)
if (steamwarProperties.containsKey("hostname")) { if (steamwarProperties.containsKey("hostname")) {
def server = "Dev1.15" String hostname = steamwarProperties.get("hostname")
def hostname = steamwarProperties.get("hostname") String uploadPath = steamwarProperties.getOrDefault("uploadPath", "~")
// def server = "Developer"
String server = steamwarProperties.getOrDefault("server", "Dev1.15")
String serverStartFlags = steamwarProperties.getOrDefault("serverStartFlags", "")
task uploadProject { task uploadProject {
description 'Upload this project' description 'Upload this project'
group "Steamwar" group "Steamwar"
doLast { doLast {
await(shell("scp ${libs}/${jarName} ${hostname}:~/${server}/plugins")) await(shell("scp ${libs}/${jarName} ${hostname}:${uploadPath}/${server}/plugins"))
if (!answer("Start ${server} server?")) { if (!answer("Start ${server} server?")) {
return return
} }
serverStart(server, hostname) serverStart(server, serverStartFlags, hostname)
} }
} }
@ -123,7 +125,7 @@ if (steamwarProperties.containsKey("hostname")) {
group "Steamwar" group "Steamwar"
doLast { doLast {
serverStart(server, hostname) serverStart(server, serverStartFlags, hostname)
} }
} }
} }
@ -143,8 +145,8 @@ private def shell(String command) {
} }
} }
private def serverStart(String serverName, String hostname) { private def serverStart(String serverName, String serverFlags, String hostname) {
def proc = shell("ssh -t ${hostname} \"./mc ${serverName}\"") def proc = shell("ssh -t ${hostname} \"./mc ${serverFlags} ${serverName}\"")
Set<String> strings = new HashSet<>() Set<String> strings = new HashSet<>()
File file = new File("${projectDir}/ignoredlog"); File file = new File("${projectDir}/ignoredlog");