9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-server/build.gradle.kts.patch
Dreeam cb403fe2cd Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@1f93f566 [ci/skip] Improve getPotentialBedLocation deprecation (#12857)
PaperMC/Paper@6fb36e34 Replace compileOnly with implementation for test visibility (#12841)
PaperMC/Paper@aa4ef067 Update DataConverter constants for 1.21.8
PaperMC/Paper@f7c59f91 Fix broken resource pack API when configured in configuration stage (#12866)
PaperMC/Paper@0dad7f15 Add Bee#set/getTimeSinceSting() methods (#12792)
PaperMC/Paper@782ce950 Allow forcing break effects when using breakNaturally (#12734)
PaperMC/Paper@a2d37f12 Remove invalid team colors nicely (#12874)
PaperMC/Paper@617e5a46 Update to configurate 4.2.0 (#12869)
PaperMC/Paper@602ea9f0 Restore previous PlayerToggleSneakEvent behaviour (#12815)
PaperMC/Paper@c8a8c0ef feat(plugin): make Plugin extend Namespaced (#12867)
2025-07-21 08:29:33 +08:00

307 lines
13 KiB
Diff

--- a/paper-server/build.gradle.kts
+++ b/paper-server/build.gradle.kts
@@ -15,10 +_,11 @@
}
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
+val leafMavenPublicUrl = "https://maven.leafmc.one/snapshots/" // Leaf - project setup - Add publish repo
dependencies {
mache("io.papermc:mache:1.21.8+build.1")
- paperclip("io.papermc:paperclip:3.0.3")
+ paperclip("cn.dreeam:quantumleaper:1.0.0-SNAPSHOT") // Leaf - project setup - Use own paperclip fork
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
@@ -26,6 +_,19 @@
minecraftVersion = providers.gradleProperty("mcVersion")
gitFilePatches = false
+ // Leaf start - project setup
+ val leaf = forks.register("leaf") {
+ upstream.patchDir("paperServer") {
+ upstreamPath = "paper-server"
+ excludes = setOf("src/minecraft", "patches", "build.gradle.kts")
+ patchesDir = rootDirectory.dir("leaf-server/paper-patches")
+ outputDir = rootDirectory.dir("paper-server")
+ }
+ }
+
+ activeFork = leaf
+ // Leaf end - project setup
+
spigot {
enabled = true
buildDataRef = "436eac9815c211be1a2a6ca0702615f995e81c44"
@@ -49,6 +_,7 @@
libraryRepositories.addAll(
"https://repo.maven.apache.org/maven2/",
paperMavenPublicUrl,
+ leafMavenPublicUrl // Leaf - project setup - Add publish repo
)
}
@@ -107,7 +_,22 @@
}
}
-val log4jPlugins = sourceSets.create("log4jPlugins")
+// Leaf start - project setup
+sourceSets {
+ main {
+ java { srcDir("../paper-server/src/main/java") }
+ resources { srcDir("../paper-server/src/main/resources") }
+ }
+ test {
+ java { srcDir("../paper-server/src/test/java") }
+ resources { srcDir("../paper-server/src/test/resources") }
+ }
+}
+
+val log4jPlugins = sourceSets.create("log4jPlugins") {
+ java { srcDir("../paper-server/src/log4jPlugins/java") }
+}
+// Leaf end - project setup
configurations.named(log4jPlugins.compileClasspathConfigurationName) {
extendsFrom(configurations.compileClasspath.get())
}
@@ -129,10 +_,20 @@
}
dependencies {
- implementation(project(":paper-api"))
+ implementation(project(":leaf-api")) // Leaf - project setup
+
+ // Leaf start - Libraries
+ implementation("com.github.thatsmusic99:ConfigurationMaster-API:v2.0.0-rc.3") { // Leaf config
+ exclude(group = "org.yaml", module = "snakeyaml")
+ }
+ implementation("com.github.luben:zstd-jni:1.5.7-3") // LinearPaper
+ implementation("org.lz4:lz4-java:1.8.0") // LinearPaper
+ implementation("com.github.ben-manes.caffeine:caffeine:3.2.0")
+ // Leaf end - Libraries
+
implementation("ca.spottedleaf:concurrentutil:0.0.3")
- implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
- implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
+ implementation("org.jline:jline-terminal-ffm:3.29.0") // use ffm on java 22+ // Leaf - Bump Dependencies
+ implementation("org.jline:jline-terminal-jni:3.29.0") // fall back to jni on java 21 // Leaf - Bump Dependencies
implementation("net.minecrell:terminalconsoleappender:1.3.0")
implementation("net.kyori:adventure-text-serializer-ansi:4.23.0") // Keep in sync with adventureVersion from Paper-API build file
runtimeConfiguration(sourceSets.main.map { it.runtimeClasspath })
@@ -143,24 +_,38 @@
all its classes to check if they are plugins.
Scanning takes about 1-2 seconds so adding this speeds up the server start.
*/
- implementation("org.apache.logging.log4j:log4j-core:2.24.1")
- log4jPlugins.annotationProcessorConfigurationName("org.apache.logging.log4j:log4j-core:2.24.1") // Needed to generate meta for our Log4j plugins
+ // Leaf start - Bump Dependencies
+ implementation("org.apache.logging.log4j:log4j-core:2.24.3")
+ log4jPlugins.annotationProcessorConfigurationName("org.apache.logging.log4j:log4j-core:2.24.3") // Needed to generate meta for our Log4j plugins
+ // Leaf end - Bump Dependencies
runtimeOnly(log4jPlugins.output)
alsoShade(log4jPlugins.output)
implementation("com.velocitypowered:velocity-native:3.4.0-SNAPSHOT") {
isTransitive = false
}
- implementation("io.netty:netty-codec-haproxy:4.1.118.Final") // Add support for proxy protocol
- implementation("org.apache.logging.log4j:log4j-iostreams:2.24.1")
+ // Leaf start - Bump Dependencies
+ implementation("io.netty:netty-codec-haproxy:4.1.119.Final") // Add support for proxy protocol
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.24.3")
+ // Leaf end - Bump Dependencies
implementation("org.ow2.asm:asm-commons:9.8")
implementation("org.spongepowered:configurate-yaml:4.2.0")
+ // Purpur start
+ implementation("org.mozilla:rhino-runtime:1.7.15")
+ implementation("org.mozilla:rhino-engine:1.7.15")
+ implementation("dev.omega24:upnp4j:1.0")
+ // Purpur end
+
// Deps that were previously in the API but have now been moved here for backwards compat, eventually to be removed
runtimeOnly("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.49.1.0")
- runtimeOnly("com.mysql:mysql-connector-j:9.2.0")
- runtimeOnly("com.lmax:disruptor:3.4.4")
+ runtimeOnly("com.mysql:mysql-connector-j:9.2.0") {
+ exclude("com.google.protobuf", "protobuf-java") // Leaf - Exclude outdated protobuf version
+ }
+ runtimeOnly("com.google.protobuf:protobuf-java:4.30.1")
+ // Leaf start - Bump Dependencies
+ runtimeOnly("com.lmax:disruptor:3.4.4") // Dreeam TODO - Waiting Log4j 3.x to support disruptor 4.0.0
implementation("com.googlecode.json-simple:json-simple:1.1.1") { // change to runtimeOnly once Timings is removed
isTransitive = false // includes junit
}
@@ -168,11 +_,13 @@
testImplementation("io.github.classgraph:classgraph:4.8.179") // For mob goal test
testImplementation("org.junit.jupiter:junit-jupiter:5.12.2")
testImplementation("org.junit.platform:junit-platform-suite-engine:1.12.2")
- testImplementation("org.hamcrest:hamcrest:2.2")
- testImplementation("org.mockito:mockito-core:5.14.1")
- mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Configure mockito agent that is needed in newer java versions
+ // Leaf start - Bump Dependencies
+ testImplementation("org.hamcrest:hamcrest:3.0")
+ testImplementation("org.mockito:mockito-core:5.16.1")
+ mockitoAgent("org.mockito:mockito-core:5.16.1") { isTransitive = false } // Configure mockito agent that is needed in newer java versions
testImplementation("org.ow2.asm:asm-tree:9.8")
- testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // CartesianTest
+ testImplementation("org.junit-pioneer:junit-pioneer:2.3.0") // CartesianTest
+ // Leaf end - Bump Dependencies
implementation("net.neoforged:srgutils:1.0.9") // Mappings handling
implementation("net.neoforged:AutoRenamingTool:2.0.3") // Remap plugins
@@ -183,31 +_,45 @@
implementation("io.papermc:reflection-rewriter-runtime:$reflectionRewriterVersion")
implementation("io.papermc:reflection-rewriter-proxy-generator:$reflectionRewriterVersion")
+ // Leaf start - Bump Dependencies
// Spark
- implementation("me.lucko:spark-api:0.1-20240720.200737-2")
- implementation("me.lucko:spark-paper:1.10.133-20250413.112336-1")
-}
+ implementation("me.lucko:spark-api:0.1-dev-f0b5206-SNAPSHOT")
+ implementation("me.lucko:spark-paper:1.10-dev-f0b5206-SNAPSHOT")
+
+ implementation("io.netty:netty-all:4.1.119.Final") // Dreeam TODO - Update to 4.2.0
+ // Leaf end - Bump Dependencies
+}
+
+// Gale start - hide irrelevant compilation warnings
+tasks.withType<JavaCompile> {
+ val compilerArgs = options.compilerArgs
+ compilerArgs.add("-Xlint:-module")
+ compilerArgs.add("-Xlint:-removal")
+ compilerArgs.add("-Xlint:-dep-ann")
+ compilerArgs.add("--add-modules=jdk.incubator.vector") // Gale - Pufferfish - SIMD support
+}
+// Gale end - hide irrelevant compilation warnings
tasks.jar {
manifest {
val git = Git(rootProject.layout.projectDirectory.path)
val mcVersion = rootProject.providers.gradleProperty("mcVersion").get()
val build = System.getenv("BUILD_NUMBER") ?: null
- val buildTime = if (build != null) Instant.now() else Instant.EPOCH
+ val buildTime = Instant.now() // Leaf - project setup - Always use current as build time
val gitHash = git.exec(providers, "rev-parse", "--short=7", "HEAD").get().trim()
val implementationVersion = "$mcVersion-${build ?: "DEV"}-$gitHash"
val date = git.exec(providers, "show", "-s", "--format=%ci", gitHash).get().trim()
val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim()
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
- "Implementation-Title" to "Paper",
+ "Implementation-Title" to "Leaf", // Leaf - Rebrand
"Implementation-Version" to implementationVersion,
"Implementation-Vendor" to date,
- "Specification-Title" to "Paper",
+ "Specification-Title" to "Leaf", // Leaf - Rebrand
"Specification-Version" to project.version,
- "Specification-Vendor" to "Paper Team",
- "Brand-Id" to "papermc:paper",
- "Brand-Name" to "Paper",
+ "Specification-Vendor" to "Winds Studio", // Leaf - Rebrand
+ "Brand-Id" to "winds-studio:leaf", // Leaf - Rebrand
+ "Brand-Name" to "Leaf", // Leaf - Rebrand
"Build-Number" to (build ?: ""),
"Build-Time" to buildTime.toString(),
"Git-Branch" to gitBranch,
@@ -266,7 +_,7 @@
jvmArgumentProviders.add(provider)
}
-val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
+val generatedDir: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-server/src/generated/java").asFile.toPath() // Leaf - project setup
idea {
module {
generatedSourceDirs.add(generatedDir.toFile())
@@ -324,6 +_,8 @@
val memoryGb = providers.gradleProperty("paper.runMemoryGb").getOrElse("2")
minHeapSize = "${memoryGb}G"
maxHeapSize = "${memoryGb}G"
+ jvmArgs("--enable-preview") // Gale - enable preview features for development runs
+ jvmArgs("--add-modules=jdk.incubator.vector") // Gale - Pufferfish - SIMD support
doFirst {
workingDir.mkdirs()
@@ -386,3 +_,78 @@
}
}
}
+
+// Gale start - package license into jar
+tasks.register<Copy>("copyLicense") {
+ from(layout.projectDirectory.file("../paper-server/LICENSE.txt"))
+ into(layout.buildDirectory.dir("tmp/copiedlicense"))
+}
+
+tasks.processResources {
+ dependsOn("copyLicense")
+}
+
+sourceSets {
+ main {
+ resources {
+ srcDir(layout.buildDirectory.dir("tmp/copiedlicense"))
+ }
+ }
+}
+// Gale end - package license into jar
+
+// Gale start - branding changes - package license into jar
+// Based on io.papermc.paperweight.core.taskcontainers.PaperclipTasks
+tasks.named("createMojmapPaperclipJar") {
+ val name = rootProject.name
+ val version = project.version
+ val licenseFileName = "LICENSE.txt"
+ val licenseFilePath = layout.projectDirectory.dir("../paper-server/$licenseFileName").asFile
+
+ // Based on io.papermc.paperweight.core.taskcontainers.PaperclipTasks
+ val jarName = listOfNotNull(
+ name,
+ "paperclip",
+ version,
+ "mojmap"
+ ).joinToString("-") + ".jar"
+
+ // Based on io.papermc.paperweight.core.taskcontainers.PaperclipTasks
+ val zipFile = layout.buildDirectory.file("libs/$jarName").get().path
+
+ val rootDir = findOutputDir(zipFile)
+
+ doLast {
+
+ try {
+ unzip(zipFile, rootDir)
+
+ licenseFilePath.copyTo(rootDir.resolve(licenseFileName).toFile())
+
+ ensureDeleted(zipFile)
+
+ zip(rootDir, zipFile)
+ } finally {
+ @OptIn(kotlin.io.path.ExperimentalPathApi::class)
+ rootDir.toFile().deleteRecursively()
+ }
+
+ }
+}
+// Gale end - branding changes - package license into jar
+
+// Leaf start - Leaf JUnit test suite
+tasks.register<Test>("runLeafTests") {
+ group = LifecycleBasePlugin.VERIFICATION_GROUP
+ include("**/LeafTestSuite.class")
+ workingDir = temporaryDir
+ useJUnitPlatform {
+ forkEvery = 1
+ }
+
+ // Configure mockito agent that is needed in newer java versions
+ val provider = objects.newInstance<MockitoAgentProvider>()
+ provider.fileCollection.from(mockitoAgent)
+ jvmArgumentProviders.add(provider)
+}
+// Leaf end - Leaf JUnit test suite