支持 Leaf 1.21.11 并内置 TabooLib 依赖
This commit is contained in:
+125
-7
@@ -1,9 +1,7 @@
|
||||
import io.izzel.taboolib.gradle.*
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
id("io.izzel.taboolib") version "2.0.11"
|
||||
id("io.izzel.taboolib") version "2.0.2-community-1"
|
||||
id("org.jetbrains.kotlin.jvm") version "1.7.10"
|
||||
}
|
||||
|
||||
@@ -23,12 +21,27 @@ taboolib {
|
||||
bukkitNodes["update-info"] = "支持1.12.2物品附加值"
|
||||
}
|
||||
env {
|
||||
install(NMS_UTIL, UI)
|
||||
install(EXPANSION_COMMAND_HELPER, BUKKIT_ALL)
|
||||
install(DATABASE, CHAT, CONFIGURATION, LANG, NMS, KETHER)
|
||||
// TabooLib 6.2 split the legacy bundles into versioned modules. The
|
||||
// 6.2 platform contains the Bukkit 1.21 compatibility layer.
|
||||
install(
|
||||
"bukkit-ui",
|
||||
"minecraft-command-helper",
|
||||
"bukkit-hook",
|
||||
"bukkit-util",
|
||||
"bukkit-xseries",
|
||||
"platform-bukkit",
|
||||
"platform-bukkit-impl",
|
||||
"database",
|
||||
"minecraft-chat",
|
||||
"basic-configuration",
|
||||
"minecraft-i18n",
|
||||
"minecraft-kether"
|
||||
)
|
||||
|
||||
repoTabooLib = "https://maven.xbaimiao.com/repository/maven-public/"
|
||||
}
|
||||
version {
|
||||
taboolib = "6.1.1-beta17"
|
||||
taboolib = "6.2.0-beta33"
|
||||
}
|
||||
// relocate("kotlin", "libs.kotlin171")
|
||||
relocate("com.xbaimiao.ktor", "com.github.xbaimiao.shoppro.stat")
|
||||
@@ -40,6 +53,111 @@ repositories {
|
||||
maven("https://r.irepo.space/maven/")
|
||||
}
|
||||
|
||||
val bundledRuntime by configurations.creating
|
||||
|
||||
val taboolibRuntimeModules = listOf(
|
||||
"common",
|
||||
"platform-bukkit",
|
||||
"common-env",
|
||||
"common-util",
|
||||
"common-legacy-api",
|
||||
"common-platform-api",
|
||||
"bukkit-ui",
|
||||
"minecraft-command-helper",
|
||||
"bukkit-hook",
|
||||
"bukkit-util",
|
||||
"bukkit-xseries",
|
||||
"platform-bukkit-impl",
|
||||
"database",
|
||||
"minecraft-chat",
|
||||
"basic-configuration",
|
||||
"minecraft-i18n",
|
||||
"minecraft-kether"
|
||||
)
|
||||
|
||||
dependencies {
|
||||
// These files are embedded as resources and installed before TabooLib's
|
||||
// primitive loader runs, so a server can start without Maven access.
|
||||
add("bundledRuntime", "me.lucko:jar-relocator:1.7")
|
||||
add("bundledRuntime", "org.ow2.asm:asm:9.6")
|
||||
add("bundledRuntime", "org.ow2.asm:asm-util:9.6")
|
||||
add("bundledRuntime", "org.ow2.asm:asm-commons:9.6")
|
||||
add("bundledRuntime", "org.tabooproject.reflex:reflex:1.1.7")
|
||||
add("bundledRuntime", "org.tabooproject.reflex:analyser:1.1.7")
|
||||
add("bundledRuntime", "org.jetbrains.kotlin:kotlin-stdlib:1.7.10")
|
||||
add("bundledRuntime", "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10")
|
||||
add("bundledRuntime", "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.3")
|
||||
taboolibRuntimeModules.forEach { module ->
|
||||
add("bundledRuntime", "io.izzel.taboolib:$module:6.2.0-beta33")
|
||||
}
|
||||
}
|
||||
|
||||
val prepareBundledRuntime by tasks.registering {
|
||||
val output = layout.buildDirectory.dir("generated/bundled-runtime")
|
||||
outputs.dir(output)
|
||||
doLast {
|
||||
val root = output.get().asFile
|
||||
root.deleteRecursively()
|
||||
val resourceRoot = root.resolve("META-INF/taboolib/bundled")
|
||||
val index = linkedMapOf<String, String>()
|
||||
configurations["bundledRuntime"].resolvedConfiguration.resolvedArtifacts.forEach { artifact ->
|
||||
val module = artifact.moduleVersion.id
|
||||
val relative = "${module.group.replace('.', '/')}/${module.name}/${module.version}/${module.name}-${module.version}.jar"
|
||||
val destination = resourceRoot.resolve(relative)
|
||||
destination.parentFile.mkdirs()
|
||||
artifact.file.copyTo(destination, overwrite = true)
|
||||
index[relative] = relative
|
||||
|
||||
// The TabooLib build metadata in this project is generated by the
|
||||
// Kotlin 1.7.10 Gradle plugin, while Reflex 1.1.7 resolves a newer
|
||||
// compatible stdlib transitively. Install the resolved bytes at
|
||||
// the exact paths PrimitiveSettings requests as well.
|
||||
if (module.group == "org.jetbrains.kotlin" &&
|
||||
(module.name == "kotlin-stdlib" || module.name == "kotlin-stdlib-jdk8")) {
|
||||
val requested = "${module.group.replace('.', '/')}/${module.name}/1.7.10/${module.name}-1.7.10.jar"
|
||||
val requestedDestination = resourceRoot.resolve(requested)
|
||||
requestedDestination.parentFile.mkdirs()
|
||||
artifact.file.copyTo(requestedDestination, overwrite = true)
|
||||
index[requested] = requested
|
||||
val requestedPom = requested.removeSuffix(".jar") + ".pom"
|
||||
val requestedPomFile = resourceRoot.resolve(requestedPom)
|
||||
requestedPomFile.parentFile.mkdirs()
|
||||
requestedPomFile.writeText(
|
||||
"<project><modelVersion>4.0.0</modelVersion>" +
|
||||
"<groupId>${module.group}</groupId><artifactId>${module.name}</artifactId>" +
|
||||
"<version>1.7.10</version></project>",
|
||||
Charsets.UTF_8
|
||||
)
|
||||
index[requestedPom] = requestedPom
|
||||
}
|
||||
|
||||
// RuntimeEnvDependency checks POM + SHA-1 files for Kotlin and
|
||||
// coroutine roots. A minimal local POM is sufficient because all
|
||||
// requested root JARs are bundled explicitly.
|
||||
if (module.group == "org.jetbrains.kotlin" || module.group == "org.jetbrains.kotlinx") {
|
||||
val pomRelative = relative.removeSuffix(".jar") + ".pom"
|
||||
val pom = resourceRoot.resolve(pomRelative)
|
||||
pom.parentFile.mkdirs()
|
||||
pom.writeText(
|
||||
"<project><modelVersion>4.0.0</modelVersion>" +
|
||||
"<groupId>${module.group}</groupId><artifactId>${module.name}</artifactId>" +
|
||||
"<version>${module.version}</version></project>",
|
||||
Charsets.UTF_8
|
||||
)
|
||||
index[pomRelative] = pomRelative
|
||||
}
|
||||
}
|
||||
val indexFile = root.resolve("META-INF/taboolib/bundled-libraries.properties")
|
||||
indexFile.parentFile.mkdirs()
|
||||
indexFile.writeText(index.entries.joinToString("\n") { (target, resource) -> "$target=$resource" } + "\n", Charsets.UTF_8)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
dependsOn(prepareBundledRuntime)
|
||||
from(prepareBundledRuntime)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("com.mojang:authlib:3.16.29")
|
||||
compileOnly("ink.ptms:nms-all:1.0.0")
|
||||
|
||||
Reference in New Issue
Block a user