mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Configure mockito agent (#11560)
This commit is contained in:
parent
f58c7cc474
commit
17f433aa38
7 changed files with 84 additions and 6 deletions
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <rileysebastianpark@gmail.com>
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Co-authored-by: Yannick Lamprecht <yannicklamprecht@live.de>
|
||||
|
||||
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<String> {
|
||||
+ 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<PublishingExtension> {
|
||||
@@ -0,0 +0,0 @@ tasks.withType<Javadoc> {
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
+ // Paper start - configure mockito agent that is needed in newer java versions
|
||||
+ val provider = objects.newInstance<MockitoAgentProvider>()
|
||||
+ 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -3,15 +3,38 @@ From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|||
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 <yannicklamprecht@live.de>
|
||||
|
||||
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<String> {
|
||||
+ 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<MavenPublication>("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<MockitoAgentProvider>()
|
||||
+ 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
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue