From ed0554bdb322870316ec5e999765b4f86f19337f Mon Sep 17 00:00:00 2001 From: Adrian Date: Tue, 7 Feb 2023 12:46:08 -0500 Subject: [PATCH] feat: implement run-task plugins resolves #75 --- .gitignore | 4 +++- common/build.gradle.kts | 14 ++----------- .../authmevelocity/common/LibsManager.java | 1 - gradle/libs.versions.toml | 5 +++++ paper/build.gradle.kts | 20 +++++++++++-------- velocity/build.gradle.kts | 9 +++++++-- 6 files changed, 29 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index a16e24b..a644476 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,6 @@ buildNumber.properties .vscode/ *.class -.gitpod.yml \ No newline at end of file +.gitpod.yml + +*/run/ \ No newline at end of file diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 56f3f18..8039d8a 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -1,7 +1,5 @@ plugins { alias(libs.plugins.blossom) - // Required to relocate packages - alias(libs.plugins.shadow) id("authmevelocity.spotless") } @@ -15,18 +13,10 @@ dependencies { compileOnly(libs.libby.core) } -tasks { - shadowJar { - relocate("net.byteflux.libby", "io.github._4drian3d.authmevelocity.libs.libby") - relocate("org.spongepowered", "io.github._4drian3d.authmevelocity.libs.sponge") - relocate("io.leangen.geantyref", "io.github._4drian3d.authmevelocity.libs.geantyref") - } -} - blossom { - replaceTokenIn("src/main/java/me/adrianed/authmevelocity/common/Constants.java") + replaceTokenIn("src/main/java/io/github/_4drian3d/authmevelocity/common/Constants.java") replaceToken("{version}", project.version) replaceToken("{description}", project.description) replaceToken("{configurate}", libs.versions.configurate.get()) replaceToken("{geantyref}", libs.versions.geantyref.get()) -} \ No newline at end of file +} diff --git a/common/src/main/java/io/github/_4drian3d/authmevelocity/common/LibsManager.java b/common/src/main/java/io/github/_4drian3d/authmevelocity/common/LibsManager.java index f97c046..862a866 100644 --- a/common/src/main/java/io/github/_4drian3d/authmevelocity/common/LibsManager.java +++ b/common/src/main/java/io/github/_4drian3d/authmevelocity/common/LibsManager.java @@ -21,7 +21,6 @@ import net.byteflux.libby.Library; import net.byteflux.libby.LibraryManager; import net.byteflux.libby.relocation.Relocation; - public final class LibsManager { private final LibraryManager manager; diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fda9aaa..ad4da57 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,6 +16,7 @@ adventure = "4.12.0" blossom = "1.3.1" geantyref = "1.3.13" indra = "3.0.1" +runtask = "2.0.1" [libraries] @@ -44,5 +45,9 @@ plugin-shadow = { group = "gradle.plugin.com.github.johnrengelman", name = "shad pluginyml-bukkit = { id = "net.minecrell.plugin-yml.bukkit", version.ref = "pluginyml" } shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" } + blossom = { id = "net.kyori.blossom", version.ref = "blossom" } indra = { id = "net.kyori.indra.publishing", version.ref = "indra" } + +runvelocity = { id = "xyz.jpenilla.run-velocity", version.ref = "runtask" } +runpaper = { id = "xyz.jpenilla.run-paper", version.ref = "runtask" } diff --git a/paper/build.gradle.kts b/paper/build.gradle.kts index 627c7d2..6778d8b 100644 --- a/paper/build.gradle.kts +++ b/paper/build.gradle.kts @@ -1,6 +1,7 @@ plugins { alias(libs.plugins.pluginyml.bukkit) alias(libs.plugins.shadow) + alias(libs.plugins.runpaper) id("authmevelocity.spotless") } @@ -48,20 +49,23 @@ bukkit { tasks { shadowJar { - //duplicatesStrategy = DuplicatesStrategy.EXCLUDE archiveFileName.set("AuthMeVelocity-Paper-${project.version}.jar") archiveClassifier.set("") - relocate("net.byteflux.libby", "io.github._4drian3d.authmevelocity.libs.libby") - } + relocate("net.byteflux.libby", "io.github._4drian3d.authmevelocity.libs.libby") + relocate("org.spongepowered", "io.github._4drian3d.authmevelocity.libs.sponge") + relocate("io.leangen.geantyref", "io.github._4drian3d.authmevelocity.libs.geantyref") + } build { dependsOn(shadowJar) } -} - -tasks.compileJava { - options.encoding = Charsets.UTF_8.name() - options.release.set(17) + compileJava { + options.encoding = Charsets.UTF_8.name() + options.release.set(17) + } + runServer { + minecraftVersion("1.19.3") + } } java.toolchain.languageVersion.set(JavaLanguageVersion.of(17)) diff --git a/velocity/build.gradle.kts b/velocity/build.gradle.kts index ccb2038..892094e 100644 --- a/velocity/build.gradle.kts +++ b/velocity/build.gradle.kts @@ -1,5 +1,6 @@ plugins { alias(libs.plugins.shadow) + alias(libs.plugins.runvelocity) id("authmevelocity.spotless") } @@ -42,12 +43,16 @@ tasks { archiveFileName.set("AuthMeVelocity-Velocity-${project.version}.jar") archiveClassifier.set("") - relocate("net.byteflux.libby", "io.github._4drian3d.authmevelocity.libs.libby") relocate("org.bstats", "io.github._4drian3d.authmevelocity.libs.bstats") + relocate("net.byteflux.libby", "io.github._4drian3d.authmevelocity.libs.libby") + relocate("org.spongepowered", "io.github._4drian3d.authmevelocity.libs.sponge") + relocate("io.leangen.geantyref", "io.github._4drian3d.authmevelocity.libs.geantyref") } - build { dependsOn(shadowJar) } + runVelocity { + velocityVersion(libs.versions.velocity.get()) + } }