From 614ca982e0227ac372fdd5d368f0f7205c4e5e4d Mon Sep 17 00:00:00 2001 From: powercas_gamer Date: Tue, 28 Nov 2023 10:30:20 +0100 Subject: [PATCH] chore(gradle): add velocity build-logic stuff for future --- build-logic/build.gradle.kts | 4 +- build-logic/settings.gradle.kts | 8 ++++ .../main/kotlin/common-conventions.gradle.kts | 8 ++-- .../main/kotlin/paper-conventions.gradle.kts | 3 +- .../kotlin/velocity-conventions.gradle.kts | 48 +++++++++++++++++++ gradle/libs.versions.toml | 1 + 6 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 build-logic/src/main/kotlin/velocity-conventions.gradle.kts diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index f18384d..98a59aa 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -50,10 +50,10 @@ spotless { } kotlinGradle { applyCommon() - ktlint("1.0.1") + ktlint(libs.versions.ktlint.get()) } kotlin { applyCommon() - ktlint("1.0.1") + ktlint(libs.versions.ktlint.get()) } } diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts index b5a0fab..1a603f8 100644 --- a/build-logic/settings.gradle.kts +++ b/build-logic/settings.gradle.kts @@ -1,3 +1,11 @@ +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + maven("https://maven.deltapvp.net") + } +} + dependencyResolutionManagement { versionCatalogs { create("libs") { diff --git a/build-logic/src/main/kotlin/common-conventions.gradle.kts b/build-logic/src/main/kotlin/common-conventions.gradle.kts index 85c0f72..2ad0057 100644 --- a/build-logic/src/main/kotlin/common-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/common-conventions.gradle.kts @@ -14,7 +14,7 @@ plugins { id("java-library") } -// val libs = extensions.getByType(org.gradle.accessors.dm.LibrariesForLibs::class) +val libs = extensions.getByType(org.gradle.accessors.dm.LibrariesForLibs::class) extensions.getByType(BasePluginExtension::class.java).archivesName.set(project.nameString(true)) @@ -51,10 +51,12 @@ spotless { kotlinGradle { applyCommon() ktlint("0.50.0") +// ktlint(libs.versions.ktlint.get()) } kotlin { applyCommon() ktlint("0.50.0") +// ktlint(libs.versions.ktlint.get()) } } @@ -108,7 +110,7 @@ tasks { filteringCharset = "UTF-8" duplicatesStrategy = DuplicatesStrategy.INCLUDE - val praps = + val props = mapOf( "pluginVersion" to project.versionString(), "pluginAuthor" to providers.gradleProperty("projectAuthor").getOrElse("template"), @@ -117,7 +119,7 @@ tasks { ) filesMatching(setOf("paper-plugin.yml", "plugin.yml", "velocity-plugin.json")) { - expand(praps) + expand(props) } } diff --git a/build-logic/src/main/kotlin/paper-conventions.gradle.kts b/build-logic/src/main/kotlin/paper-conventions.gradle.kts index 5c3af29..7f2df63 100644 --- a/build-logic/src/main/kotlin/paper-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/paper-conventions.gradle.kts @@ -17,8 +17,7 @@ tasks { args("-p", "25519") downloadPlugins { - url("https://github.com/MiniPlaceholders/MiniPlaceholders/releases/download/2.2.1/MiniPlaceholders-Paper-2.2.1.jar") - url("https://download.luckperms.net/1519/bukkit/loader/LuckPerms-Bukkit-5.4.106.jar") + url("https://download.luckperms.net/1521/bukkit/loader/LuckPerms-Bukkit-5.4.108.jar") } } diff --git a/build-logic/src/main/kotlin/velocity-conventions.gradle.kts b/build-logic/src/main/kotlin/velocity-conventions.gradle.kts new file mode 100644 index 0000000..98994db --- /dev/null +++ b/build-logic/src/main/kotlin/velocity-conventions.gradle.kts @@ -0,0 +1,48 @@ +import io.papermc.hangarpublishplugin.model.Platforms + +plugins { + id("common-conventions") + id("xyz.jpenilla.run-velocity") + id("xyz.jpenilla.gremlin-gradle") + id("io.papermc.hangar-publish-plugin") +} + +tasks { + runVelocity { + velocityVersion("3.2.0-SNAPSHOT") + + systemProperty("terminal.jline", false) + systemProperty("terminal.ansi", true) + args("-p", "25520") + + downloadPlugins { + url("https://download.luckperms.net/1521/velocity/LuckPerms-Velocity-5.4.108.jar") + } + } + + named("clean", Delete::class) { + delete(project.projectDir.resolve("run")) + } +} + +hangarPublish { + publications.register("plugin") { + version.set(project.version as String) + id.set("TimeTriggeredPerms") + channel.set(if (rootProject.versionString().endsWith("-SNAPSHOT")) "Beta" else "Release") + platforms { + register(Platforms.VELOCITY) { + jar.set(tasks.shadowJar.flatMap { it.archiveFile }) + platformVersions.set(listOf("3.0")) + dependencies { + url("LuckPerms", "https://luckperms.net") { + required.set(true) + } + } + } + } + pages { + resourcePage(provider { rootProject.file("README.md").readText() }) + } + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5550662..dd3425d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -28,3 +28,4 @@ idea-gradle = "1.1.7" run-task = "2.2.2" hangar-publish = "0.1.0" spotless = "6.23.0" +ktlint = "1.0.1" \ No newline at end of file