forked from PaperMC/Paper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure mockito agent (PaperMC#11560)
- Loading branch information
1 parent
bcbd108
commit e47f79a
Showing
21 changed files
with
138 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]> | ||
Co-authored-by: Jake Potrebic <[email protected]> | ||
Co-authored-by: Yannick Lamprecht <[email protected]> | ||
|
||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,10 @@ Co-authored-by: Jake Potrebic <[email protected]> | |
Co-authored-by: Yannick Lamprecht <[email protected]> | ||
|
||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,18 +6,18 @@ Subject: [PATCH] Brigadier based command API | |
Co-authored-by: Jake Potrebic <[email protected]> | ||
|
||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,21 +3,44 @@ From: Jake Potrebic <[email protected]> | |
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 <[email protected]> | ||
|
||
diff --git a/build.gradle.kts b/build.gradle.kts | ||
index d4a5229b4df544ff60cdaee80c8ae301faf2a235..41b000aaa71dca3fb392ae657be16e05bd37a178 100644 | ||
index d4a5229b4df544ff60cdaee80c8ae301faf2a235..dac5e12f59723cdbd0d42a153c57d71ce185d0e8 100644 | ||
--- a/build.gradle.kts | ||
+++ b/build.gradle.kts | ||
@@ -23,6 +23,7 @@ dependencies { | ||
@@ -5,6 +5,18 @@ 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") | ||
@@ -22,7 +34,9 @@ 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 | ||
} | ||
|
||
paperweight { | ||
@@ -56,6 +57,12 @@ tasks.jar { | ||
@@ -56,6 +70,12 @@ tasks.jar { | ||
} | ||
} | ||
|
||
|
@@ -30,6 +53,18 @@ index d4a5229b4df544ff60cdaee80c8ae301faf2a235..41b000aaa71dca3fb392ae657be16e05 | |
publishing { | ||
publications.create<MavenPublication>("maven") { | ||
} | ||
@@ -79,6 +99,11 @@ 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..d8857a05858585113bc7efde3416748effb53d01 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,10 +25,10 @@ Other changes: | |
Co-Authored-By: Emilia Kond <[email protected]> | ||
|
||
diff --git a/build.gradle.kts b/build.gradle.kts | ||
index da6b4787fa787e098e4031790e955ce616593ee9..02a3dd42d82df410b6a6d22c0350fa3e44ccf70f 100644 | ||
index 220d2696bf40d1657c87d049f563ccfffed2e8ad..c808f36b30d0f8edb8365875039fd20b8c20007d 100644 | ||
--- a/build.gradle.kts | ||
+++ b/build.gradle.kts | ||
@@ -5,9 +5,29 @@ plugins { | ||
@@ -5,6 +5,12 @@ plugins { | ||
`maven-publish` | ||
} | ||
|
||
|
@@ -38,6 +38,11 @@ index da6b4787fa787e098e4031790e955ce616593ee9..02a3dd42d82df410b6a6d22c0350fa3e | |
+} | ||
+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 { | ||
@@ -19,7 +25,21 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider { | ||
|
||
dependencies { | ||
implementation(project(":paper-api")) | ||
- implementation("jline:jline:2.12.1") | ||
|
@@ -59,7 +64,7 @@ index da6b4787fa787e098e4031790e955ce616593ee9..02a3dd42d82df410b6a6d22c0350fa3e | |
implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion | ||
implementation("org.ow2.asm:asm-commons:9.7.1") | ||
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files | ||
@@ -79,6 +99,19 @@ tasks.check { | ||
@@ -92,6 +112,19 @@ tasks.check { | ||
dependsOn(scanJar) | ||
} | ||
// Paper end | ||
|
@@ -382,7 +387,7 @@ index 3d92c61f7781221cfdc0324d11bd0088954e4a68..84a2c6c397604279ba821286f5c3c855 | |
if (!SwingUtilities.isEventDispatchThread()) { | ||
SwingUtilities.invokeLater(() -> { | ||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java | ||
index a70e0ecedc7b70031334bc7fee981bd790ce26a4..56f046bac04205a813441907058c4ce21982d927 100644 | ||
index 1333daa8666fe2ec4033a2f57ba6b716fcdd5343..8daa027a94602d7d556cf4fbfc8fcd97caf6bd98 100644 | ||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java | ||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java | ||
@@ -162,8 +162,7 @@ public abstract class PlayerList { | ||
|
@@ -396,7 +401,7 @@ index a70e0ecedc7b70031334bc7fee981bd790ce26a4..56f046bac04205a813441907058c4ce2 | |
|
||
this.bans = new UserBanList(PlayerList.USERBANLIST_FILE); | ||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
index 16a9142bdbbfbbbb69d1486bd119dc610094484b..2affb23b83e4368a94345b36410f23139f5d36c8 100644 | ||
index c3fc8b1abe843a19347509947f4b864c1b417800..e497da2dba83779c4ad1c45cea133bddadf61446 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java | ||
@@ -43,7 +43,7 @@ import java.util.logging.Level; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.