Skip to content

Commit

Permalink
move dependencies to libs.versions.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
vytskalt committed Mar 28, 2024
1 parent 8408a3e commit d15ac8c
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 17 deletions.
4 changes: 4 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ plugins {
repositories {
gradlePluginPortal()
}

dependencies {
compileOnly(files(libs::class.java.protectionDomain.codeSource.location))
}
7 changes: 7 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
register("libs") {
from(files("../gradle/libs.versions.toml")) // include from parent project
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,23 @@ plugins {
`java-library`
}

// expose version catalog
val libs = extensions.getByType(org.gradle.accessors.dm.LibrariesForLibs::class)

repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}

dependencies {
compileOnly("org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT")
testImplementation("org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT")

val adventureVersion = "4.16.0"
compileOnly("net.kyori:adventure-api:$adventureVersion")
compileOnly("net.kyori:adventure-text-serializer-legacy:$adventureVersion")
compileOnly("net.kyori:adventure-text-serializer-gson:$adventureVersion")
testImplementation("net.kyori:adventure-api:$adventureVersion")
compileOnly(libs.spigotApi)
compileOnly(libs.bundles.adventure)

val jupiterVersion = "5.10.2"
testImplementation("org.junit.jupiter:junit-jupiter-api:$jupiterVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$jupiterVersion")
testImplementation(libs.spigotApi)
testImplementation(libs.bundles.adventure)
testImplementation(libs.junitJupiterApi)
testRuntimeOnly(libs.junitJupiterEngine)
}

tasks.withType<JavaCompile>().configureEach {
Expand Down
2 changes: 1 addition & 1 deletion extra-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("net.megavex.scoreboardlibrary.base-conventions")
id("net.megavex.scoreboardlibrary.publish-conventions")
kotlin("jvm") version "1.9.23"
alias(libs.plugins.kotlin)
}

kotlin {
Expand Down
23 changes: 23 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[versions]
adventure = "4.16.0"
junitJupiter = "5.10.2"
devBundle = "1.20.4-R0.1-SNAPSHOT" # modern packet adapter

[libraries]
spigotApi = "org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT" # do not update
onePointEightPointEightNms = "org.github.spigot:1.8.8:1.8.8"
packetEvents = "com.github.retrooper.packetevents:spigot:2.2.1"

adventureApi = { module = "net.kyori:adventure-api", version.ref = "adventure" }
adventureTextSerializerGson = { module = "net.kyori:adventure-text-serializer-gson", version.ref = "adventure" }
adventureTextSerializerLegacy = { module = "net.kyori:adventure-text-serializer-legacy", version.ref = "adventure" }

junitJupiterApi = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junitJupiter" }
junitJupiterEngine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junitJupiter" }

[plugins]
kotlin = "org.jetbrains.kotlin.jvm:1.9.23"
paperweight = "io.papermc.paperweight.userdev:1.5.12"

[bundles]
adventure = [ "adventureApi", "adventureTextSerializerGson", "adventureTextSerializerLegacy" ]
4 changes: 2 additions & 2 deletions versions/modern/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
plugins {
`maven-publish`
id("net.megavex.scoreboardlibrary.base-conventions")
id("io.papermc.paperweight.userdev") version "1.5.11"
alias(libs.plugins.paperweight)
}

dependencies {
compileOnly(project(":scoreboard-library-packet-adapter-base"))
paperweight.paperDevBundle("1.20.4-R0.1-SNAPSHOT")
paperweight.paperDevBundle(libs.versions.devBundle.get())
}

tasks {
Expand Down
2 changes: 1 addition & 1 deletion versions/packetevents/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ repositories {

dependencies {
compileOnly(project(":scoreboard-library-packet-adapter-base"))
compileOnly("com.github.retrooper.packetevents:spigot:2.2.1")
compileOnly(libs.packetEvents)
}
4 changes: 2 additions & 2 deletions versions/v1_8_R3/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ repositories {

dependencies {
compileOnly(project(":scoreboard-library-packet-adapter-base"))
compileOnly("org.github.spigot:1.8.8:1.8.8")
testImplementation("org.github.spigot:1.8.8:1.8.8")
compileOnly(libs.onePointEightPointEightNms)
testImplementation(libs.onePointEightPointEightNms)
}

0 comments on commit d15ac8c

Please sign in to comment.