From a4c487023601fc39882cac9fdaaeedc83f1e2861 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 27 Jun 2022 20:19:01 +0200 Subject: [PATCH] Add dependencies.gradle Signed-off-by: yoyosource --- BauSystem_15/build.gradle | 6 +++--- BauSystem_18/build.gradle | 6 +++--- BauSystem_19/build.gradle | 6 +++--- BauSystem_Main/build.gradle | 9 ++++----- build.gradle | 14 ++++++++++---- dependencies.gradle | 34 ++++++++++++++++++++++++++++++++++ settings.gradle | 12 ++++++++---- 7 files changed, 65 insertions(+), 22 deletions(-) create mode 100644 dependencies.gradle diff --git a/BauSystem_15/build.gradle b/BauSystem_15/build.gradle index 0dd5c888..4cb27d22 100644 --- a/BauSystem_15/build.gradle +++ b/BauSystem_15/build.gradle @@ -50,7 +50,7 @@ dependencies { implementation project(":BauSystem_Main") - compileOnly files("${projectDir}/../lib/Spigot-1.15.jar") - compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar") - compileOnly files("${projectDir}/../lib/SpigotCore.jar") + compileOnly spigot15 + compileOnly worldEdit15 + compileOnly spigotCore } \ No newline at end of file diff --git a/BauSystem_18/build.gradle b/BauSystem_18/build.gradle index 67d610e7..1528b092 100644 --- a/BauSystem_18/build.gradle +++ b/BauSystem_18/build.gradle @@ -51,13 +51,13 @@ dependencies { implementation project(":BauSystem_Main") compileOnly 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT' - compileOnly files("${projectDir}/../lib/Spigot-1.18.jar") compileOnly 'it.unimi.dsi:fastutil:8.5.6' compileOnly 'com.mojang:datafixerupper:4.0.26' compileOnly 'io.netty:netty-all:4.1.68.Final' compileOnly 'com.mojang:authlib:1.5.25' compileOnly 'com.mojang:brigadier:1.0.18' - compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar") - compileOnly files("${projectDir}/../lib/SpigotCore.jar") + compileOnly spigot18 + compileOnly worldEdit15 + compileOnly spigotCore } \ No newline at end of file diff --git a/BauSystem_19/build.gradle b/BauSystem_19/build.gradle index 56c1679d..cf962164 100644 --- a/BauSystem_19/build.gradle +++ b/BauSystem_19/build.gradle @@ -51,13 +51,13 @@ dependencies { implementation project(":BauSystem_Main") compileOnly 'org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT' - compileOnly files("${projectDir}/../lib/Spigot-1.19.jar") compileOnly 'it.unimi.dsi:fastutil:8.5.6' compileOnly 'com.mojang:datafixerupper:4.0.26' compileOnly 'io.netty:netty-all:4.1.68.Final' compileOnly 'com.mojang:authlib:1.5.25' compileOnly 'com.mojang:brigadier:1.0.18' - compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar") - compileOnly files("${projectDir}/../lib/SpigotCore.jar") + compileOnly spigot19 + compileOnly worldEdit15 + compileOnly spigotCore } \ No newline at end of file diff --git a/BauSystem_Main/build.gradle b/BauSystem_Main/build.gradle index 72b787b1..2bfcf6b8 100644 --- a/BauSystem_Main/build.gradle +++ b/BauSystem_Main/build.gradle @@ -56,12 +56,11 @@ dependencies { annotationProcessor 'org.atteo.classindex:classindex:3.11' testAnnotationProcessor 'org.atteo.classindex:classindex:3.11' - // compileOnly 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT' compileOnly 'org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT' - // compileOnly files("${projectDir}/../lib/Spigot-1.18.jar") - compileOnly files("${projectDir}/../lib/Spigot-1.19.jar") compileOnly 'com.mojang:authlib:1.5.25' compileOnly 'io.netty:netty-all:4.1.68.Final' - compileOnly files("${projectDir}/../lib/WorldEdit-1.15.jar") - compileOnly files("${projectDir}/../lib/SpigotCore.jar") + + compileOnly spigot19 + compileOnly worldEdit15 + compileOnly spigotCore } diff --git a/build.gradle b/build.gradle index 7f44d482..72e4c0ae 100644 --- a/build.gradle +++ b/build.gradle @@ -36,6 +36,8 @@ plugins { id 'com.github.johnrengelman.shadow' version '5.0.0' } +apply from: 'dependencies.gradle' + group 'de.steamwar' version '' @@ -91,10 +93,14 @@ allprojects { } dependencies { - implementation project(":BauSystem_Main") - implementation project(":BauSystem_15") - implementation project(":BauSystem_18") - implementation project(":BauSystem_19") + file('.').listFiles().each { + if (!it.isDirectory()) { + return + } + if (new File(it, "build.gradle").exists()) { + implementation project(":" + it.name) + } + } } task buildResources(type: Copy) { diff --git a/dependencies.gradle b/dependencies.gradle new file mode 100644 index 00000000..8c134e43 --- /dev/null +++ b/dependencies.gradle @@ -0,0 +1,34 @@ +/* + * 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 . + */ + +ext { + spigot19 = depend('Spigot-1.19') + spigot18 = depend('Spigot-1.18') + spigot15 = depend('Spigot-1.15') + worldEdit15 = depend('WorldEdit-1.15') + spigotCore = depend('SpigotCore') +} + +private def depend(s) { + if (file("${rootDir}/lib/${s}.jar").exists()) { + return files("${rootDir}/lib/${s}.jar") + } else { + return "de.steamwar:${s.toLowerCase()}:RELEASE" + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 3402077c..7c452a9c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -19,7 +19,11 @@ rootProject.name = 'BauSystem2.0' -include 'BauSystem_15' -include 'BauSystem_18' -include 'BauSystem_19' -include 'BauSystem_Main' +file('.').listFiles().each { + if (!it.isDirectory()) { + return + } + if (new File(it, "build.gradle").exists()) { + include(it.name) + } +}