Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions buildSrc/src/main/kotlin/gradeway-release.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>, 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"
}

Expand All @@ -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)
}
}
Expand All @@ -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)
}
}
}
}
}
Expand Down
Loading