From 7c265bff05fb4fe18cdca49963986a5441175d32 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 21 May 2023 21:26:37 +0200 Subject: [PATCH] Add Gradle Plugin --- build.gradle | 58 +------------------------------------------------ settings.gradle | 9 ++++++++ 2 files changed, 10 insertions(+), 57 deletions(-) diff --git a/build.gradle b/build.gradle index a843559..7456d20 100644 --- a/build.gradle +++ b/build.gradle @@ -3,37 +3,12 @@ plugins { id 'java' id 'com.github.johnrengelman.shadow' version '5.0.0' -} - -ext.swdep = { s -> - if (file("${rootDir}/lib/${s}.jar").exists()) { - return files("${rootDir}/lib/${s}.jar") - } else { - if (s.contains("-")) { - return "de.steamwar:${s.toLowerCase().replace('-', ':')}" - } else { - return "de.steamwar:${s.toLowerCase()}:RELEASE" - } - } + id 'de.steamwar.gradle' version 'RELEASE' } group = 'de.steamwar' version = '' -Properties steamwarProperties = new Properties() -if (file("steamwar.properties").exists()) { - steamwarProperties.load(file("steamwar.properties").newDataInputStream()) -} - -ext { - buildName = 'Builder' - artifactName = 'Builder' - - uberJarName = "${buildName}-all.jar" - jarName = "${artifactName}.jar" - libs = "${buildDir}/libs" -} - compileJava.options.encoding = 'UTF-8' sourceCompatibility = '1.8' @@ -57,40 +32,9 @@ repositories { maven { url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/') } - - maven { - url = uri('https://steamwar.de/maven') - credentials { - username = steamwarProperties.getProperty("maven.username", "") - password = steamwarProperties.getProperty("maven.password", "") - } - } } dependencies { compileOnly 'org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT' compileOnly swdep("SpigotCore") } - -task buildProject { - description 'Build this project' - group "Steamwar" - - dependsOn build -} - -task finalizeProject { - description 'Finalize this project' - group "Steamwar" - - doLast { - if ("${buildDir}" == null) { - return - } - delete fileTree("${libs}").matching { - exclude("${uberJarName}") - } - file(libs + "/" + uberJarName).renameTo(file(libs + "/" + jarName)) - } -} -// build.finalizedBy(finalizeProject) diff --git a/settings.gradle b/settings.gradle index a240547..6aec347 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,10 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven { + url = uri('https://steamwar.de/maven/') + } + } +} + rootProject.name = 'Builder'