1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2025-12-19 14:59:20 +00:00

Use version catalog and renamed build-logic to buildSrc

This commit is contained in:
Tim203
2023-05-03 18:31:32 +02:00
parent 4bc8139b07
commit 9f30b5d456
22 changed files with 172 additions and 125 deletions

View File

@@ -1,7 +1,6 @@
dependencies {
api("org.geysermc", "common", Versions.geyserVersion)
api("org.geysermc.cumulus", "cumulus", Versions.cumulusVersion)
api("org.geysermc.event", "events", Versions.eventsVersion)
compileOnly("io.netty", "netty-transport", Versions.nettyVersion)
api(libs.geyser.common)
api(libs.cumulus)
api(libs.events)
compileOnly(libs.netty.transport)
}

View File

@@ -1,14 +0,0 @@
plugins {
`kotlin-dsl`
}
repositories {
gradlePluginPortal()
}
dependencies {
implementation("net.kyori", "indra-common", "3.0.1")
implementation("net.kyori", "indra-git", "3.0.1")
implementation("gradle.plugin.com.github.johnrengelman", "shadow", "7.1.1")
implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext", "gradle-idea-ext", "1.1.7")
}

View File

@@ -1,46 +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/Floodgate
*/
object Versions {
const val geyserVersion = "2.0.7-SNAPSHOT"
const val cumulusVersion = "1.1.1"
const val eventsVersion = "1.0-SNAPSHOT"
const val configUtilsVersion = "2.0-SNAPSHOT"
const val fastutilVersion = "8.5.3"
const val guiceVersion = "5.1.0"
const val nettyVersion = "4.1.49.Final"
const val snakeyamlVersion = "2.0"
const val cloudVersion = "1.5.0"
const val bstatsVersion = "3.0.2"
const val javaWebsocketVersion = "1.5.2"
const val checkerQual = "3.19.0"
// Platform versions
const val velocityVersion = "3.1.1"
const val bungeeCommit = "dfd847f"
const val spigotVersion = "1.19.4-R0.1-SNAPSHOT"
}

View File

@@ -1,8 +1,8 @@
plugins {
`java-library`
id("floodgate.build-logic")
id("io.freefair.lombok") version "8.0.1" apply false
id("io.micronaut.library") version "3.7.8" apply false
alias(libs.plugins.micronaut) apply false
alias(libs.plugins.lombok) apply false
}
allprojects {

14
buildSrc/build.gradle.kts Normal file
View File

@@ -0,0 +1,14 @@
plugins {
`kotlin-dsl`
}
repositories {
gradlePluginPortal()
}
dependencies {
implementation(libs.indra.common)
implementation(libs.indra.git)
implementation(libs.shadow)
implementation(libs.gradle.idea.ext)
}

View File

@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}

View File

