--- a/paper-server/build.gradle.kts +++ b/paper-server/build.gradle.kts @@ -13,10 +_,11 @@ } val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" +val leafMavenPublicUrl = "https://maven.nostal.ink/repository/maven-snapshots/" // Leaf - project setup - Add publish repo dependencies { mache("io.papermc:mache:1.21.5+build.2") - 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") } @@ -28,6 +_,19 @@ // oldPaperCommit = "f4f275519f7c1fbe9db173b7144a4fe81440e365" //} + // 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 { buildDataRef = "702e1a0a5072b2c4082371d5228cb30525687efc" packageVersion = "v1_21_R4" // also needs to be updated in MappingEnvironment @@ -50,6 +_,7 @@ libraryRepositories.addAll( "https://repo.maven.apache.org/maven2/", paperMavenPublicUrl, + leafMavenPublicUrl // Leaf - project setup - Add publish repo ) } @@ -108,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()) } @@ -130,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-1") // 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.21.0") // Keep in sync with adventureVersion from Paper-API build file runtimeConfiguration(sourceSets.main.map { it.runtimeClasspath }) @@ -144,41 +_,58 @@ 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-20250225.064233-199") implementation("org.spongepowered:configurate-core:4.2.0-20250225.064233-204") // Pinned dependency of above pinned yaml snapshot. + // 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 } - runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6") - runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18") - runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18") + runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.9") + runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.22") // Dreeam TODO - Update to 2.0.1 + runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.22") // Dreeam TODO - Update to 2.0.1 + // Leaf end - Bump Dependencies 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 @@ -192,28 +_,40 @@ // Spark implementation("me.lucko:spark-api:0.1-20240720.200737-2") implementation("me.lucko:spark-paper:1.10.133-20250413.112336-1") -} + + implementation("io.netty:netty-all:4.1.119.Final") // Leaf - Bump Dependencies // Dreeam TODO - Update to 4.2.0 +} + +// Gale start - hide irrelevant compilation warnings +tasks.withType { + 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, @@ -267,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()) @@ -325,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() @@ -370,3 +_,62 @@ classpath(tasks.createReobfPaperclipJar.flatMap { it.outputZip }) mainClass.set(null as String?) } + +// Gale start - package license into jar +tasks.register("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