Update server build file

This commit is contained in:
Jason Penilla 2021-11-24 13:27:16 -08:00 committed by MiniDigger | Martin
parent 6ccc23f457
commit 35aeb0ddeb
10 changed files with 42 additions and 66 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

@ -28,14 +28,11 @@ index 67fb370cad6924895a6b27052dbd5c1767e3f0c9..bb338269c9e3bef4c274157c490d8b8f
+/.factorypath +/.factorypath
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..a19e05379d81e6f0bb0a78bc734a1cfdd355dc74 index 0000000000000000000000000000000000000000..9778c18a2822b00d48134583de87ea281623427d
--- /dev/null --- /dev/null
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -0,0 +1,153 @@ @@ -0,0 +1,150 @@
+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..a19e05379d81e6f0bb0a78bc734a1cfd
+} +}
+ +
+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..a19e05379d81e6f0bb0a78bc734a1cfd
+ } + }
+ } + }
+ } + }
+ mergeServiceFiles()
+ transform(ModifiedLog4j2PluginsCacheFileTransformer::class.java)
+} +}
+ +
+tasks.test { +tasks.test {
@ -134,6 +130,7 @@ index 0000000000000000000000000000000000000000..a19e05379d81e6f0bb0a78bc734a1cfd
+ 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..a19e05379d81e6f0bb0a78bc734a1cfd
+ 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

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Build system changes
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 273746fe476a9a09ebca01c6ecd814b70fe1b4c2..6cab6b2f348366e7e0357638ac11df5961a7388d 100644 index 9778c18a2822b00d48134583de87ea281623427d..19d4a798427de2c78b62a92246d47607a050a11d 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -17,10 +17,9 @@ repositories { @@ -14,10 +14,9 @@ repositories {
dependencies { dependencies {
implementation(project(":Paper-API")) implementation(project(":Paper-API"))
implementation("jline:jline:2.12.1") implementation("jline:jline:2.12.1")
@ -21,24 +21,17 @@ index 273746fe476a9a09ebca01c6ecd814b70fe1b4c2..6cab6b2f348366e7e0357638ac11df59
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
@@ -52,6 +51,7 @@ tasks.jar { @@ -74,10 +73,18 @@ relocation {
"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)
@@ -77,9 +77,17 @@ relocation {
} }
} }
+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

@ -19,10 +19,10 @@ Other changes:
configuration configuration
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 6cab6b2f348366e7e0357638ac11df5961a7388d..ff067710300454ed284d38a75cd6b3e5f04cf794 100644 index 19d4a798427de2c78b62a92246d47607a050a11d..c8f39fae4527c4ff3256c687f3defbff7f87a68c 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -16,7 +16,17 @@ repositories { @@ -13,7 +13,17 @@ repositories {
dependencies { dependencies {
implementation(project(":Paper-API")) implementation(project(":Paper-API"))

View File

@ -15,10 +15,10 @@ This may cause additional prefixes to be disabled for plugins bypassing
the plugin logger. the plugin logger.
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index ff067710300454ed284d38a75cd6b3e5f04cf794..ef5af1965d54e9ba9ff84d4f22ae77e4ccfa461c 100644 index c8f39fae4527c4ff3256c687f3defbff7f87a68c..1c14144551f07cc61b6dbb2b70498b399442cebd 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -25,7 +25,7 @@ dependencies { @@ -22,7 +22,7 @@ dependencies {
all its classes to check if they are plugins. all its classes to check if they are plugins.
Scanning takes about 1-2 seconds so adding this speeds up the server start. Scanning takes about 1-2 seconds so adding this speeds up the server start.
*/ */

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Use AsyncAppender to keep logging IO off main thread
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index ef5af1965d54e9ba9ff84d4f22ae77e4ccfa461c..80849d9b582916be238ba8c8e79de5832eff3c9a 100644 index 1c14144551f07cc61b6dbb2b70498b399442cebd..a2cef2a6f04ba58ba49ac08c9e22cf8003216c39 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -36,6 +36,7 @@ dependencies { @@ -33,6 +33,7 @@ dependencies {
} }
runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3") runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3")
runtimeOnly("mysql:mysql-connector-java:8.0.27") runtimeOnly("mysql:mysql-connector-java:8.0.27")

View File

@ -10,10 +10,10 @@ Adds CommandRegisteredEvent
- Allows manipulating the CommandNode to add more children/metadata for the client - Allows manipulating the CommandNode to add more children/metadata for the client
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 7fc074f63d1c3b3cf09bb5f95fd7bc5c0968a5de..44f5a30a16f3d5604cd99bb39c8d744bb607d923 100644 index a2cef2a6f04ba58ba49ac08c9e22cf8003216c39..caf8a5d3797883b4dad64a9da6b566c92cf1c506 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -16,6 +16,7 @@ repositories { @@ -13,6 +13,7 @@ repositories {
dependencies { dependencies {
implementation(project(":Paper-API")) implementation(project(":Paper-API"))

View File

@ -6,20 +6,17 @@ Subject: [PATCH] Deobfuscate stacktraces in log messages, crash reports, and
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 44f5a30a16f3d5604cd99bb39c8d744bb607d923..8f65d5d3a5fa58394b0e398bed80044aec3fcc7c 100644 index caf8a5d3797883b4dad64a9da6b566c92cf1c506..99ab6194dbcea67875c6cdf3f29bb41fff4a39b9 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -1,7 +1,9 @@ @@ -1,4 +1,6 @@
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
plugins { plugins {
@@ -12,6 +14,11 @@ plugins { @@ -9,6 +11,11 @@ plugins {
repositories { repositories {
maven("https://libraries.minecraft.net/") maven("https://libraries.minecraft.net/")
@ -31,7 +28,15 @@ index 44f5a30a16f3d5604cd99bb39c8d744bb607d923..8f65d5d3a5fa58394b0e398bed80044a
} }
dependencies { dependencies {
@@ -43,6 +50,8 @@ dependencies { @@ -24,6 +31,7 @@ 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")
@@ -40,6 +48,8 @@ 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 44f5a30a16f3d5604cd99bb39c8d744bb607d923..8f65d5d3a5fa58394b0e398bed80044a
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")
} }
@@ -87,6 +96,7 @@ relocation { @@ -106,6 +116,45 @@ tasks.shadowJar {
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")
@@ -111,6 +121,45 @@ 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

@ -5,10 +5,10 @@ Subject: [PATCH] Implement Mob Goal API
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 8f65d5d3a5fa58394b0e398bed80044aec3fcc7c..eaeed610e3f1a622b2ece220d595fbca9c750d20 100644 index 99ab6194dbcea67875c6cdf3f29bb41fff4a39b9..4bf4127bb8845499a1a629e03b0c767f0eb43461 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -52,6 +52,7 @@ dependencies { @@ -50,6 +50,7 @@ dependencies {
implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation

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 eaeed610e3f1a622b2ece220d595fbca9c750d20..5e1b87f84ab78952291c16ef468b83c9c5f21112 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -34,6 +34,7 @@ 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..a4315961b7a465fb4872a4d67e7c26d4b4ed1fb9 index 0000000000000000000000000000000000000000..a4315961b7a465fb4872a4d67e7c26d4b4ed1fb9