From e9a5942156f1764f07ab7307c1a57e2e9ce6f03f Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 6 Nov 2026 22:36:42 +0100 Subject: [PATCH] feat: add modrinth version names and added supported velocity versions --- .../main/kotlin/gradeway-release.gradle.kts | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/buildSrc/src/main/kotlin/gradeway-release.gradle.kts b/buildSrc/src/main/kotlin/gradeway-release.gradle.kts index f9db1e2..847ab6d 100644 --- a/buildSrc/src/main/kotlin/gradeway-release.gradle.kts +++ b/buildSrc/src/main/kotlin/gradeway-release.gradle.kts @@ -16,22 +16,29 @@ val supportedMinecraftVersions = arrayOf( "26.3", ) +val supportedVelocityVersions = arrayOf( + "4.3.0", + "4.3.1" +) + val hangarApiKey = findProperty("gradeway.hangar.apiKey") as? String val modrinthToken = findProperty("gradeway.modrinth.token") as? String val readMeContent = rootProject.file("README.md").readText() +data class ModuleInfo(val loaders: List, val prettyName: String) + // the mappings for Modrinth loader types -val moduleLoaders = when (project.name) { - "plugin-bukkit" -> listOf("bukkit", "spigot") - "plugin-paper" -> listOf("paper", "purpur", "folia") - "plugin-bungeecord" -> listOf("bungeecord") - "plugin-velocity" -> listOf("velocity") - else -> emptyList() +val moduleInfo = when (project.name) { + "plugin-bukkit" -> ModuleInfo(listOf("bukkit", "spigot"), "Bukkit") + "plugin-paper" -> ModuleInfo(listOf("paper", "purpur", "folia"), "Paper") + "plugin-bungeecord" -> ModuleInfo(listOf("bungeecord"), "BungeeCord") + "plugin-velocity" -> ModuleInfo(listOf("velocity"), "Velocity") + else -> null } if (modrinthToken != null) { - require(moduleLoaders.isNotEmpty()) { + require(moduleInfo != null) { "No Modrinth loader mapped for project '${project.name}' - add one to moduleLoaders in gradeway-release.gradle.kts" } @@ -41,11 +48,12 @@ if (modrinthToken != null) { projectId.set("gradeway") versionType.set("release") versionNumber.set(moduleVersion) + versionName.set(moduleVersion + " - " + moduleInfo.prettyName) uploadFile.set(tasks.shadowJar.flatMap { it.archiveFile }) syncBodyFrom = readMeContent - loaders.addAll(moduleLoaders) + loaders.addAll(moduleInfo.loaders) gameVersions.addAll(*supportedMinecraftVersions) } } @@ -71,13 +79,12 @@ if (hangarSupported) { } } -// TODO: check which versions are accepted. -// if (project.name == "plugin-velocity") { -// velocity { -// jar = tasks.shadowJar.flatMap { it.archiveFile } -// platformVersions.addAll(*supportedMinecraftVersions) -// } -// } + if (project.name == "plugin-velocity") { + velocity { + jar = tasks.shadowJar.flatMap { it.archiveFile } + platformVersions.addAll(*supportedVelocityVersions) + } + } } } }