diff --git a/.gitignore b/.gitignore index 0949470..36e1257 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ .gradle **/build/ !gradle/wrapper/gradle-wrapper.jar -gradle.properties +steamwar.properties # IntelliJ IDEA .idea diff --git a/build.gradle b/build.gradle index 9bb750d..cd38a50 100644 --- a/build.gradle +++ b/build.gradle @@ -20,6 +20,8 @@ import org.apache.tools.ant.taskdefs.condition.Os +import java.util.function.BiConsumer + plugins { // Adding the base plugin fixes the following gradle warnings in IntelliJ: // @@ -37,6 +39,11 @@ plugins { group 'steamwar' version '' +Properties steamwarProperties = new Properties() +if (file("steamwar.properties").exists()) { + steamwarProperties.load(file("steamwar.properties").newDataInputStream()) +} + ext { buildName = 'BauSystem' artifactName = 'bausystem' @@ -93,20 +100,23 @@ task finalizeProject { } build.finalizedBy(finalizeProject) -if (project.hasProperty("hostname")) { - def server = "Dev1.15" - // def server = "Developer" +if (steamwarProperties.containsKey("hostname")) { + String hostname = steamwarProperties.get("hostname") + String uploadPath = steamwarProperties.getOrDefault("uploadPath", "~") + + String server = steamwarProperties.getOrDefault("server", "Dev1.15") + String serverStartFlags = steamwarProperties.getOrDefault("serverStartFlags", "") task uploadProject { description 'Upload this project' group "Steamwar" doLast { - await(shell("scp ${libs}/${jarName} ${hostname}:~/${server}/plugins")) + await(shell("scp ${libs}/${jarName} ${hostname}:${uploadPath}/${server}/plugins")) if (!answer("Start ${server} server?")) { return } - serverStart(server) + serverStart(server, serverStartFlags, hostname) } } @@ -115,7 +125,7 @@ if (project.hasProperty("hostname")) { group "Steamwar" doLast { - serverStart(server) + serverStart(server, serverStartFlags, hostname) } } } @@ -135,8 +145,8 @@ private def shell(String command) { } } -private def serverStart(String serverName) { - def proc = shell("ssh -t ${hostname} \"./mc ${serverName}\"") +private def serverStart(String serverName, String serverFlags, String hostname) { + def proc = shell("ssh -t ${hostname} \"./mc ${serverFlags} ${serverName}\"") Set strings = new HashSet<>() File file = new File("${projectDir}/ignoredlog"); diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..7a24a33 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,23 @@ +# +# This file is a part of the SteamWar software. +# +# Copyright (C) 2020 SteamWar.de-Serverteam +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# + +org.gradle.daemon = true +org.gradle.parallel = true +org.gradle.configureondemand = true +org.gradle.workers.max = 4 \ No newline at end of file