Skip to content

Commit

Permalink
chore(gradle): add velocity build-logic stuff for future
Browse files Browse the repository at this point in the history
  • Loading branch information
powercasgamer committed Nov 28, 2023
1 parent 6fdc4c3 commit 614ca98
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
8 changes: 8 additions & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
maven("https://maven.deltapvp.net")
}
}

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
Expand Down
8 changes: 5 additions & 3 deletions build-logic/src/main/kotlin/common-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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())
}
}

Expand Down Expand Up @@ -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"),
Expand All @@ -117,7 +119,7 @@ tasks {
)

filesMatching(setOf("paper-plugin.yml", "plugin.yml", "velocity-plugin.json")) {
expand(praps)
expand(props)
}
}

Expand Down
3 changes: 1 addition & 2 deletions build-logic/src/main/kotlin/paper-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
48 changes: 48 additions & 0 deletions build-logic/src/main/kotlin/velocity-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -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() })
}
}
}
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 614ca98

Please sign in to comment.