1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-01-30 19:40:37 +01:00

[ci skip] Scan built jars for bad method usages ()

This commit is contained in:
Jason Penilla 2022-06-27 15:41:59 -07:00
parent c75561a354
commit 03335ed6fe
4 changed files with 68 additions and 2 deletions

View file

@ -25,3 +25,12 @@ configure<PublishingExtension> {
from(components["java"])
}
}
val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
jarToScan.set(tasks.jar.flatMap { it.archiveFile })
classpath.from(configurations.compileClasspath)
}
tasks.check {
dependsOn(scanJar)
}

View file

@ -46,3 +46,42 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
"https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/",
)
@@ -0,0 +0,0 @@ tasks.withType<Javadoc> {
}
}
}
+
+// Paper start
+val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
+ badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
+ jarToScan.set(tasks.jar.flatMap { it.archiveFile })
+ classpath.from(configurations.compileClasspath)
+}
+tasks.check {
+ dependsOn(scanJar)
+}
+// Paper end
diff --git a/src/main/java/io/papermc/paper/annotation/DoNotUse.java b/src/main/java/io/papermc/paper/annotation/DoNotUse.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/io/papermc/paper/annotation/DoNotUse.java
@@ -0,0 +0,0 @@
+package io.papermc.paper.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Annotation used to mark methods or constructors which should not be called.
+ *
+ * <p>Separate from {@link Deprecated} to differentiate from the large amount of deprecations.</p>
+ */
+@ApiStatus.Internal
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+public @interface DoNotUse {
+}

View file

@ -48,6 +48,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
)
for (tld in setOf("net", "com", "org")) {
attributes("$tld/bukkit", "Sealed" to true)
@@ -0,0 +0,0 @@ tasks.shadowJar {
}
}
+// Paper start
+val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
+ badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
+ jarToScan.set(tasks.shadowJar.flatMap { it.archiveFile })
+ classpath.from(configurations.compileClasspath)
+}
+tasks.check {
+ dependsOn(scanJar)
+}
+// Paper end
+
tasks.test {
exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
}
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java

View file

@ -31,9 +31,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
runtimeOnly("org.xerial:sqlite-jdbc:3.36.0.3")
runtimeOnly("mysql:mysql-connector-java:8.0.29")
runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
@@ -0,0 +0,0 @@ tasks.shadowJar {
}
@@ -0,0 +0,0 @@ tasks.check {
}
// Paper end
+// Paper start - include reobf mappings in jar for stacktrace deobfuscation
+abstract class IncludeMappings : BaseTask() {