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://repo.maven.apache.org/maven2/",
"https://libraries.minecraft.net/", "https://libraries.minecraft.net/",
"https://papermc.io/repo/repository/maven-public/", "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. 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 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 new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000

View file

@ -21,14 +21,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
implementation("com.googlecode.json-simple:json-simple:1.1.1") { implementation("com.googlecode.json-simple:json-simple:1.1.1") {
// This includes junit transitively for whatever reason // This includes junit transitively for whatever reason
isTransitive = false 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 { @@ -0,0 +0,0 @@ relocation {
} }
} }
@ -36,9 +28,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+val generatePom = tasks.named<GenerateMavenPom>("generatePomFileForMavenPublication") +val generatePom = tasks.named<GenerateMavenPom>("generatePomFileForMavenPublication")
+ +
tasks.shadowJar { tasks.shadowJar {
configurations = listOf(project.configurations.vanillaServer.get())
archiveClassifier.set("mojang-mapped") 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) { + from(generatePom) {
+ into("META-INF/maven/io.papermc.paper/paper") + into("META-INF/maven/io.papermc.paper/paper")
+ rename { "pom.xml" } + rename { "pom.xml" }

View file

@ -10,11 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -0,0 +0,0 @@ @@ -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.tasks.BaseTask
import io.papermc.paperweight.util.* 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.nio.file.Files
import java.util.Locale import java.util.Locale
@ -31,6 +28,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
dependencies { 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 { @@ -0,0 +0,0 @@ dependencies {
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0") runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0")
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http: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("junit:junit:4.13.1")
testImplementation("org.hamcrest:hamcrest-library:1.3") 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 { @@ -0,0 +0,0 @@ tasks.shadowJar {
transform(ModifiedLog4j2PluginsCacheFileTransformer::class.java) }
} }
+// Paper start - include reobf mappings in jar for stacktrace deobfuscation +// Paper start - include reobf mappings in jar for stacktrace deobfuscation

View file

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