Configure mockito agent (#11560)

This commit is contained in:
Yannick Lamprecht 2024-11-09 22:49:07 +01:00 committed by GitHub
parent bcbd10804f
commit e47f79acd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 138 additions and 60 deletions

View file

@ -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 0b837b485bec96fa37ed65c18df97e55cecd0e9d..c8a8903d1b0c9822743549ecb8e4fdc7d0fd07c1 100644
index 0b837b485bec96fa37ed65c18df97e55cecd0e9d..c7f660d52e1b5f085919a8aebf8476918705a391 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -107,6 +107,12 @@ tasks.test {
@@ -11,6 +11,18 @@ 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")
@@ -44,6 +56,7 @@ 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> {
@@ -105,8 +118,19 @@ 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

View file

@ -7,7 +7,7 @@ Currently includes generated key holder classes for types
used in the Registry Modification API
diff --git a/build.gradle.kts b/build.gradle.kts
index c8a8903d1b0c9822743549ecb8e4fdc7d0fd07c1..032f8b762b552e8cae20bbdd75c1e0844e64386a 100644
index c7f660d52e1b5f085919a8aebf8476918705a391..89208fed89181f890bb7a2bb237ed744ec2aea96 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,6 +1,7 @@
@ -18,8 +18,8 @@ index c8a8903d1b0c9822743549ecb8e4fdc7d0fd07c1..032f8b762b552e8cae20bbdd75c1e084
}
java {
@@ -46,6 +47,22 @@ dependencies {
testImplementation("org.ow2.asm:asm-tree:9.7.1")
@@ -59,6 +60,22 @@ dependencies {
mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Paper - configure mockito agent that is needed in newer java versions
}
+// Paper start
@ -41,7 +41,7 @@ index c8a8903d1b0c9822743549ecb8e4fdc7d0fd07c1..032f8b762b552e8cae20bbdd75c1e084
configure<PublishingExtension> {
publications.create<MavenPublication>("maven") {
from(components["java"])
@@ -123,3 +140,14 @@ tasks.check {
@@ -141,3 +158,14 @@ tasks.check {
dependsOn(scanJar)
}
// Paper end

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add FastUtil to Bukkit
Doesn't expose to plugins, just allows Paper-API to use it for optimization
diff --git a/build.gradle.kts b/build.gradle.kts
index 032f8b762b552e8cae20bbdd75c1e0844e64386a..4b6c5d1ae45d93d88adb7035eb19935361c06178 100644
index 89208fed89181f890bb7a2bb237ed744ec2aea96..1a80f7c7e7f4ae9857b732897dc2ee7cfc187626 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -23,6 +23,7 @@ dependencies {
@@ -35,6 +35,7 @@ dependencies {
api("com.googlecode.json-simple:json-simple:1.1.1") {
isTransitive = false // includes junit
}

View file

@ -8,10 +8,10 @@ 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 4b6c5d1ae45d93d88adb7035eb19935361c06178..cce9caa52c9a2208acccbd25fa88c0de066f23a4 100644
index 1a80f7c7e7f4ae9857b732897dc2ee7cfc187626..f57827e724bff2bf586b468cc4e5ba6a1901bd57 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -11,12 +11,28 @@ java {
@@ -11,6 +11,18 @@ java {
val annotationsVersion = "24.1.0"
val bungeeCordChatVersion = "1.20-R0.2"
@ -28,7 +28,9 @@ index 4b6c5d1ae45d93d88adb7035eb19935361c06178..cce9caa52c9a2208acccbd25fa88c0de
+ extendsFrom(apiAndDocs)
+}
dependencies {
// Paper start - configure mockito agent that is needed in newer java versions
val mockitoAgent = configurations.register("mockitoAgent")
@@ -28,7 +40,11 @@ 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")
@ -41,7 +43,7 @@ index 4b6c5d1ae45d93d88adb7035eb19935361c06178..cce9caa52c9a2208acccbd25fa88c0de
api("org.yaml:snakeyaml:2.2")
api("org.joml:joml:1.10.5")
// Paper start
@@ -24,6 +40,13 @@ dependencies {
@@ -36,6 +52,13 @@ dependencies {
isTransitive = false // includes junit
}
api("it.unimi.dsi:fastutil:8.5.6")
@ -55,7 +57,7 @@ index 4b6c5d1ae45d93d88adb7035eb19935361c06178..cce9caa52c9a2208acccbd25fa88c0de
// Paper end
compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")
@@ -100,15 +123,32 @@ tasks.withType<Javadoc> {
@@ -113,15 +136,32 @@ tasks.withType<Javadoc> {
"https://guava.dev/releases/32.1.2-jre/api/docs/",
"https://javadoc.io/doc/org.yaml/snakeyaml/2.2/",
"https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", // Paper - we don't want Java 5 annotations

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Use ASM for event executors.
Uses method handles for private or static methods.
diff --git a/build.gradle.kts b/build.gradle.kts
index cce9caa52c9a2208acccbd25fa88c0de066f23a4..2b1d08d8e16037f6d17c74ea613eaa2ca36c664e 100644
index f57827e724bff2bf586b468cc4e5ba6a1901bd57..783513d3c7ea143997f2eb1a1b53826e51a51079 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -47,6 +47,9 @@ dependencies {
@@ -59,6 +59,9 @@ dependencies {
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
apiAndDocs("net.kyori:adventure-text-serializer-plain")
apiAndDocs("net.kyori:adventure-text-logger-slf4j")

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Paper Plugins
diff --git a/build.gradle.kts b/build.gradle.kts
index 2b1d08d8e16037f6d17c74ea613eaa2ca36c664e..940fb51c1f3054465f305e98b13aac49c77e3a91 100644
index 783513d3c7ea143997f2eb1a1b53826e51a51079..5ee8db3fcf3d3ac1c8b998b227aff0965960896a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -52,7 +52,7 @@ dependencies {
@@ -64,7 +64,7 @@ dependencies {
implementation("org.ow2.asm:asm-commons:9.7.1")
// Paper end
@ -17,7 +17,7 @@ index 2b1d08d8e16037f6d17c74ea613eaa2ca36c664e..940fb51c1f3054465f305e98b13aac49
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
@@ -141,6 +141,7 @@ tasks.withType<Javadoc> {
@@ -154,6 +154,7 @@ tasks.withType<Javadoc> {
"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",
// Paper end

View file

@ -14,7 +14,7 @@ it without having to shade it in the plugin and going through
several layers of logging abstraction.
diff --git a/build.gradle.kts b/build.gradle.kts
index 940fb51c1f3054465f305e98b13aac49c77e3a91..6c8464d9e862b1b4dbf7a77e25446aa870803dae 100644
index 5ee8db3fcf3d3ac1c8b998b227aff0965960896a..a65956b1fc2f4f1b1edf355682b5b54541ec9bce 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -12,6 +12,8 @@ java {
@ -26,7 +26,7 @@ index 940fb51c1f3054465f305e98b13aac49c77e3a91..6c8464d9e862b1b4dbf7a77e25446aa8
val apiAndDocs: Configuration by configurations.creating {
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
@@ -47,6 +49,8 @@ dependencies {
@@ -59,6 +61,8 @@ dependencies {
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
apiAndDocs("net.kyori:adventure-text-serializer-plain")
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
@ -35,7 +35,7 @@ index 940fb51c1f3054465f305e98b13aac49c77e3a91..6c8464d9e862b1b4dbf7a77e25446aa8
implementation("org.ow2.asm:asm:9.7.1")
implementation("org.ow2.asm:asm-commons:9.7.1")
@@ -140,6 +144,8 @@ tasks.withType<Javadoc> {
@@ -153,6 +157,8 @@ tasks.withType<Javadoc> {
"https://jd.advntr.dev/text-serializer-legacy/$adventureVersion/",
"https://jd.advntr.dev/text-serializer-plain/$adventureVersion/",
"https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/",

View file

@ -6,18 +6,18 @@ Subject: [PATCH] Brigadier based command API
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/build.gradle.kts b/build.gradle.kts
index 6c8464d9e862b1b4dbf7a77e25446aa870803dae..254fd96d3950b4494c7e43547b00b5175ee53c93 100644
index a65956b1fc2f4f1b1edf355682b5b54541ec9bce..e29e5024fa693baae469d47fe77b57118f14627c 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -27,6 +27,7 @@ configurations.api {
}
@@ -39,6 +39,7 @@ 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
// 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")
@@ -93,9 +94,33 @@ sourceSets {
@@ -106,9 +107,33 @@ sourceSets {
}
}
// Paper end