Update server build file

This commit is contained in:
Jason Penilla 2021-11-24 13:27:16 -08:00
parent 416ee76329
commit 0a667a7552
5 changed files with 23 additions and 47 deletions

View file

@ -87,6 +87,7 @@ tasks.generateDevelopmentBundle {
"https://repo.maven.apache.org/maven2/",
"https://libraries.minecraft.net/",
"https://papermc.io/repo/repository/maven-public/",
"https://maven.fabricmc.net/",
)
}

View file

@ -5,18 +5,6 @@ Subject: [PATCH] Add support for hex color codes in console
Converts upstream's hex color code legacy format into actual hex color codes in the console.
diff --git a/build.gradle.kts b/build.gradle.kts
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -0,0 +0,0 @@ dependencies {
Scanning takes about 1-2 seconds so adding this speeds up the server start.
*/
implementation("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - implementation
+ annotationProcessor("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - Needed to generate meta for out hex color converter plugin
// Paper end
implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper
implementation("org.ow2.asm:asm:9.2")
diff --git a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000

View file

@ -21,14 +21,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
implementation("com.googlecode.json-simple:json-simple:1.1.1") {
// This includes junit transitively for whatever reason
isTransitive = false
@@ -0,0 +0,0 @@ tasks.jar {
"Specification-Title" to "Bukkit",
"Specification-Version" to project.version,
"Specification-Vendor" to "Bukkit Team",
+ "Multi-Release" to "true", // Paper
)
for (tld in setOf("net", "com", "org")) {
attributes("$tld/bukkit", "Sealed" to true)
@@ -0,0 +0,0 @@ relocation {
}
}
@ -36,9 +28,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+val generatePom = tasks.named<GenerateMavenPom>("generatePomFileForMavenPublication")
+
tasks.shadowJar {
configurations = listOf(project.configurations.vanillaServer.get())
archiveClassifier.set("mojang-mapped")
+ // Needed for Paperclip's install to maven local feature
+ // Needed for Paperclip's install to maven local feature // todo: are we keeping this? if so is this still correct?
+ from(generatePom) {
+ into("META-INF/maven/io.papermc.paper/paper")
+ rename { "pom.xml" }

View file

@ -10,11 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -0,0 +0,0 @@
import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer
import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer
+import io.papermc.paperweight.tasks.BaseTask
import io.papermc.paperweight.util.*
import shadow.org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor.PLUGIN_CACHE_FILE
+import java.nio.file.Files
import java.util.Locale
@ -31,6 +28,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
dependencies {
@@ -0,0 +0,0 @@ dependencies {
Scanning takes about 1-2 seconds so adding this speeds up the server start.
*/
implementation("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - implementation
+ annotationProcessor("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - Needed to generate meta for our Log4j plugins
// Paper end
implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper
implementation("org.ow2.asm:asm:9.2")
@@ -0,0 +0,0 @@ dependencies {
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0")
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.0")
@ -40,16 +45,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
testImplementation("junit:junit:4.13.1")
testImplementation("org.hamcrest:hamcrest-library:1.3")
}
@@ -0,0 +0,0 @@ relocation {
relocate("org.bukkit.craftbukkit" to "org.bukkit.craftbukkit.v$packageVersion") {
exclude("org.bukkit.craftbukkit.Main*")
}
+ relocate("net.fabricmc.mapping-io" to "io.papermc.dependency.mappingio") // Paper
}
val generatePom = tasks.named<GenerateMavenPom>("generatePomFileForMavenPublication")
@@ -0,0 +0,0 @@ tasks.shadowJar {
transform(ModifiedLog4j2PluginsCacheFileTransformer::class.java)
}
}
+// Paper start - include reobf mappings in jar for stacktrace deobfuscation

View file

@ -32,10 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +0,0 @@
+import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer
+import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer
+import io.papermc.paperweight.util.*
+import shadow.org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor.PLUGIN_CACHE_FILE
+import java.util.Locale
+
+plugins {
@ -112,6 +109,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+}
+
+tasks.shadowJar {
+ configurations = listOf(project.configurations.vanillaServer.get())
+ archiveClassifier.set("mojang-mapped")
+
+ for (relocation in relocation.relocations.get()) {
@ -121,8 +119,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+ }
+ mergeServiceFiles()
+ transform(ModifiedLog4j2PluginsCacheFileTransformer::class.java)
+}
+
+tasks.test {
@ -134,6 +130,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ block: JavaExec.() -> Unit
+): TaskProvider<JavaExec> = register<JavaExec>(name) {
+ group = "paper"
+ mainClass.set("org.bukkit.craftbukkit.Main")
+ standardInput = System.`in`
+ workingDir = rootProject.layout.projectDirectory
+ .dir(providers.gradleProperty("paper.runWorkDir").forUseAtConfigurationTime().getOrElse("run"))
@ -164,26 +161,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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("runShadow") {
+ description = "Spin up a test server from the shadowJar archiveFile"
+ classpath(tasks.shadowJar.flatMap { it.archiveFile })
+ classpath(runtimeClasspathWithoutVanillaServer)
+}
+
+tasks.registerRunTask("runReobf") {
+ description = "Spin up a test server from the reobfJar output jar"
+ classpath(tasks.reobfJar.flatMap { it.outputJar })
+ classpath(runtimeClasspathWithoutVanillaServer)
+}
+
+tasks.registerRunTask("runDev") {
+ description = "Spin up a non-shaded non-remapped test server"
+ classpath = java.sourceSets.main.get().runtimeClasspath
+ mainClass.set("org.bukkit.craftbukkit.Main")
+}
+
+class ModifiedLog4j2PluginsCacheFileTransformer : Transformer by Log4j2PluginsCacheFileTransformer() {
+ override fun canTransformResource(element: FileTreeElement): Boolean {
+ return PLUGIN_CACHE_FILE == element.name || element.name == "Log4j2Plugins.dat"
+ }
+ description = "Spin up a non-relocated Mojang-mapped test server"
+ classpath(sourceSets.main.map { it.runtimeClasspath })
+}
diff --git a/pom.xml b/pom.xml
deleted file mode 100644