Use Gradle's dependency catalogue feature (#3305)

Move all of our dependencies to a single catalogue file to make maintenance of them easier.
This commit is contained in:
SupremeMortal 2022-09-26 16:43:17 +01:00 committed by GitHub
parent 2c5c72f85f
commit e491cf8a17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 134 additions and 101 deletions

View file

@ -1,6 +1,6 @@
dependencies {
api("org.geysermc.cumulus", "cumulus", Versions.cumulusVersion)
api("org.geysermc.event", "events", Versions.eventsVersion) {
api(libs.cumulus)
api(libs.events) {
exclude(group = "com.google.guava", module = "guava")
exclude(group = "org.lanternpowered", module = "lmbda")
}

View file

@ -1,9 +1,7 @@
val bungeeVersion = "a7c6ede";
dependencies {
api(projects.core)
implementation("net.kyori", "adventure-text-serializer-bungeecord", Versions.adventurePlatformVersion)
implementation(libs.adventure.text.serializer.bungeecord)
}
platformRelocate("net.md_5.bungee.jni")
@ -12,7 +10,7 @@ platformRelocate("io.netty.channel.kqueue") // This is not used because relocati
platformRelocate("net.kyori")
// These dependencies are already present on the platform
provided("com.github.SpigotMC.BungeeCord", "bungeecord-proxy", bungeeVersion)
provided(libs.bungeecord.proxy)
application {
mainClass.set("org.geysermc.geyser.platform.bungeecord.GeyserBungeeMain")

View file

@ -6,19 +6,19 @@ val commodoreVersion = "2.2"
dependencies {
api(projects.core)
implementation("org.geysermc.geyser.adapters", "spigot-all", adaptersVersion)
implementation(libs.adapters.spigot)
implementation("me.lucko", "commodore", commodoreVersion)
implementation(libs.commodore)
implementation("net.kyori", "adventure-text-serializer-bungeecord", Versions.adventurePlatformVersion)
implementation(libs.adventure.text.serializer.bungeecord)
// Both paper-api and paper-mojangapi only provide Java 17 versions for 1.19
compileOnly("io.papermc.paper", "paper-api", paperVersion) {
compileOnly(libs.paper.api) {
attributes {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 17)
}
}
compileOnly("io.papermc.paper", "paper-mojangapi", paperVersion) {
compileOnly(libs.paper.mojangapi) {
attributes {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 17)
}

View file

@ -1,5 +1,3 @@
val spongeVersion = "7.1.0"
dependencies {
api(projects.core)
}
@ -18,7 +16,7 @@ exclude("org.slf4j:*")
exclude("org.ow2.asm:*")
// These dependencies are already present on the platform
provided("org.spongepowered", "spongeapi", spongeVersion)
provided(libs.sponge.api)
application {
mainClass.set("org.geysermc.geyser.platform.sponge.GeyserSpongeMain")

View file

@ -6,20 +6,16 @@ val jlineVersion = "3.21.0"
dependencies {
api(projects.core)
implementation("net.minecrell", "terminalconsoleappender", terminalConsoleVersion) {
implementation(libs.terminalconsoleappender) {
exclude("org.apache.logging.log4j", "log4j-core")
exclude("org.jline", "jline-reader")
exclude("org.jline", "jline-terminal")
exclude("org.jline", "jline-terminal-jna")
}
implementation("org.jline", "jline-terminal", jlineVersion)
implementation("org.jline", "jline-terminal-jna", jlineVersion)
implementation("org.jline", "jline-reader", jlineVersion)
implementation(libs.bundles.jline)
implementation("org.apache.logging.log4j", "log4j-api", Versions.log4jVersion)
implementation("org.apache.logging.log4j", "log4j-core", Versions.log4jVersion)
implementation("org.apache.logging.log4j", "log4j-slf4j18-impl", Versions.log4jVersion)
implementation(libs.bundles.log4j)
}
application {

View file

@ -1,7 +1,5 @@
val velocityVersion = "3.0.0"
dependencies {
annotationProcessor("com.velocitypowered", "velocity-api", velocityVersion)
annotationProcessor(libs.velocity.api)
api(projects.core)
}
@ -34,7 +32,7 @@ exclude("net.kyori:adventure-text-serializer-legacy:*")
exclude("net.kyori:adventure-nbt:*")
// These dependencies are already present on the platform
provided("com.velocitypowered", "velocity-api", velocityVersion)
provided(libs.velocity.api)
application {
mainClass.set("org.geysermc.geyser.platform.velocity.GeyserVelocityMain")

View file

@ -1,45 +0,0 @@
/*
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author GeyserMC
* @link https://github.com/GeyserMC/Geyser
*/
object Versions {
const val jacksonVersion = "2.13.2"
const val fastutilVersion = "8.5.2"
const val nettyVersion = "4.1.80.Final"
const val guavaVersion = "29.0-jre"
const val gsonVersion = "2.3.1" // Provided by Spigot 1.8.8
const val websocketVersion = "1.5.1"
const val protocolVersion = "fed46166"
const val raknetVersion = "1.6.28-20220125.214016-6"
const val mcauthlibVersion = "d9d773e"
const val mcprotocollibversion = "9f78bd5"
const val packetlibVersion = "3.0"
const val adventureVersion = "4.12.0-20220629.025215-9"
const val adventurePlatformVersion = "4.1.2"
const val junitVersion = "4.13.1"
const val checkerQualVersion = "3.19.0"
const val cumulusVersion = "1.1.1"
const val eventsVersion = "1.0-SNAPSHOT"
const val log4jVersion = "2.17.1"
}

View file

@ -25,7 +25,9 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Project
import org.gradle.api.artifacts.MinimalExternalModuleDependency
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.provider.Provider
import org.gradle.kotlin.dsl.named
fun Project.isSnapshot(): Boolean =
@ -64,5 +66,11 @@ fun Project.provided(pattern: String, name: String, version: String, excludedOn:
fun Project.provided(dependency: ProjectDependency) =
provided(dependency.group!!, dependency.name, dependency.version!!)
fun Project.provided(dependency: MinimalExternalModuleDependency) =
provided(dependency.module.group, dependency.module.name, dependency.versionConstraint.requiredVersion)
fun Project.provided(provider: Provider<MinimalExternalModuleDependency>) =
provided(provider.get())
private fun calcExclusion(section: String, bit: Int, excludedOn: Int): String =
if (excludedOn and bit > 0) section else ""

View file

@ -4,7 +4,7 @@ plugins {
}
dependencies {
compileOnly("org.checkerframework", "checker-qual", Versions.checkerQualVersion)
compileOnly("org.checkerframework", "checker-qual", "3.19.0")
}
tasks {

View file

@ -1,4 +1,4 @@
dependencies {
api("org.geysermc.cumulus", "cumulus", Versions.cumulusVersion)
api("com.google.code.gson", "gson", Versions.gsonVersion)
api(libs.cumulus)
api(libs.gson)
}

View file

@ -11,59 +11,50 @@ dependencies {
api(projects.common)
// Jackson JSON and YAML serialization
api("com.fasterxml.jackson.core", "jackson-annotations", Versions.jacksonVersion)
api("com.fasterxml.jackson.core", "jackson-databind", Versions.jacksonVersion + ".1") // Extra .1 as databind is a slightly different version
api("com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml", Versions.jacksonVersion)
api("com.google.guava", "guava", Versions.guavaVersion)
api(libs.bundles.jackson)
api(libs.guava)
// Fastutil Maps
implementation("com.nukkitx.fastutil", "fastutil-int-int-maps", Versions.fastutilVersion)
implementation("com.nukkitx.fastutil", "fastutil-int-long-maps", Versions.fastutilVersion)
implementation("com.nukkitx.fastutil", "fastutil-int-byte-maps", Versions.fastutilVersion)
implementation("com.nukkitx.fastutil", "fastutil-int-boolean-maps", Versions.fastutilVersion)
implementation("com.nukkitx.fastutil", "fastutil-object-int-maps", Versions.fastutilVersion)
implementation("com.nukkitx.fastutil", "fastutil-object-object-maps", Versions.fastutilVersion)
implementation(libs.bundles.fastutil)
// Network libraries
implementation("org.java-websocket", "Java-WebSocket", Versions.websocketVersion)
implementation(libs.websocket)
api("com.github.CloudburstMC.Protocol", "bedrock-v554", Versions.protocolVersion) {
api(libs.protocol) {
exclude("com.nukkitx.network", "raknet")
}
api("com.github.GeyserMC", "MCAuthLib", Versions.mcauthlibVersion)
api("com.github.GeyserMC", "MCProtocolLib", Versions.mcprotocollibversion) {
api(libs.mcauthlib)
api(libs.mcprotocollib) {
exclude("io.netty", "netty-all")
exclude("com.github.GeyserMC", "packetlib")
exclude("com.github.GeyserMC", "mcauthlib")
}
api("com.github.steveice10", "packetlib", Versions.packetlibVersion) {
api(libs.packetlib) {
exclude("io.netty", "netty-all")
}
implementation("com.nukkitx.network", "raknet", Versions.raknetVersion) {
implementation(libs.raknet) {
exclude("io.netty", "*");
}
implementation("io.netty", "netty-resolver-dns", Versions.nettyVersion)
implementation("io.netty", "netty-resolver-dns-native-macos", Versions.nettyVersion, null, "osx-x86_64")
implementation("io.netty", "netty-codec-haproxy", Versions.nettyVersion)
implementation(libs.netty.resolver.dns)
implementation(libs.netty.resolver.dns.native.macos) { artifact { classifier = "osx-x86_64" } }
implementation(libs.netty.codec.haproxy)
// Network dependencies we are updating ourselves
api("io.netty", "netty-handler", Versions.nettyVersion)
api(libs.netty.handler)
implementation("io.netty", "netty-transport-native-epoll", Versions.nettyVersion, null, "linux-x86_64")
implementation("io.netty", "netty-transport-native-epoll", Versions.nettyVersion, null, "linux-aarch_64")
implementation("io.netty", "netty-transport-native-kqueue", Versions.nettyVersion, null, "osx-x86_64")
implementation(libs.netty.transport.native.epoll) { artifact { classifier = "linux-x86_64" } }
implementation(libs.netty.transport.native.epoll) { artifact { classifier = "linux-aarch_64" } }
implementation(libs.netty.transport.native.kqueue) { artifact { classifier = "osx-x86_64" } }
// Adventure text serialization
implementation("net.kyori", "adventure-text-serializer-gson", Versions.adventureVersion) // Remove when we remove our Adventure bump
implementation("net.kyori", "adventure-text-serializer-legacy", Versions.adventureVersion)
implementation("net.kyori", "adventure-text-serializer-plain", Versions.adventureVersion)
implementation(libs.bundles.adventure)
// Test
testImplementation("junit", "junit", Versions.junitVersion)
testImplementation(libs.junit)
// Annotation Processors
compileOnly(projects.ap)

89
gradle/libs.versions.toml Normal file
View file

@ -0,0 +1,89 @@
[versions]
jackson = "2.13.4"
fastutil = "8.5.2"
netty = "4.1.80.Final"
guava = "29.0-jre"
gson = "2.3.1" # Provided by Spigot 1.8.8
websocket = "1.5.1"
protocol = "fed46166"
raknet = "1.6.28-20220125.214016-6"
mcauthlib = "d9d773e"
mcprotocollib = "9f78bd5"
packetlib = "3.0"
adventure = "4.12.0-20220629.025215-9"
adventure-platform = "4.1.2"
junit = "4.13.1"
checkerframework = "3.19.0"
cumulus = "1.1.1"
events = "1.0-SNAPSHOT"
log4j = "2.17.1"
jline = "3.21.0"
terminalconsoleappender = "1.2.0"
paper = "1.19-R0.1-SNAPSHOT"
viaversion = "4.0.0"
adapters = "1.5-SNAPSHOT"
commodore = "2.2"
bungeecord = "a7c6ede"
velocity = "3.0.0"
sponge = "7.1.0"
[libraries]
jackson-annotations = { group = "com.fasterxml.jackson.core", name = "jackson-annotations", version.ref = "jackson" }
jackson-core = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jackson" }
jackson-dataformat-yaml = { group = "com.fasterxml.jackson.dataformat", name = "jackson-dataformat-yaml", version.ref = "jackson" }
fastutil-int-int-maps = { group = "com.nukkitx.fastutil", name = "fastutil-int-int-maps", version.ref = "fastutil" }
fastutil-int-long-maps = { group = "com.nukkitx.fastutil", name = "fastutil-int-long-maps", version.ref = "fastutil" }
fastutil-int-byte-maps = { group = "com.nukkitx.fastutil", name = "fastutil-int-byte-maps", version.ref = "fastutil" }
fastutil-int-boolean-maps = { group = "com.nukkitx.fastutil", name = "fastutil-int-boolean-maps", version.ref = "fastutil" }
fastutil-object-int-maps = { group = "com.nukkitx.fastutil", name = "fastutil-object-int-maps", version.ref = "fastutil" }
fastutil-object-object-maps = { group = "com.nukkitx.fastutil", name = "fastutil-object-object-maps", version.ref = "fastutil" }
adventure-text-serializer-gson = { group = "net.kyori", name = "adventure-text-serializer-gson", version.ref = "adventure" } # Remove when we remove our Adventure bump
adventure-text-serializer-legacy = { group = "net.kyori", name = "adventure-text-serializer-legacy", version.ref = "adventure" }
adventure-text-serializer-plain = { group = "net.kyori", name = "adventure-text-serializer-plain", version.ref = "adventure" }
adventure-text-serializer-bungeecord = { group = "net.kyori", name = "adventure-text-serializer-bungeecord", version.ref = "adventure-platform" }
netty-resolver-dns = { group = "io.netty", name = "netty-resolver-dns", version.ref = "netty" }
netty-resolver-dns-native-macos = { group = "io.netty", name = "netty-resolver-dns-native-macos", version.ref = "netty" }
netty-codec-haproxy = { group = "io.netty", name = "netty-codec-haproxy", version.ref = "netty" }
netty-handler = { group = "io.netty", name = "netty-handler", version.ref = "netty" }
netty-transport-native-epoll = { group = "io.netty", name = "netty-transport-native-epoll", version.ref = "netty" }
netty-transport-native-kqueue = { group = "io.netty", name = "netty-transport-native-kqueue", version.ref = "netty" }
log4j-api = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j" }
log4j-core = { group = "org.apache.logging.log4j", name = "log4j-core", version.ref = "log4j" }
log4j-slf4j18-impl = { group = "org.apache.logging.log4j", name = "log4j-slf4j18-impl", version.ref = "log4j" }
jline-terminal = { group = "org.jline", name = "jline-terminal", version.ref = "jline" }
jline-terminal-jna = { group = "org.jline", name = "jline-terminal-jna", version.ref = "jline" }
jline-reader = { group = "org.jline", name = "jline-reader", version.ref = "jline" }
paper-api = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" }
paper-mojangapi = { group = "io.papermc.paper", name = "paper-mojangapi", version.ref = "paper" }
adapters-spigot = { group = "org.geysermc.geyser.adapters", name = "spigot-all", version.ref = "adapters" }
bungeecord-proxy = { group = "com.github.SpigotMC.BungeeCord", name = "bungeecord-proxy", version.ref = "bungeecord" }
checker-qual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checkerframework" }
commodore = { group = "me.lucko", name = "commodore", version.ref = "commodore" }
cumulus = { group = "org.geysermc.cumulus", name = "cumulus", version.ref = "cumulus" }
events = { group = "org.geysermc.event", name = "events", version.ref = "events" }
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
mcauthlib = { group = "com.github.GeyserMC", name = "MCAuthLib", version.ref = "mcauthlib" }
mcprotocollib = { group = "com.github.GeyserMC", name = "MCProtocolLib", version.ref = "mcprotocollib" }
packetlib = { group = "com.github.steveice10", name = "packetlib", version.ref = "packetlib" }
protocol = { group = "com.github.CloudburstMC.Protocol", name = "bedrock-v554", version.ref = "protocol" }
raknet = { group = "com.nukkitx.network", name = "raknet", version.ref = "raknet" }
sponge-api = { group = "org.spongepowered", name = "spongeapi", version.ref = "sponge" }
terminalconsoleappender = { group = "net.minecrell", name = "terminalconsoleappender", version.ref = "terminalconsoleappender" }
velocity-api = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
websocket = { group = "org.java-websocket", name = "Java-WebSocket", version.ref = "websocket" }
[bundles]
jackson = [ "jackson-annotations", "jackson-core", "jackson-dataformat-yaml" ]
fastutil = [ "fastutil-int-int-maps", "fastutil-int-long-maps", "fastutil-int-byte-maps", "fastutil-int-boolean-maps", "fastutil-object-int-maps", "fastutil-object-object-maps" ]
adventure = [ "adventure-text-serializer-gson", "adventure-text-serializer-legacy", "adventure-text-serializer-plain" ]
log4j = [ "log4j-api", "log4j-core", "log4j-slf4j18-impl" ]
jline = [ "jline-terminal", "jline-terminal-jna", "jline-reader" ]

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists