[ci skip] Add a test plugin (#6133)

This commit is contained in:
Jason 2021-07-09 03:04:33 -07:00 committed by GitHub
parent 416ec98982
commit 20ff0b058c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 3 deletions

3
.gitignore vendored
View file

@ -24,7 +24,6 @@ dependency-reduced-pom.xml
.*.sw[a-p] .*.sw[a-p]
# various other potential build files # various other potential build files
build/
bin/ bin/
dist/ dist/
manifest.mf manifest.mf
@ -68,3 +67,5 @@ paperclip-*.jar
paperclip.properties paperclip.properties
!gradle/wrapper/gradle-wrapper.jar !gradle/wrapper/gradle-wrapper.jar
test-plugin.settings.gradle.kts

View file

@ -20,10 +20,10 @@ index 67fb370cad6924895a6b27052dbd5c1767e3f0c9..3e05459f27c4c5697ae65da504d67a6a
/.project /.project
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..be565d252e326991f491cab3bfd3acc8356bbc7f index 0000000000000000000000000000000000000000..e76b9f9012c7ba7253f455fa92b3891737f4ffd3
--- /dev/null --- /dev/null
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -0,0 +1,138 @@ @@ -0,0 +1,145 @@
+import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer +import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer
+import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer +import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer
+import io.papermc.paperweight.util.Git +import io.papermc.paperweight.util.Git
@ -127,6 +127,13 @@ index 0000000000000000000000000000000000000000..be565d252e326991f491cab3bfd3acc8
+ workingDir = rootProject.layout.projectDirectory.dir( + workingDir = rootProject.layout.projectDirectory.dir(
+ providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run") + providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run")
+ ).get().asFile + ).get().asFile
+
+ if (rootProject.childProjects["test-plugin"] != null) {
+ val testPluginJar = rootProject.project(":test-plugin").tasks.jar.flatMap { it.archiveFile }
+ inputs.file(testPluginJar)
+ args("-add-plugin=${testPluginJar.get().asFile.absolutePath}")
+ }
+
+ args("--nogui") + args("--nogui")
+ systemProperty("net.kyori.adventure.text.warnWhenLegacyFormattingDetected", true) + systemProperty("net.kyori.adventure.text.warnWhenLegacyFormattingDetected", true)
+ if (project.hasProperty("disableWatchdog")) { + if (project.hasProperty("disableWatchdog")) {

View file

@ -8,3 +8,10 @@ pluginManagement {
rootProject.name = "Paper" rootProject.name = "Paper"
include("Paper-API", "Paper-Server", "Paper-MojangAPI") include("Paper-API", "Paper-Server", "Paper-MojangAPI")
val testPlugin = file("test-plugin.settings.gradle.kts")
if (testPlugin.exists()) {
apply(from = testPlugin)
} else {
testPlugin.writeText("// Uncomment to enable the test plugin module\n//include(\":test-plugin\")\n")
}

View file

@ -0,0 +1,17 @@
version = "1.0.0-SNAPSHOT"
repositories {
maven("https://libraries.minecraft.net")
}
dependencies {
compileOnly(project(":Paper-API"))
compileOnly(project(":Paper-MojangAPI"))
}
tasks.processResources {
inputs.property("version", project.version)
filesMatching("plugin.yml") {
expand("version" to project.version)
}
}

View file

@ -0,0 +1,11 @@
package io.papermc.paper.testplugin;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
public final class TestPlugin extends JavaPlugin implements Listener {
@Override
public void onEnable() {
this.getServer().getPluginManager().registerEvents(this, this);
}
}

View file

@ -0,0 +1,7 @@
name: Paper-Test-Plugin
version: ${version}
main: io.papermc.paper.testplugin.TestPlugin
description: Paper Test Plugin
author: PaperMC
api-version: 1.17
load: STARTUP