Files
PlazmaBukkitMC/patches/server/0005-Cleanup-buildscripts.patch
AlphaKR93 15a9cac376 Updated Upstream (Paper, Purpur)
[Purpur Changes]
PlazmaMC/Purpur@ceeec1c: work
PlazmaMC/Purpur@e8f8f93: Updated Upstream (Paper, Pufferfish)

[Paper Changes]
PaperMC/Paper@f175193: Expose server build information (#10729)
PaperMC/Paper@d8d59e0: Fix NPE sending resource pack without prompt
PaperMC/Paper@5a9afbe: Fixes issues in the suppress dismount cancellation patch (#10735)
PaperMC/Paper@0ad09de: Make PaperSimplePluginClassLoader show class which is not found
PaperMC/Paper@b3b3406: fix CompassMeta not being correct (#10737)
PaperMC/Paper@591521e: Check for more correct profile validation (#10730)
PaperMC/Paper@7d2e5c3: Add an 'empty' RecipeChoice for certain ingredient slots (#10710)
PaperMC/Paper@9bf4855: Add a better warning message than "Server performance will be affected" for CommandRegisteredEvent use (#10754)
PaperMC/Paper@66cb880: Remove ThreadedWorldUpgrader patch
PaperMC/Paper@980cff9: Fix compile
PaperMC/Paper@d3ffa62: fix default item attributes
PaperMC/Paper@b149584: Always show command exception stack traces in logs (#10766)
PaperMC/Paper@a9201d4: [ci skip] Move logic in our patches to ItemType/BlockType (#10772)
PaperMC/Paper@3de408e: Fix equipment slot and group API (#10767)
PaperMC/Paper@d408381: Print CommandRegisteredEvent deprecation warnings again (#10756)
PaperMC/Paper@6de7a1f: Improve default item attributes API (#10765)
PaperMC/Paper@2a90732: Remove incorrect logic for Fireball#setVelocity (#10764)
PaperMC/Paper@5e7b65a: Allow using PluginLoader classpath API from Bukkit plugins (#10758)
PaperMC/Paper@3004717: Do not re-wrap vanilla goals (#10751)
PaperMC/Paper@377733d: Use getter/setter on Mob for equipment drop chances (#10780)
PaperMC/Paper@dff591d: Allow to define new map cursor types (#10782)
PaperMC/Paper@4fd3ac0: [ci skip] Update Player#getListeningPluginChannels Jdoc (#10778)
PaperMC/Paper@535dca5: Fix a few issues with ItemMeta (#10740)
PaperMC/Paper@26e90b9: Fix CraftMetaBlockState for data components (#10731)
PaperMC/Paper@f0bd0cc: Expose anvil cost in the API (#10682)
PaperMC/Paper@41bee55: Fix NPE for color-related metas
PaperMC/Paper@4e10fad: reset meta block state on BlockStateMeta#setBlockState
2024-05-26 23:21:05 +09:00

256 lines
12 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sun, 26 May 2024 23:18:01 +0900
Subject: [PATCH] Cleanup buildscripts
diff --git a/build.gradle.kts b/build.gradle.kts
index acca28dd3e99821e4f55794946ed27b7e8c780a5..b95eda82341edf50f74da6760b42c47a7365e320 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -43,85 +43,126 @@ paperweight {
craftBukkitPackageVersion.set("v1_20_R4") // also needs to be updated in MappingEnvironment
}
-// Pufferfish Start
-tasks.withType<JavaCompile> {
- val compilerArgs = options.compilerArgs
- compilerArgs.add("--add-modules=jdk.incubator.vector")
-}
-// Pufferfish End
-
-tasks.jar {
- archiveClassifier.set("dev")
-
- manifest {
- val git = Git(rootProject.layout.projectDirectory.path)
- val mcVersion = rootProject.providers.gradleProperty("mcVersion").get()
- val build = System.getenv("BUILD_NUMBER") ?: null
- val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
- val implementationVersion = "git-Pufferfish-$gitHash" // Pufferfish
- val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
- val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
- attributes(
- "Main-Class" to "org.bukkit.craftbukkit.Main",
- "Implementation-Title" to rootProject.providers.gradleProperty("brandName").get(), // Purpur // Plazma - Rebrand // Plazma - Fork-friendly Rebranding
- "Implementation-Version" to implementationVersion,
- "Implementation-Vendor" to date, // Paper
- "Specification-Title" to rootProject.providers.gradleProperty("brandName").get(), // Purpur // Plazma - Fork-friendly Rebranding
- "Specification-Version" to project.version,
- "Specification-Vendor" to rootProject.providers.gradleProperty("providerName").get(), // Purpur // Plazma - Fork-friendly Rebranding
- "Brand-Id" to rootProject.providers.gradleProperty("brandKey").get(), // Purpur // Plazma - Fork-friendly Rebranding
- "Brand-Name" to rootProject.providers.gradleProperty("brandName").get(), // Purpur // Plazma - Fork-friendly Rebranding
- "Build-Number" to (build ?: ""),
- "Build-Time" to Instant.now().toString(),
- "Git-Branch" to gitBranch, // Paper
- "Git-Commit" to gitHash, // Paper
- "CraftBukkit-Package-Version" to paperweight.craftBukkitPackageVersion.get(), // Paper
- )
- for (tld in setOf("net", "com", "org")) {
- attributes("$tld/bukkit", "Sealed" to true)
+// Plazma start - Cleanup buildscripts
+tasks {
+ // Pufferfish Start
+ withType<JavaCompile> {
+ val compilerArgs = options.compilerArgs
+ compilerArgs.add("--add-modules=jdk.incubator.vector")
+ }
+ // Pufferfish End
+
+ jar {
+ archiveClassifier.set("dev")
+
+ manifest {
+ val git = Git(rootProject.layout.projectDirectory.path)
+ val mcVersion = rootProject.providers.gradleProperty("mcVersion").get()
+ val build = System.getenv("BUILD_NUMBER") ?: null
+ val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
+ val implementationVersion = "git-Pufferfish-$gitHash" // Pufferfish
+ val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
+ val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
+ attributes(
+ "Main-Class" to "org.bukkit.craftbukkit.Main",
+ "Implementation-Title" to rootProject.providers.gradleProperty("brandName").get(), // Purpur // Plazma - Rebrand // Plazma - Fork-friendly Rebranding
+ "Implementation-Version" to implementationVersion,
+ "Implementation-Vendor" to date, // Paper
+ "Specification-Title" to rootProject.providers.gradleProperty("brandName").get(), // Purpur // Plazma - Fork-friendly Rebranding
+ "Specification-Version" to project.version,
+ "Specification-Vendor" to rootProject.providers.gradleProperty("providerName").get(), // Purpur // Plazma - Fork-friendly Rebranding
+ "Brand-Id" to rootProject.providers.gradleProperty("brandKey").get(), // Purpur // Plazma - Fork-friendly Rebranding
+ "Brand-Name" to rootProject.providers.gradleProperty("brandName").get(), // Purpur // Plazma - Fork-friendly Rebranding
+ "Build-Number" to (build ?: ""),
+ "Build-Time" to Instant.now().toString(),
+ "Git-Branch" to gitBranch, // Paper
+ "Git-Commit" to gitHash, // Paper
+ "CraftBukkit-Package-Version" to paperweight.craftBukkitPackageVersion.get(), // Paper
+ )
+ for (tld in setOf("net", "com", "org")) {
+ attributes("$tld/bukkit", "Sealed" to true)
+ }
}
}
-}
-
-// Paper start - compile tests with -parameters for better junit parameterized test names
-tasks.compileTestJava {
- options.compilerArgs.add("-parameters")
-}
-// Paper end
-publishing {
- publications.create<MavenPublication>("maven") {
+ // Paper start - compile tests with -parameters for better junit parameterized test names
+ compileTestJava {
+ options.compilerArgs.add("-parameters")
}
-}
+ // Paper end
-// Paper start
-val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
- badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
- jarToScan.set(tasks.serverJar.flatMap { it.archiveFile })
- classpath.from(configurations.compileClasspath)
-}
-tasks.check {
- dependsOn(scanJar)
-}
-// Paper end
-// Paper start - use TCA for console improvements
-tasks.serverJar {
- from(alsoShade.elements.map {
- it.map { f ->
- if (f.asFile.isFile) {
- zipTree(f.asFile)
- } else {
- f.asFile
+ // Paper start
+ val scanJar = register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
+ badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
+ jarToScan.set(serverJar.flatMap { it.archiveFile })
+ classpath.from(configurations.compileClasspath)
+ }
+ check {
+ dependsOn(scanJar)
+ }
+ // Paper end
+
+ // Paper start - use TCA for console improvements
+ serverJar {
+ from(alsoShade.elements.map {
+ it.map { f ->
+ if (f.asFile.isFile) {
+ zipTree(f.asFile)
+ } else {
+ f.asFile
+ }
}
+ })
+ }
+ // Paper end - use TCA for console improvements
+
+ test {
+ exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
+ useJUnitPlatform()
+ }
+
+ val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatMap { it.elements }
+ .zip(configurations.vanillaServer.map { it.singleFile.absolutePath }) { runtime, vanilla ->
+ runtime.filterNot { it.asFile.absolutePath == vanilla }
}
- })
-}
-// Paper end - use TCA for console improvements
-tasks.test {
- exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
- useJUnitPlatform()
+ registerRunTask("runServer") {
+ description = "Spin up a test server from the Mojang mapped server jar"
+ classpath(includeMappings.flatMap { it.outputJar })
+ classpath(runtimeClasspathWithoutVanillaServer)
+ }
+ registerRunTask("runReobfServer") {
+ description = "Spin up a test server from the reobfJar output jar"
+ classpath(reobfJar.flatMap { it.outputJar })
+ classpath(runtimeClasspathWithoutVanillaServer)
+ }
+ registerRunTask("runDevServer") {
+ description = "Spin up a test server without assembling a jar"
+ classpath(sourceSets.main.map { it.runtimeClasspath })
+ jvmArgs("-DPaper.pushPaperAssetsRoot=true")
+ }
+ registerRunTask("runBundler") {
+ description = "Spin up a test server from the Mojang mapped bundler jar"
+ classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createMojmapBundlerJar").flatMap { it.outputZip })
+ mainClass.set(null as String?)
+ }
+ registerRunTask("runReobfBundler") {
+ description = "Spin up a test server from the reobf bundler jar"
+ classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createReobfBundlerJar").flatMap { it.outputZip })
+ mainClass.set(null as String?)
+ }
+ registerRunTask("runPaperclip") {
+ description = "Spin up a test server from the Mojang mapped Paperclip jar"
+ classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreatePaperclipJar>("createMojmapPaperclipJar").flatMap { it.outputZip })
+ mainClass.set(null as String?)
+ }
+ registerRunTask("runReobfPaperclip") {
+ description = "Spin up a test server from the reobf Paperclip jar"
+ classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreatePaperclipJar>("createReobfPaperclipJar").flatMap { it.outputZip })
+ mainClass.set(null as String?)
+ }
}
+// Plazma end - Cleanup buildscripts
fun TaskContainer.registerRunTask(
name: String,
@@ -162,47 +203,3 @@ fun TaskContainer.registerRunTask(
block(this)
}
-
-val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatMap { it.elements }
- .zip(configurations.vanillaServer.map { it.singleFile.absolutePath }) { runtime, vanilla ->
- runtime.filterNot { it.asFile.absolutePath == vanilla }
- }
-
-tasks.registerRunTask("runServer") {
- description = "Spin up a test server from the Mojang mapped server jar"
- classpath(tasks.includeMappings.flatMap { it.outputJar })
- classpath(runtimeClasspathWithoutVanillaServer)
-}
-
-tasks.registerRunTask("runReobfServer") {
- description = "Spin up a test server from the reobfJar output jar"
- classpath(tasks.reobfJar.flatMap { it.outputJar })
- classpath(runtimeClasspathWithoutVanillaServer)
-}
-
-tasks.registerRunTask("runDevServer") {
- description = "Spin up a test server without assembling a jar"
- classpath(sourceSets.main.map { it.runtimeClasspath })
- jvmArgs("-DPaper.pushPaperAssetsRoot=true")
-}
-
-tasks.registerRunTask("runBundler") {
- description = "Spin up a test server from the Mojang mapped bundler jar"
- classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createMojmapBundlerJar").flatMap { it.outputZip })
- mainClass.set(null as String?)
-}
-tasks.registerRunTask("runReobfBundler") {
- description = "Spin up a test server from the reobf bundler jar"
- classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("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(rootProject.tasks.named<io.papermc.paperweight.tasks.CreatePaperclipJar>("createMojmapPaperclipJar").flatMap { it.outputZip })
- mainClass.set(null as String?)
-}
-tasks.registerRunTask("runReobfPaperclip") {
- description = "Spin up a test server from the reobf Paperclip jar"
- classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreatePaperclipJar>("createReobfPaperclipJar").flatMap { it.outputZip })
- mainClass.set(null as String?)
-}