9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-19 14:59:29 +00:00
Files
Gale/gale-server/build.gradle.kts.patch
2025-01-17 04:48:56 -05:00

171 lines
6.2 KiB
Diff

--- a/paper-server/build.gradle.kts
+++ b/paper-server/build.gradle.kts
@@ -21,6 +_,19 @@
// macheOldPath = file("F:\\Projects\\PaperTooling\\mache\\versions\\1.21.4\\src\\main\\java")
// gitFilePatches = true
+ // Gale start - project setup
+ val gale = forks.register("gale") {
+ upstream.patchDir("paperServer") {
+ upstreamPath = "paper-server"
+ excludes = setOf("src/minecraft", "patches", "build.gradle.kts")
+ patchesDir = rootDirectory.dir("gale-server/paper-patches")
+ outputDir = rootDirectory.dir("paper-server")
+ }
+ }
+
+ activeFork = gale
+ // Gale end - project setup
+
spigot {
buildDataRef = "3edaf46ec1eed4115ce1b18d2846cded42577e42"
packageVersion = "v1_21_R3" // also needs to be updated in MappingEnvironment
@@ -101,7 +_,22 @@
}
}
-val log4jPlugins = sourceSets.create("log4jPlugins")
+// Gale 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") }
+}
+// Gale end - project setup
configurations.named(log4jPlugins.compileClasspathConfigurationName) {
extendsFrom(configurations.compileClasspath.get())
}
@@ -119,7 +_,7 @@
}
dependencies {
- implementation(project(":paper-api"))
+ implementation(project(":gale-api")) // Gale - project setup - Depend on own API
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
@@ -176,26 +_,36 @@
implementation("me.lucko:spark-paper:1.10.119-SNAPSHOT")
}
+// 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() // Gale - branding changes - we don't have ci yet
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 "Gale", // Gale - branding changes
"Implementation-Version" to implementationVersion,
"Implementation-Vendor" to date,
- "Specification-Title" to "Paper",
+ "Specification-Title" to "Gale", // Gale - branding changes
"Specification-Version" to project.version,
- "Specification-Vendor" to "Paper Team",
- "Brand-Id" to "papermc:paper",
- "Brand-Name" to "Paper",
+ "Specification-Vendor" to "GaleMC Team", // Gale - branding changes
+ "Brand-Id" to "galemc:gale", // Gale - branding changes
+ "Brand-Name" to "Gale", // Gale - branding changes
"Build-Number" to (build ?: ""),
"Build-Time" to buildTime.toString(),
"Git-Branch" to gitBranch,
@@ -281,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()
@@ -326,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