Files
Shiroha/settings.gradle.kts
T

59 lines
1.7 KiB
Kotlin
Raw Normal View History

2026-07-09 00:03:09 +08:00
pluginManagement {
val weightVersion: String by settings
repositories {
gradlePluginPortal()
mavenLocal()
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.bacteriawa.com/repository/maven-public/")
}
plugins {
2026-07-12 15:10:57 +08:00
id("io.papermc.paperweight.patcher") version weightVersion
id("io.papermc.paperweight.core") version weightVersion
2026-07-09 00:03:09 +08:00
}
}
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}
2026-07-14 13:29:52 +08:00
rootProject.name = "shiroha"
2026-07-09 00:03:09 +08:00
2026-07-14 13:29:52 +08:00
for (name in listOf("shiroha-api", "shiroha-server")) {
2026-07-09 00:03:09 +08:00
include(name)
file(name).mkdirs()
}
optionalInclude("test-plugin")
2026-07-14 13:29:52 +08:00
optionalInclude("shiroha-generator")
2026-07-09 00:03:09 +08:00
fun optionalInclude(name: String, op: (ProjectDescriptor.() -> Unit)? = null) {
val settingsFile = file("$name.settings.gradle.kts")
if (settingsFile.exists()) {
apply(from = settingsFile)
findProject(":$name")?.let { op?.invoke(it) }
} else {
settingsFile.writeText(
"""
// Uncomment to enable the '$name' project
// include(":$name")
""".trimIndent()
)
}
}
gradle.lifecycle.beforeProject {
val mcVersion = providers.gradleProperty("mcVersion").get().trim()
2026-07-14 13:29:52 +08:00
val shirohaVersionChannel = providers.gradleProperty("channel").get().trim()
val shirohaBuildNumber = providers.environmentVariable("BUILD_NUMBER").orNull?.trim()?.toInt()
val versionString = if (shirohaBuildNumber == null) {
2026-07-09 00:03:09 +08:00
"$mcVersion.local-SNAPSHOT"
} else {
2026-07-14 13:29:52 +08:00
"$mcVersion.build.$shirohaBuildNumber-${shirohaVersionChannel.lowercase()}"
2026-07-09 00:03:09 +08:00
}
version = versionString
}
include("FlowSched")