From d7db981f1e351de3a33a21429011297841ef3467 Mon Sep 17 00:00:00 2001 From: Username404 Date: Fri, 25 Mar 2022 16:02:12 +0100 Subject: [PATCH] Update the modrinth minotaur plugin Signed-off-by: Username404 --- build.gradle.kts | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index fe445af..0b60dd4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,6 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.modrinth.minotaur.request.VersionType +import com.modrinth.minotaur.dependencies.DependencyType import net.fabricmc.loom.LoomGradleExtension import net.fabricmc.loom.LoomGradlePlugin @@ -26,7 +27,7 @@ plugins { id("com.github.ben-manes.versions") version "0.42.0" id("net.kyori.indra.git") version "2.1.1" id("org.cqfn.diktat.diktat-gradle-plugin") version "1.0.3" - id("com.modrinth.minotaur") version "1.2.1" + id("com.modrinth.minotaur") version "2.1.1" } group = "fr.username404" @@ -260,28 +261,29 @@ repositories { mavenCentral() } -tasks { - file("remappedJars").let { if (it.exists()) clean.get().delete.add(it) } - val publishToModrinth = register("publishtoModrinth") { - val envStr: String? = System.getenv("MODRINTH") - onlyIf { envStr != null } - versionNumber = version.toString() - projectId = "OuGyGg6A" - token = envStr - addGameVersion(mcBase) - addDependency("Bxm9xbNJ", com.modrinth.minotaur.request.Dependency.DependencyType.REQUIRED) // Kotlinforforge dependency - versionType = VersionType.ALPHA - detectLoaders = false - versionName = "${project.name} $versionNumber for Minecraft $gameVersions and higher" - fileTree("$rootDir/remappedJars/").files.forEach { - with(it.name) { - when { - contains("fabric") -> uploadFile = it - contains("forge") -> addFile(it) +file("remappedJars").let { if (it.exists()) tasks.clean.get().delete.add(it) } + +modrinth { + projectId.set("OuGyGg6A") + gameVersions.add(mcBase) + dependencies.add(com.modrinth.minotaur.dependencies.Dependency("Bxm9xbNJ", DependencyType.REQUIRED)) // Kotlinforforge dependency + versionType.set(VersionType.ALPHA.name) + detectLoaders.set(false) + versionName.set("${project.name} $versionNumber for Minecraft $gameVersions and higher") + fileTree("$rootDir/remappedJars/").files.forEach { + with(it.name) { + when { + contains("fabric") -> { + loaders.add("fabric") + uploadFile.set(it) + } + contains("forge") -> { + loaders.add("forge") + additionalFiles.add(it) } } } - addLoader("fabric"); addLoader("forge") } - build.get().finalizedBy(publishToModrinth) } + +tasks.modrinth.get().dependsOn(tasks.build)