Skip to content

Commit

Permalink
build: improved versions declaration with versions catalogs
Browse files Browse the repository at this point in the history
build: implement run task plugins
  • Loading branch information
4drian3d committed Feb 11, 2023
1 parent f9ab8f6 commit 829b20c
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 34 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,7 @@ gradle-app.setting
/.idea/

# VisualStudioCode
.vscode
.vscode

# Run-Task
*/run/
7 changes: 4 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
java
id("com.github.johnrengelman.shadow") version "7.1.2"
alias(libs.plugins.shadow)
}

allprojects {
apply(plugin = "java")
apply(plugin = "com.github.johnrengelman.shadow")
apply<JavaPlugin>()
apply<ShadowPlugin>()

java {
toolchain {
Expand Down
26 changes: 14 additions & 12 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
plugins {
`maven-publish`
id("net.kyori.blossom") version "1.3.1"
alias(libs.plugins.blossom)
}

dependencies {
implementation("com.maxmind.geoip2:geoip2:4.0.0")
implementation("org.apache.commons:commons-compress:1.22")
implementation("org.apache.commons:commons-text:1.10.0")
implementation("com.google.guava:guava:31.1-jre")
implementation("org.spongepowered:configurate-hocon:4.1.2")
implementation("org.jetbrains:annotations:24.0.0")
implementation("com.zaxxer:HikariCP:5.0.1")
// TODO: Implement runtime downloading here
implementation(libs.geoip)
implementation(libs.commons.compress)
implementation(libs.commons.text)
implementation(libs.guava)
implementation(libs.configurate)
implementation(libs.hikaricp)

compileOnly("net.kyori:adventure-api:4.12.0")
compileOnly("net.kyori:adventure-text-serializer-legacy:4.12.0")
compileOnly("org.apache.logging.log4j:log4j-core:2.19.0")
compileOnly("org.slf4j:slf4j-api:2.0.6")
compileOnly(libs.adventure.api)
compileOnly(libs.adventure.serializer.legacy)
compileOnly(libs.log4j2)
compileOnly(libs.slf4j)

compileOnly(libs.annotations)
}

blossom {
Expand Down
86 changes: 86 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
metadata.format.version = "1.1"

[versions]

# Compile only
velocity = "3.2.0-SNAPSHOT"
waterfall="1.19-R0.1-SNAPSHOT"
paper = "1.19.3-R0.1-SNAPSHOT"

libby = "1.1.5"
bstats = "3.0.0"
configurate = "4.1.2"
miniplaceholders = "1.3.1"

# Plugins
blossom = "1.3.1"
shadow = "7.1.2"
runtask = "2.0.1"

# Test versions
slf4j = "2.0.6"
log4j2 = "2.19.0"

# Required by Configurate 4
geantyref = "1.3.13"

adventure = "4.12.0"
adventure-platform = "4.2.0"

annotations = "24.0.0"

hikaricp = "5.0.1"
guava = "31.1-jre"

commons-compress = "1.22"
commons-text = "1.10.0"

geoip = "4.0.0"


[libraries]
# Adventure
adventure-platform-bungeecord = { group = "net.kyori", name = "adventure-platform-bungeecord", version.ref = "adventure-platform" }
adventure-serializer-legacy = { group = "net.kyori", name = "adventure-text-serializer-legacy", version.ref = "adventure" }
adventure-api = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" }

annotations = { module = "org.jetbrains:annotations", version.ref = "annotations" }

# Platform Compile Only Dependencies
velocity = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" }
waterfall = { group = "io.github.waterfallmc", name = "waterfall-api", version.ref = "waterfall" }

# BStats
bstats-velocity = { module = "org.bstats:bstats-velocity", version.ref = "bstats" }
bstats-bukkit = { module = "org.bstats:bstats-bukkit", version.ref = "bstats" }
bstats-waterfall = { module = "org.bstats:bstats-waterfall", version.ref = "bstats" }

configurate = { module = "org.spongepowered:configurate-hocon", version.ref = "configurate" }
miniplaceholders = { group = "com.github.4drian3d", name = "MiniPlaceholders", version.ref = "miniplaceholders" }

# Included Dependencies
libby-velocity = { group = "net.byteflux", name = "libby-velocity", version.ref = "libby" }

# Loggers
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
log4j2 = { group = "org.apache.logging.log4j", name = "log4j-core", version.ref = "log4j2" }

hikaricp = { module = "com.zaxxer:HikariCP", version.ref = "hikaricp" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }

commons-text = { group = "org.apache.commons", name = "commons-text", version.ref = "commons-text" }
commons-compress = { group = "org.apache.commons", name = "commons-compress", version.ref = "commons-compress" }

geoip = { group = "com.maxmind.geoip2", name = "geoip2", version.ref = "geoip" }


[plugins]

blossom = { id = "net.kyori.blossom", version.ref = "blossom" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }

# Run Task
runvelocity = { id = "xyz.jpenilla.run-velocity", version.ref = "runtask" }
runpaper = { id = "xyz.jpenilla.run-paper", version.ref = "runtask" }
runwaterfall = { id = "xyz.jpenilla.run-waterfall", version.ref = "runtask" }
11 changes: 9 additions & 2 deletions paper/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
plugins {
alias(libs.plugins.runpaper)
}

dependencies {
implementation(project(":core"))
compileOnly("io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT")
implementation(projects.core)
compileOnly(libs.paper)
}

tasks {
build {
dependsOn(shadowJar)
}
runServer {
minecraftVersion(libs.versions.paper.get().substringBefore('-'))
}
}
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@file:Suppress("UnstableApiUsage")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

rootProject.name = "EpicGuard"

dependencyResolutionManagement {
Expand Down
25 changes: 13 additions & 12 deletions velocity/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
alias(libs.plugins.runvelocity)
}

dependencies {
implementation(project(":core"))

compileOnly("mysql:mysql-connector-java:8.0.32")
compileOnly("org.xerial:sqlite-jdbc:3.40.1.0")
implementation("net.byteflux:libby-velocity:1.1.5")

compileOnly("com.velocitypowered:velocity-api:3.1.2-SNAPSHOT")
annotationProcessor("com.velocitypowered:velocity-api:3.1.2-SNAPSHOT")
}
implementation(projects.core)
implementation(libs.libby.velocity)

tasks.withType<ShadowJar> {
relocate("net.byteflux.libby", "me.xneox.epicguard.velocity.libby")
compileOnly(libs.velocity)
annotationProcessor(libs.velocity)
}

tasks {
shadowJar {
relocate("net.byteflux.libby", "me.xneox.epicguard.velocity.libby")
}
build {
dependsOn(shadowJar)
}
runVelocity {
velocityVersion(libs.versions.velocity.get())
}
}
13 changes: 9 additions & 4 deletions waterfall/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
alias(libs.plugins.runwaterfall)
}

dependencies {
implementation(project(":core"))
implementation(projects.core)

compileOnly("net.kyori:adventure-platform-bungeecord:4.2.0")
compileOnly("io.github.waterfallmc:waterfall-api:1.19-R0.1-SNAPSHOT")
compileOnly(libs.adventure.platform.bungeecord)
compileOnly(libs.waterfall)
}

tasks {
build {
dependsOn(shadowJar)
}
runWaterfall {
waterfallVersion(libs.versions.waterfall.get().substringBefore('-'))
}
}

0 comments on commit 829b20c

Please sign in to comment.