BauSystem2.0/module.gradle
yoyosource 84aa126f38
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Add generating plugin.yml by reading build.gradle
2024-05-31 22:46:34 +02:00

68 Zeilen
3.0 KiB
Groovy

/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 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 <https://www.gnu.org/licenses/>.
*/
processResources {
doLast {
List<String> hardDependencies = new ArrayList<>()
List<String> softDependencies = new ArrayList<>()
new File("${buildDir}/../build.gradle").eachLine {
if (it.trim().startsWith("compileOnly project(\":BauSystem_") && it.trim().endsWith("\")")) {
String softDepends = it.trim().substring(32, it.trim().size() - 2)
softDependencies.add(softDepends)
} else if (it.trim().startsWith("compileOnly project(\":BauSystem_") && it.trim().endsWith("\") // SOFT")) {
String softDepends = it.trim().substring(32, it.trim().size() - 10)
softDependencies.add(softDepends)
} else if (it.trim().startsWith("compileOnly project(\":BauSystem_") && it.trim().endsWith("\") // HARD")) {
String hardDepends = it.trim().substring(32, it.trim().size() - 10)
hardDependencies.add(hardDepends)
}
}
File pluginYmlFile = new File("${buildDir}/resources/main/plugin.yml")
pluginYmlFile.parentFile.mkdirs()
pluginYmlFile.createNewFile()
pluginYmlFile.append("name: ${project.name}\n")
pluginYmlFile.append("authors: [ Lixfel, YoyoNow, Chaoscaot, Zeanon, D4rkr34lm ]\n")
pluginYmlFile.append("version: \"2.0\"\n")
pluginYmlFile.append("depend:\n")
pluginYmlFile.append("- WorldEdit\n")
pluginYmlFile.append("- SpigotCore\n")
hardDependencies.forEach {
pluginYmlFile.append("- BauSystem_${it}\n")
}
if (!softDependencies.isEmpty()) {
pluginYmlFile.append("softdepend:")
softDependencies.forEach {
pluginYmlFile.append("\n- BauSystem_${it}")
}
pluginYmlFile.append("\n")
}
pluginYmlFile.append("load: POSTWORLD\n")
pluginYmlFile.append("main: de.steamwar.bausystem.BauSystemPlugin\n")
pluginYmlFile.append("api-version: \"1.13\"\n")
pluginYmlFile.append("website: \"https://steamwar.de\"\n")
pluginYmlFile.append("description: \"So unseriös wie wir sind: BauSystem nur besser.\"\n")
pluginYmlFile.append("\n")
pluginYmlFile.append("commands:\n")
}
}