Initialize Infstar Paper-based server core
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import java.util.Locale
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
|
||||
}
|
||||
|
||||
if (!file(".git").exists()) {
|
||||
error("Infstar 必须从 Git 仓库检出;Paperweight 需要 Git 元数据来应用补丁。")
|
||||
}
|
||||
|
||||
rootProject.name = "infstar"
|
||||
|
||||
for (name in listOf("infstar-api", "infstar-server")) {
|
||||
include(name.lowercase(Locale.ENGLISH))
|
||||
}
|
||||
|
||||
gradle.lifecycle.beforeProject {
|
||||
val minecraftVersion = providers.gradleProperty("mcVersion").get().trim()
|
||||
val gitHash = providers.exec {
|
||||
commandLine("git", "rev-parse", "--short=7", "HEAD")
|
||||
isIgnoreExitValue = true
|
||||
}.standardOutput.asText.map { output ->
|
||||
output.trim().takeIf { it.matches(Regex("[0-9a-fA-F]{7,40}")) } ?: "unknown"
|
||||
}.get()
|
||||
version = "$minecraftVersion-dev-$gitHash"
|
||||
}
|
||||
Reference in New Issue
Block a user