@@ -25,7 +25,9 @@
import net.kyori.indra.git.IndraGitExtension
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.the
fun Project.fullVersion(): String {
@@ -72,6 +74,11 @@ fun Project.provided(dependency: ProjectDependency) {
dependencies.add("compileOnlyApi", dependency)
}
fun Project.provided(dependency: MinimalExternalModuleDependency) =
provided(dependency.module.group, dependency.module.name, dependency.versionConstraint.requiredVersion)
fun Project.provided(provider: Provider<MinimalExternalModuleDependency>) =
provided(provider.get())
fun Project.relocate(pattern: String) =
relocatedPackages.getOrPut(project.name) { mutableSetOf() }

View File

@@ -6,7 +6,7 @@ plugins {
}
dependencies {
compileOnly("org.checkerframework", "checker-qual", Versions.checkerQual)
compileOnly("org.checkerframework", "checker-qual", "3.19.0")
}
indra {

View File

@@ -1,22 +1,18 @@
var gsonVersion = "2.8.0"
var guavaVersion = "21.0"
dependencies {
api(projects.core)
annotationProcessor(projects.core)
implementation(projects.isolation)
implementation("cloud.commandframework", "cloud-bungee", Versions.cloudVersion)
implementation(libs.cloud.bungee)
}
relocate("com.google.inject")
relocate("net.kyori")
relocate("cloud.commandframework")
// used in cloud
relocate("io.leangen.geantyref")
// these dependencies are already present on the platform
provided("com.github.SpigotMC.BungeeCord", "bungeecord-proxy", Versions.bungeeCommit)
provided("com.google.code.gson", "gson", gsonVersion)
provided("com.google.guava", "guava", guavaVersion)
provided("org.yaml", "snakeyaml", Versions.snakeyamlVersion)
provided(libs.bungee)
provided(libs.gson)
provided(libs.guava)
provided(libs.snakeyaml)

View File

@@ -7,35 +7,34 @@ plugins {
dependencies {
api(projects.api)
compileOnlyApi(projects.isolation)
api("org.geysermc.configutils", "configutils", Versions.configUtilsVersion)
api(libs.config.utils)
api("com.nukkitx.fastutil", "fastutil-short-object-maps", Versions.fastutilVersion)
api("com.nukkitx.fastutil", "fastutil-int-object-maps", Versions.fastutilVersion)
api("org.java-websocket", "Java-WebSocket", Versions.javaWebsocketVersion)
api("cloud.commandframework", "cloud-core", Versions.cloudVersion)
api("org.yaml", "snakeyaml", Versions.snakeyamlVersion)
api("org.bstats", "bstats-base", Versions.bstatsVersion)
api(libs.bundles.fastutil)
api(libs.java.websocket)
api(libs.cloud.core)
api(libs.snakeyaml)
api(libs.bstats)
api("com.google.guava:guava:31.1-jre")
api(libs.guava)
annotationProcessor("io.micronaut:micronaut-inject-java")
api("io.micronaut", "micronaut-inject-java")
api("io.micronaut", "micronaut-context")
api("io.micronaut", "micronaut-http-client")
api("io.micronaut", "micronaut-validation")
annotationProcessor(libs.micronaut.inject)
api(libs.micronaut.inject)
api(libs.micronaut.context)
api(libs.micronaut.http.client)
api(libs.micronaut.validation)
//todo add hibernate dependency back in core,
// it's not possible to make it optional as the service files would be messed up
api(projects.database)
annotationProcessor("io.micronaut.data:micronaut-data-processor")
implementation("io.micronaut.data:micronaut-data-model")
implementation("jakarta.persistence:jakarta.persistence-api:2.2.3")
annotationProcessor(libs.micronaut.data.processor)
// implementation("io.micronaut.data:micronaut-data-model")
// implementation("jakarta.persistence:jakarta.persistence-api:2.2.3")
}
// present on all platforms
provided("io.netty", "netty-transport", Versions.nettyVersion)
provided("io.netty", "netty-codec", Versions.nettyVersion)
provided(libs.netty.transport)
provided(libs.netty.codec)
relocate("org.bstats")

View File

@@ -14,7 +14,7 @@ configurations.runtimeClasspath.get()
.exclude("io.micronaut", "micronaut-context")
dependencies {
implementation("io.micronaut.data:micronaut-data-hibernate-jpa")
implementation("io.micronaut.sql:micronaut-jdbc-hikari")
api(libs.micronaut.hibernate)
api(libs.micronaut.hikari)
//runtimeOnly("com.h2database:h2")
}

96
gradle/libs.versions.toml Normal file
View File

@@ -0,0 +1,96 @@
[versions]
# parent
micronaut-gradle = "3.7.9"
lombok = "8.0.1"
# api
geyser = "2.0.7-SNAPSHOT"
cumulus = "1.1.1"
events = "1.0-SNAPSHOT"
netty = "4.1.49.Final"
gson = "2.8.5"
# core
config-utils = "2.0-SNAPSHOT"
fastutil = "8.5.3"
java-websocket = "1.5.2"
cloud = "1.5.0"
snakeyaml = "2.0"
bstats = "3.0.2"
guava = "31.1-jre"
# bungee
bungee = "dfd847f"
# spigot
folia = "1.19.4-R0.1-SNAPSHOT"
authlib = "1.5.21"
# velocity
velocity = "3.1.1"
# buildSrc
indra = "3.0.1"
shadow = "7.1.1"
gradle-idea-ext = "1.1.7"
checkerframework = "3.19.0"
[libraries]
# api
geyser-common = { module = "org.geysermc:common", version.ref = "geyser" }
cumulus = { module = "org.geysermc.cumulus:cumulus", version.ref = "cumulus" }
events = { module = "org.geysermc.event:events", version.ref = "events" }
netty-transport = { module = "io.netty:netty-transport", version.ref = "netty" }
# indirectly included
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
# core
config-utils = { module = "org.geysermc.configutils:configutils", version.ref = "config-utils" }
fastutil-short-object-maps = { module = "com.nukkitx.fastutil:fastutil-short-object-maps", version.ref = "fastutil" }
fastutil-int-object-maps = { module = "com.nukkitx.fastutil:fastutil-int-object-maps", version.ref = "fastutil" }
java-websocket = { module = "org.java-websocket:Java-WebSocket", version.ref = "java-websocket" }
cloud-core = { module = "cloud.commandframework:cloud-core", version.ref = "cloud" }
snakeyaml = { module = "org.yaml:snakeyaml", version.ref = "snakeyaml" }
bstats = { module = "org.bstats:bstats-base", version.ref = "bstats" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }
micronaut-inject = { module = "io.micronaut:micronaut-inject-java" }
micronaut-context = { module = "io.micronaut:micronaut-context" }
micronaut-http-client = { module = "io.micronaut:micronaut-http-client" }
micronaut-validation = { module = "io.micronaut:micronaut-validation" }
micronaut-data-processor = { module = "io.micronaut.data:micronaut-data-processor" }
micronaut-hibernate = { module = "io.micronaut.data:micronaut-data-hibernate-jpa" }
micronaut-hikari = { module = "io.micronaut.sql:micronaut-jdbc-hikari" }
netty-codec = { module = "io.netty:netty-codec", version.ref = "netty" }
# database types
h2 = { module = "com.h2database:h2" }
# bungee
bungee = { module = "com.github.SpigotMC.BungeeCord:bungeecord-proxy", version.ref = "bungee" }
cloud-bungee = { module = "cloud.commandframework:cloud-bungee", version.ref = "cloud" }
# spigot
folia-api = { module = "dev.folia:folia-api", version.ref = "folia" }
cloud-bukkit = { module = "cloud.commandframework:cloud-bukkit", version.ref = "cloud" }
authlib = { module = "com.mojang:authlib", version.ref = "authlib" }
# velocity
cloud-velocity = { module = "cloud.commandframework:cloud-velocity", version.ref = "cloud" }
velocity-api = { module = "com.velocitypowered:velocity-api", version.ref = "velocity" }
# buildSrc
checker-qual = { module = "org.checkerframework:checker-qual", version.ref = "checkerframework" }
# plugins
indra-common = { module = "net.kyori:indra-common", version.ref = "indra" }
indra-git = { module = "net.kyori:indra-git", version.ref = "indra" }
shadow = { module = "gradle.plugin.com.github.johnrengelman:shadow", version.ref = "shadow" }
gradle-idea-ext = { module = "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext", version.ref = "gradle-idea-ext" }
[plugins]
micronaut = { id = "io.micronaut.library", version.ref = "micronaut-gradle" }
lombok = { id = "io.freefair.lombok", version.ref = "lombok" }
[bundles]
fastutil = ["fastutil-short-object-maps", "fastutil-int-object-maps"]

View File

@@ -53,7 +53,6 @@ pluginManagement {
id("net.kyori.indra")
id("net.kyori.indra.git")
}
includeBuild("build-logic")
}
rootProject.name = "floodgate-parent"
@@ -63,9 +62,6 @@ include(":core")
include(":bungee")
include(":spigot")
include(":universal")
include(":sqlite")
include(":mysql")
include(":mongo")
include(":database")
include(":isolation")

View File

@@ -1,18 +1,14 @@
var authlibVersion = "1.5.21"
var guavaVersion = "21.0"
var gsonVersion = "2.8.5"
dependencies {
api(projects.core)
annotationProcessor(projects.core)
implementation(projects.isolation)
implementation("cloud.commandframework", "cloud-bukkit", Versions.cloudVersion)
implementation(libs.cloud.bukkit)
// hack to make pre 1.12 work
implementation("com.google.guava", "guava", guavaVersion)
implementation(libs.guava)
compileOnlyApi("dev.folia", "folia-api", Versions.spigotVersion)
compileOnlyApi(libs.folia.api)
}
relocate("com.google.inject")
@@ -26,8 +22,8 @@ relocate("com.google.guava")
relocate("it.unimi")
// these dependencies are already present on the platform
provided("com.mojang", "authlib", authlibVersion)
provided("io.netty", "netty-transport", Versions.nettyVersion)
provided("io.netty", "netty-codec", Versions.nettyVersion)
provided("com.google.code.gson", "gson", gsonVersion)
provided("org.yaml", "snakeyaml", Versions.snakeyamlVersion)
provided(libs.authlib)
provided(libs.netty.transport)
provided(libs.netty.codec)
provided(libs.gson)
provided(libs.snakeyaml)

View File

@@ -2,12 +2,12 @@ plugins {
id("floodgate.generate-templates")
}
provided("com.github.SpigotMC.BungeeCord", "bungeecord-proxy", Versions.bungeeCommit)
provided("com.destroystokyo.paper", "paper-api", Versions.spigotVersion)
provided("com.velocitypowered", "velocity-api", Versions.velocityVersion)
provided(libs.bungee)
provided(libs.folia.api)
provided(libs.velocity.api)
// todo use an isolated class loader in the future
provided("com.google.code.gson", "gson", "2.8.5")
provided(libs.gson)
tasks {
templateSources {

View File

@@ -6,7 +6,7 @@ dependencies {
api(projects.core)
annotationProcessor(projects.core)
implementation("cloud.commandframework", "cloud-velocity", Versions.cloudVersion)
implementation(libs.cloud.velocity)
}
relocate("cloud.commandframework")
@@ -17,9 +17,6 @@ relocate("org.yaml.snakeyaml")
// these dependencies are already present on the platform
provided("com.google.code.gson", "gson", gsonVersion)
provided("com.google.guava", "guava", guavaVersion)
provided("com.google.inject", "guice", Versions.guiceVersion)
//provided("org.yaml", "snakeyaml", Versions.snakeyamlVersion) // included in Configurate
provided("com.velocitypowered", "velocity-api", Versions.velocityVersion)
provided("org.apache.logging.log4j", "log4j-core", log4jVersion)
provided(libs.gson)
provided(libs.guava)
provided(libs.velocity.api)

View File

@@ -4,7 +4,7 @@ plugins {
dependencies {
api(projects.isolation)
compileOnlyApi("com.velocitypowered", "velocity-api", Versions.velocityVersion)
compileOnlyApi(libs.velocity.api)
}
tasks {