--- a/paper-server/build.gradle.kts +++ b/paper-server/build.gradle.kts @@ -1,4 +_,4 @@ -import io.papermc.fill.model.BuildChannel +//import io.papermc.fill.model.BuildChannel import io.papermc.paperweight.attribute.DevBundleOutput import io.papermc.paperweight.util.* import io.papermc.paperweight.util.data.FileEntry @@ -10,24 +_,37 @@ `java-library` `maven-publish` idea - id("io.papermc.paperweight.core") + id("org.leavesmc.leavesweight.core") // Leaves - build change id("io.papermc.fill.gradle") version "1.0.3" } val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" +val leavesMavenPublicUrl = "https://repo.leavesmc.com/snapshots/" // Leaves - build change dependencies { mache("io.papermc:mache:1.21.7+build.1") - paperclip("io.papermc:paperclip:3.0.3") + leavesclip("org.leavesmc:leavesclip:3.0.4") // Leaves - build change testRuntimeOnly("org.junit.platform:junit-platform-launcher") } paperweight { - minecraftVersion = providers.gradleProperty("mcVersion") + minecraftVersion = rootProject.providers.gradleProperty("mcVersion") // Leaves - build change gitFilePatches = false + // Leaves start - build change + val leaves = forks.register("leaves") { + upstream.patchDir("paperServer") { + upstreamPath = "paper-server" + excludes = setOf("src/minecraft", "patches", "build.gradle.kts") + patchesDir = rootDirectory.dir("leaves-server/paper-patches") + outputDir = rootDirectory.dir("paper-server") + } + } + activeFork = leaves + // Leaves end - build change + spigot { - enabled = true + // enabled = true buildDataRef = "436eac9815c211be1a2a6ca0702615f995e81c44" packageVersion = "v1_21_R5" // also needs to be updated in MappingEnvironment } @@ -49,6 +_,7 @@ libraryRepositories.addAll( "https://repo.maven.apache.org/maven2/", paperMavenPublicUrl, + leavesMavenPublicUrl // Leaves - build change ) } @@ -107,7 +_,22 @@ } } -val log4jPlugins = sourceSets.create("log4jPlugins") +// Leaves start - build change +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") } +} +// Leaves end - build change + configurations.named(log4jPlugins.compileClasspathConfigurationName) { extendsFrom(configurations.compileClasspath.get()) } @@ -129,7 +_,19 @@ } dependencies { - implementation(project(":paper-api")) + implementation(project(":leaves-api")) // Leaves - build change + implementation("commons-lang:commons-lang:2.6") // Leaves - build change + // Leaves start - linear + implementation("com.github.luben:zstd-jni:1.5.4-1") + implementation("org.lz4:lz4-java:1.8.0") + implementation("net.openhft:zero-allocation-hashing:0.16") + // Leaves end - linear + // Leaves start - leaves plugin + implementation("org.spongepowered:configurate-gson:4.2.0-SNAPSHOT") { + exclude(group = "com.google.code.gson", module = "gson") + exclude(group = "com.google.guava", module = "guava") + } + // Leaves end - leaves plugin 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 @@ -158,7 +_,6 @@ implementation("org.spongepowered:configurate-core:4.2.0-20250225.064233-204") // Pinned dependency of above pinned yaml snapshot. // 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") @@ -193,6 +_,16 @@ implementation("me.lucko:spark-paper:1.10.133-20250413.112336-1") } +// Leaves 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") // SIMD +} +// Leaves end - hide irrelevant compilation warnings + tasks.jar { manifest { val git = Git(rootProject.layout.projectDirectory.path) @@ -205,14 +_,14 @@ 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 "Leaves", // Leaves - build change "Implementation-Version" to implementationVersion, "Implementation-Vendor" to date, - "Specification-Title" to "Paper", + "Specification-Title" to "Leaves", // Leaves - build change "Specification-Version" to project.version, - "Specification-Vendor" to "Paper Team", - "Brand-Id" to "papermc:paper", - "Brand-Name" to "Paper", + "Specification-Vendor" to "Leaves Team", // Leaves - build change + "Brand-Id" to "leavesmc:leaves", // Leaves - build change + "Brand-Name" to "Leaves", // Leaves - build change "Build-Number" to (build ?: ""), "Build-Time" to buildTime.toString(), "Git-Branch" to gitBranch, @@ -271,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() idea { module { generatedSourceDirs.add(generatedDir.toFile()) @@ -364,17 +_,32 @@ classpath(tasks.createReobfBundlerJar.flatMap { it.outputZip }) mainClass.set(null as String?) } -tasks.registerRunTask("runPaperclip") { - description = "Spin up a test server from the Mojang mapped Paperclip jar" - classpath(tasks.createMojmapPaperclipJar.flatMap { it.outputZip }) - mainClass.set(null as String?) -} -tasks.registerRunTask("runReobfPaperclip") { - description = "Spin up a test server from the reobf Paperclip jar" - classpath(tasks.createReobfPaperclipJar.flatMap { it.outputZip }) - mainClass.set(null as String?) -} - + +// Leaves start - build change +tasks.registerRunTask("runLeavesclip") { + description = "Spin up a test server from the Mojang mapped Leavesclip jar" + systemProperty("leavesclip.enable.mixin", true) + classpath(tasks.createMojmapLeavesclipJar.flatMap { it.outputZip }) + mainClass.set(null as String?) +} +tasks.registerRunTask("runReobfLeavesclip") { + description = "Spin up a test server from the reobf Leavesclip jar" + systemProperty("leavesclip.enable.mixin", true) + classpath(tasks.createMojmapLeavesclipJar.flatMap { it.outputZip }) + mainClass.set(null as String?) +} +// Leaves end - build change + +// Leaves start - create config file +tasks.registerRunTask("createLeavesConfig") { + description = "Create a new leaves.yml" + mainClass = "org.leavesmc.leaves.config.GlobalConfigCreator" + classpath(sourceSets.main.map { it.runtimeClasspath }) +} +// Leaves end - create config file + +// Leaves start - we do not need this +/* fill { project("paper") versionFamily(paperweight.minecraftVersion.map { it.split(".", "-").takeWhile { part -> part.toIntOrNull() != null }.take(2).joinToString(".") }) @@ -391,3 +_,6 @@ } } } + +*/ +// Leaves end - we do not need this