9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

Update build.gradle.kts.patch

* Merged Gale's
This commit is contained in:
Dreeam
2025-03-26 12:19:34 -04:00
parent 2fe143b468
commit 78d8c9b6a7
5 changed files with 235 additions and 86 deletions

View File

@@ -78,4 +78,4 @@ jobs:
echo "No changes to commit."
fi
env:
CURR_PAPER_COMMIT: ${{ steps.currPaperCommit.outputs.currPaperCommit }}
CURR_PAPER_COMMIT: ${{ steps.currPaperCommit.outputs.currPaperCommit }}

View File

@@ -64,7 +64,7 @@ subprojects {
}
paperweight {
upstreams.register("paper") {
upstreams.paper {
repo = github("Dreeam-qwq", "Paper")
ref = providers.gradleProperty("paperCommit")

View File

@@ -1,5 +1,5 @@
--- a/gale-api/build.gradle.kts
+++ b/gale-api/build.gradle.kts
--- a/paper-api/build.gradle.kts
+++ b/paper-api/build.gradle.kts
@@ -9,11 +_,13 @@
withJavadocJar()
}
@@ -40,7 +40,7 @@
// Deprecate bungeecord-chat in favor of adventure
api("net.md-5:bungeecord-chat:$bungeeCordChatVersion-deprecated+build.19") {
@@ -68,29 +_,39 @@
@@ -68,32 +_,42 @@
apiAndDocs("net.kyori:adventure-text-serializer-plain")
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
@@ -88,30 +88,67 @@
+ // Leaf end - Bump Dependencies
}
val generatedApiPath: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath() // Gale - project setup
@@ -105,17 +_,21 @@
srcDir(generatedApiPath)
// Gale start - project setup
srcDir(file("../paper-api/src/main/java"))
+ srcDir(file("../gale-api/src/main/java")) // Leaf - project setup
}
resources {
srcDir(file("../paper-api/src/main/resources"))
+ srcDir(file("../gale-api/src/main/resources")) // Leaf - project setup
}
}
test {
-val generatedApiPath: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
+val generatedApiPath: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath() // Leaf - project setup
idea {
module {
generatedSourceDirs.add(generatedApiPath.toFile())
@@ -103,6 +_,20 @@
main {
java {
srcDir(file("../paper-api/src/test/java"))
+ srcDir(file("../gale-api/src/test/java")) // Leaf - project setup
}
resources {
srcDir(file("../paper-api/src/test/resources"))
+ srcDir(file("../gale-api/src/test/resources")) // Leaf - project setup
// Gale end - project setup
srcDir(generatedApiPath)
+ // Leaf start - project setup
+ srcDir(file("../paper-api/src/main/java"))
+ }
+ resources {
+ srcDir(file("../paper-api/src/main/resources"))
+ }
+ }
+ test {
+ java {
+ srcDir(file("../paper-api/src/test/java"))
+ }
+ resources {
+ srcDir(file("../paper-api/src/test/resources"))
+ // Leaf end - project setup
}
}
@@ -203,8 +_,8 @@
}
@@ -140,6 +_,15 @@
}
}
+// 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
val generateApiVersioningFile by tasks.registering {
inputs.property("version", project.version)
val pomProps = layout.buildDirectory.file("pom.properties")
@@ -159,6 +_,12 @@
"Automatic-Module-Name" to "org.bukkit"
)
}
+
+ // Gale start - package license into jar
+ from("${project.projectDir}/LICENSE.txt") {
+ into("")
+ }
+ // Gale end - package license into jar
}
abstract class Services {
@@ -169,12 +_,12 @@
tasks.withType<Javadoc> {
val options = options as StandardJavadocDocletOptions
- options.overview = "src/main/javadoc/overview.html"
+ options.overview = "../paper-api/src/main/javadoc/overview.html" // Leaf - project setup
options.use()
options.isDocFilesSubDirs = true
options.links(
@@ -122,7 +159,7 @@
"https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/",
"https://javadoc.io/doc/org.joml/joml/1.10.8/",
"https://www.javadoc.io/doc/com.google.code.gson/gson/2.11.0",
@@ -217,8 +_,8 @@
@@ -187,8 +_,8 @@
"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
"https://javadoc.io/doc/org.slf4j/slf4j-api/$slf4jVersion/",
@@ -133,7 +170,29 @@
)
options.tags("apiNote:a:API Note:")
@@ -276,6 +_,11 @@
@@ -202,16 +_,19 @@
}
// workaround for https://github.com/gradle/gradle/issues/4046
- inputs.dir("src/main/javadoc").withPropertyName("javadoc-sourceset")
+ inputs.dir("../paper-api/src/main/javadoc").withPropertyName("javadoc-sourceset") // Leaf - project setup
val fsOps = services.fileSystemOperations
doLast {
fsOps.copy {
- from("src/main/javadoc") {
+ from("../paper-api/src/main/javadoc") { // Leaf - project setup
include("**/doc-files/**")
}
into("build/docs/javadoc")
}
}
+
+ options.addStringOption("Xdoclint:none", "-quiet") // Gale - hide irrelevant compilation warnings
+ options.addStringOption("-add-modules", "jdk.incubator.vector") // Gale - Pufferfish - SIMD support
}
tasks.test {
@@ -243,6 +_,11 @@
jarToScan.set(tasks.jar.flatMap { it.archiveFile })
classpath.from(configurations.compileClasspath)
}

View File

@@ -1,5 +1,5 @@
--- a/gale-server/build.gradle.kts
+++ b/gale-server/build.gradle.kts
--- a/paper-server/build.gradle.kts
+++ b/paper-server/build.gradle.kts
@@ -9,10 +_,11 @@
}
@@ -7,45 +7,33 @@
+val leafMavenPublicUrl = "https://maven.nostal.ink/repository/maven-snapshots/" // Leaf - project setup - Add publish repo
dependencies {
mache("io.papermc:mache:1.21.4+build.7")
mache("io.papermc:mache:1.21.5+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")
}
@@ -31,7 +_,30 @@
}
}
@@ -24,6 +_,19 @@
// oldPaperCommit = "f4f275519f7c1fbe9db173b7144a4fe81440e365"
//}
- activeFork = gale
+ // Leaf start - project setup
+ val leaf = forks.register("leaf") {
+ forks = gale
+ upstream.patchRepo("paperServer") {
+ upstreamRepo = gale.patchedRepo("paperServer")
+ 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")
+ }
+ upstream.patchDir("galeServer") {
+ upstreamPath = "gale-server"
+ excludes = setOf(
+ "src/minecraft",
+ "paper-patches",
+ "minecraft-patches",
+ "build.gradle.kts",
+ "build.gradle.kts.patch"
+ )
+ patchesDir = rootDirectory.dir("leaf-server/gale-patches")
+ outputDir = rootDirectory.dir("gale-server")
+ }
+ }
+
+ activeFork = leaf
+ // Leaf end - project setup
// Gale end - project setup
+
spigot {
@@ -56,6 +_,7 @@
buildDataRef = "702e1a0a5072b2c4082371d5228cb30525687efc"
packageVersion = "v1_21_R3" // also needs to be updated in MappingEnvironment
@@ -46,6 +_,7 @@
libraryRepositories.addAll(
"https://repo.maven.apache.org/maven2/",
paperMavenPublicUrl,
@@ -53,27 +41,36 @@
)
}
@@ -119,10 +_,14 @@
main {
java { srcDir("../paper-server/src/main/java") }
resources { srcDir("../paper-server/src/main/resources") }
+ java { srcDir("../gale-server/src/main/java") } // Leaf - project setup
+ resources { srcDir("../gale-server/src/main/resources") } // Leaf - project setup
}
test {
java { srcDir("../paper-server/src/test/java") }
resources { srcDir("../paper-server/src/test/resources") }
+ java { srcDir("../gale-server/src/test/java") } // Leaf - project setup
+ resources { srcDir("../gale-server/src/test/resources") } // Leaf - project setup
@@ -104,7 +_,22 @@
}
}
@@ -147,10 +_,20 @@
-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())
}
@@ -122,10 +_,20 @@
}
dependencies {
- implementation(project(":gale-api")) // Gale - project setup - Depend on own API
+ implementation(project(":leaf-api")) // Gale - project setup - Depend on own API // Leaf - project setup
- 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
@@ -92,7 +89,7 @@
implementation("net.minecrell:terminalconsoleappender:1.3.0")
implementation("net.kyori:adventure-text-serializer-ansi:4.18.0") // Keep in sync with adventureVersion from Paper-API build file
@@ -160,36 +_,53 @@
@@ -135,36 +_,55 @@
all its classes to check if they are plugins.
Scanning takes about 1-2 seconds so adding this speeds up the server start.
*/
@@ -157,7 +154,9 @@
+ testImplementation("org.junit.platform:junit-platform-suite-engine:1.12.1")
+ 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
+ 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.7.1")
- testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // CartesianTest
+ testImplementation("org.junit-pioneer:junit-pioneer:2.3.0") // CartesianTest
@@ -165,32 +164,123 @@
implementation("net.neoforged:srgutils:1.0.9") // Mappings handling
implementation("net.neoforged:AutoRenamingTool:2.0.3") // Remap plugins
@@ -203,6 +_,8 @@
@@ -178,28 +_,40 @@
// Spark
implementation("me.lucko:spark-api:0.1-20240720.200737-2")
implementation("me.lucko:spark-paper:1.10.119-20241121.092015-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<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
// Gale start - hide irrelevant compilation warnings
@@ -227,14 +_,14 @@
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 "Gale", // Gale - branding changes
+ "Implementation-Title" to "Leaf", // Gale - branding changes // Leaf - Rebrand
- "Implementation-Title" to "Paper",
+ "Implementation-Title" to "Leaf", // Leaf - Rebrand
"Implementation-Version" to implementationVersion,
"Implementation-Vendor" to date,
- "Specification-Title" to "Gale", // Gale - branding changes
+ "Specification-Title" to "Leaf", // Gale - branding changes // Leaf - Rebrand
- "Specification-Title" to "Paper",
+ "Specification-Title" to "Leaf", // Leaf - Rebrand
"Specification-Version" to project.version,
- "Specification-Vendor" to "GaleMC Team", // Gale - branding changes
- "Brand-Id" to "galemc:gale", // Gale - branding changes
- "Brand-Name" to "Gale", // Gale - branding changes
+ "Specification-Vendor" to "Winds Studio", // Gale - branding changes // Leaf - Rebrand
+ "Brand-Id" to "winds-studio:leaf", // Gale - branding changes // Leaf - Rebrand
+ "Brand-Name" to "Leaf", // Gale - branding changes // Leaf - Rebrand
- "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,
@@ -285,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()
@@ -330,3 +_,62 @@
classpath(tasks.createReobfPaperclipJar.flatMap { it.outputZip })
mainClass.set(null as String?)
}
+
+// 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

View File

@@ -12,7 +12,7 @@ plugins {
}
if (!file(".git").exists()) {
// Gale start - build changes
// Leaf start - project setup
val errorText = """
=====================[ ERROR ]=====================
@@ -29,7 +29,7 @@ if (!file(".git").exists()) {
for further information on building and modifying Paper forks.
===================================================
""".trimIndent()
// Gale end - build changes
// Leaf end - project setup
error(errorText)
}