From 18a9970e69dc81aa6203043ddb8fe402aad529cb Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 16 Apr 2021 22:34:52 +0200 Subject: [PATCH 1/3] Add gradle.properties to make gradle build after cleanup even faster Update .gitignore Update build.gradle --- .gitignore | 2 +- build.gradle | 16 ++++++++++++---- gradle.properties | 23 +++++++++++++++++++++++ 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 gradle.properties 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..3a82648 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,8 +100,9 @@ task finalizeProject { } build.finalizedBy(finalizeProject) -if (project.hasProperty("hostname")) { +if (steamwarProperties.containsKey("hostname")) { def server = "Dev1.15" + def hostname = steamwarProperties.get("hostname") // def server = "Developer" task uploadProject { @@ -106,7 +114,7 @@ if (project.hasProperty("hostname")) { if (!answer("Start ${server} server?")) { return } - serverStart(server) + serverStart(server, hostname) } } @@ -115,7 +123,7 @@ if (project.hasProperty("hostname")) { group "Steamwar" doLast { - serverStart(server) + serverStart(server, hostname) } } } @@ -135,7 +143,7 @@ private def shell(String command) { } } -private def serverStart(String serverName) { +private def serverStart(String serverName, String hostname) { def proc = shell("ssh -t ${hostname} \"./mc ${serverName}\"") Set strings = new HashSet<>() diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..c5f12a3 --- /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 From 7fc61812d6d83f297ebd15006458d91961350a79 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 16 Apr 2021 22:36:25 +0200 Subject: [PATCH 2/3] Fix gradle.properties config key --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index c5f12a3..7a24a33 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,6 +18,6 @@ # org.gradle.daemon = true -org.gradle.parallel = true +org.gradle.parallel = true org.gradle.configureondemand = true org.gradle.workers.max = 4 \ No newline at end of file From b815ac1ac01888745183ef6ed4fbb5b81438c290 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 17 Apr 2021 08:17:58 +0200 Subject: [PATCH 3/3] Update build.gradle for more flexible server start --- build.gradle | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 3a82648..cd38a50 100644 --- a/build.gradle +++ b/build.gradle @@ -101,20 +101,22 @@ task finalizeProject { build.finalizedBy(finalizeProject) if (steamwarProperties.containsKey("hostname")) { - def server = "Dev1.15" - def hostname = steamwarProperties.get("hostname") - // def server = "Developer" + 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, hostname) + serverStart(server, serverStartFlags, hostname) } } @@ -123,7 +125,7 @@ if (steamwarProperties.containsKey("hostname")) { group "Steamwar" doLast { - serverStart(server, hostname) + serverStart(server, serverStartFlags, hostname) } } } @@ -143,8 +145,8 @@ private def shell(String command) { } } -private def serverStart(String serverName, String hostname) { - 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");