diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index 387f52ac71..96f1455d5c 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -28,7 +28,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + extendsFrom(apiAndDocs) +} - dependencies { + // Paper start - configure mockito agent that is needed in newer java versions + val mockitoAgent = configurations.register("mockitoAgent") +@@ -0,0 +0,0 @@ dependencies { // api dependencies are listed transitively to API consumers api("com.google.guava:guava:32.1.2-jre") api("com.google.code.gson:gson:2.10.1") diff --git a/patches/api/Brigadier-based-command-API.patch b/patches/api/Brigadier-based-command-API.patch index 03bbf79624..05d760904b 100644 --- a/patches/api/Brigadier-based-command-API.patch +++ b/patches/api/Brigadier-based-command-API.patch @@ -9,8 +9,8 @@ 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 @@ configurations.api { - } +@@ -0,0 +0,0 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider { + // Paper end - configure mockito agent that is needed in newer java versions dependencies { + api("com.mojang:brigadier:1.2.9") // Paper - Brigadier command api diff --git a/patches/api/Code-Generation.patch b/patches/api/Code-Generation.patch index 4859bcd0af..230ac5df18 100644 --- a/patches/api/Code-Generation.patch +++ b/patches/api/Code-Generation.patch @@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 java { @@ -0,0 +0,0 @@ dependencies { - testImplementation("org.ow2.asm:asm-tree:9.7.1") + mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Paper - configure mockito agent that is needed in newer java versions } +// Paper start diff --git a/patches/api/Test-changes.patch b/patches/api/Test-changes.patch index dabbf967f7..17a90c5127 100644 --- a/patches/api/Test-changes.patch +++ b/patches/api/Test-changes.patch @@ -7,16 +7,52 @@ Subject: [PATCH] Test changes - Ignore package-private methods for nullability annotations - Add excludes for classes which don't pass - Disable stupid BukkitMirrorTest +- configure mockito agent to address changes in newer java versions see https://openjdk.org/jeps/451 Co-authored-by: Riley Park Co-authored-by: Jake Potrebic +Co-authored-by: Yannick Lamprecht 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 @@ tasks.test { +@@ -0,0 +0,0 @@ java { + val annotationsVersion = "24.1.0" + val bungeeCordChatVersion = "1.20-R0.2" + ++// Paper start - configure mockito agent that is needed in newer java versions ++val mockitoAgent = configurations.register("mockitoAgent") ++abstract class MockitoAgentProvider : CommandLineArgumentProvider { ++ @get:CompileClasspath ++ abstract val fileCollection: ConfigurableFileCollection ++ ++ override fun asArguments(): Iterable { ++ return listOf("-javaagent:" + fileCollection.files.single().absolutePath) ++ } ++} ++// Paper end - configure mockito agent that is needed in newer java versions ++ + dependencies { + // api dependencies are listed transitively to API consumers + api("com.google.guava:guava:32.1.2-jre") +@@ -0,0 +0,0 @@ dependencies { + testImplementation("org.hamcrest:hamcrest:2.2") + testImplementation("org.mockito:mockito-core:5.14.1") + testImplementation("org.ow2.asm:asm-tree:9.7.1") ++ mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Paper - configure mockito agent that is needed in newer java versions + } + + configure { +@@ -0,0 +0,0 @@ tasks.withType { + + tasks.test { useJUnitPlatform() ++ // Paper start - configure mockito agent that is needed in newer java versions ++ val provider = objects.newInstance() ++ provider.fileCollection.from(mockitoAgent) ++ jvmArgumentProviders.add(provider) ++ // Paper end - configure mockito agent that is needed in newer java versions } +// Paper start - compile tests with -parameters for better junit parameterized test names diff --git a/patches/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch b/patches/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch index d9dd354823..2873abb2a6 100644 --- a/patches/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch +++ b/patches/server/Deobfuscate-stacktraces-in-log-messages-crash-report.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -0,0 +0,0 @@ dependencies { - testImplementation("org.mockito:mockito-core:5.14.1") + mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Paper - configure mockito agent that is needed in newer java versions testImplementation("org.ow2.asm:asm-tree:9.7.1") testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest + implementation("net.neoforged:srgutils:1.0.9") // Paper - mappings handling diff --git a/patches/server/Test-changes.patch b/patches/server/Test-changes.patch index f939f82730..95ee831fe0 100644 --- a/patches/server/Test-changes.patch +++ b/patches/server/Test-changes.patch @@ -3,15 +3,38 @@ From: Jake Potrebic Date: Mon, 13 Feb 2023 14:14:56 -0800 Subject: [PATCH] Test changes +- configure mockito agent to address changes in newer java versions see https://openjdk.org/jeps/451 + Co-authored-by: yannnicklamprecht 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 @@ plugins { + `maven-publish` + } + ++// Paper start - configure mockito agent that is needed in newer java versions ++val mockitoAgent = configurations.register("mockitoAgent") ++abstract class MockitoAgentProvider : CommandLineArgumentProvider { ++ @get:CompileClasspath ++ abstract val fileCollection: ConfigurableFileCollection ++ ++ override fun asArguments(): Iterable { ++ return listOf("-javaagent:" + fileCollection.files.single().absolutePath) ++ } ++} ++// Paper end - configure mockito agent that is needed in newer java versions ++ + dependencies { + implementation(project(":paper-api")) + implementation("jline:jline:2.12.1") @@ -0,0 +0,0 @@ dependencies { + testImplementation("org.junit.platform:junit-platform-suite-engine:1.10.0") testImplementation("org.hamcrest:hamcrest:2.2") testImplementation("org.mockito:mockito-core:5.14.1") ++ mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Paper - configure mockito agent that is needed in newer java versions testImplementation("org.ow2.asm:asm-tree:9.7.1") + testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest } @@ -30,6 +53,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 publishing { publications.create("maven") { } +@@ -0,0 +0,0 @@ tasks.test { + forkEvery = 1 + excludeTags("Slow") + } ++ // Paper start - configure mockito agent that is needed in newer java versions ++ val provider = objects.newInstance() ++ provider.fileCollection.from(mockitoAgent) ++ jvmArgumentProviders.add(provider) ++ // Paper end - configure mockito agent that is needed in newer java versions + } + + fun TaskContainer.registerRunTask( diff --git a/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java b/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 diff --git a/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch index 7e023950fb..72f7e7bef2 100644 --- a/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/Use-TerminalConsoleAppender-for-console-improvements.patch @@ -38,6 +38,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +} +val alsoShade: Configuration by configurations.creating + + // Paper start - configure mockito agent that is needed in newer java versions + val mockitoAgent = configurations.register("mockitoAgent") + abstract class MockitoAgentProvider : CommandLineArgumentProvider { +@@ -0,0 +0,0 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider { + dependencies { implementation(project(":paper-api")) - implementation("jline:jline:2.12.1")