diff --git a/api/build.gradle b/api/build.gradle index aaee6ba6..d8736e11 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -2,11 +2,11 @@ apply from: rootProject.file('buildscript/relocations.gradle') dependencies { // Annotations - compileOnlyApi 'org.jetbrains:annotations:22.0.0' - compileOnlyApi 'com.google.code.findbugs:jsr305:3.0.2' + compileOnlyApi(libs.jetbrains.annotations) + compileOnlyApi(libs.findbugs.annotations) // JDA - api('net.dv8tion:JDA:' + rootProject.jdaVersion) { + api(libs.jda) { // Annotations are suppose to be compile time only exclude group: 'org.jetbrains', module: 'annotations' exclude group: 'com.google.code.findbugs', module: 'jsr305' diff --git a/build.gradle b/build.gradle index b3da55cc..d1bed63d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,27 +1,13 @@ plugins { - id 'com.github.johnrengelman.shadow' version '7.1.1' apply false - id 'org.cadixdev.licenser' version '0.6.1' apply false - id 'net.kyori.blossom' version '1.2.0' apply false - id 'net.kyori.indra.git' version '2.1.1' apply false - id 'dev.vankka.dependencydownload.plugin' version '1.2.2-SNAPSHOT' apply false + alias(libs.plugins.shadow) apply false + alias(libs.plugins.licenser) apply false + alias(libs.plugins.blossom) apply false + alias(libs.plugins.indra.git) apply false + alias(libs.plugins.dependencydownload.plugin) apply false } version '2.0.0-SNAPSHOT' -ext { - // DependencyDownload (change plugin version above) - ddVersion = '1.2.2-SNAPSHOT' - // MinecraftDependencyDownload - mddVersion = '1.0.0-SNAPSHOT' - // JDA - jdaVersion = '5.0.0-alpha.9' - // Configurate - configurateVersion = '4.1.2' - // Adventure & Adventure Platform - adventureVersion = '4.10.0' - adventurePlatformVersion = '4.1.0' -} - allprojects { apply plugin: 'java' apply plugin: 'java-library' @@ -42,6 +28,10 @@ allprojects { runtimeDownloadApi compileOnlyApi.extendsFrom runtimeDownloadApi runtimeDownloadOnly.extendsFrom runtimeDownloadApi + + all { + resolutionStrategy.failOnDynamicVersions() + } } generateRuntimeDownloadResourceForRuntimeDownloadOnly { @@ -74,8 +64,8 @@ allprojects { dependencies { // Test dependencies - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' + testImplementation(libs.jupiter.api) + testRuntimeOnly(libs.jupiter.engine) } test { @@ -97,15 +87,15 @@ allprojects { finalizedBy shadowJar manifest.attributes( - "Specification-Title": "DiscordSRV", - "Specification-Vendor": "DiscordSRV", - "Specification-Version": project.version + 'Specification-Title': 'DiscordSRV', + 'Specification-Vendor': 'DiscordSRV', + 'Specification-Version': project.version ) if (project.name != "api") { manifest.attributes( - "Implementation-Title": "DiscordSRV", - "Implementation-Vendor": "DiscordSRV", - "Implementation-Version": project.version + 'Implementation-Title': 'DiscordSRV', + 'Implementation-Vendor': 'DiscordSRV', + 'Implementation-Version': project.version ) } if (indraGit.isPresent()) { diff --git a/bukkit/build.gradle b/bukkit/build.gradle index 44e7be61..080bc8a3 100644 --- a/bukkit/build.gradle +++ b/bukkit/build.gradle @@ -33,6 +33,8 @@ allprojects { } filter { includeGroup 'com.destroystokyo.paper' + includeGroup 'io.papermc' + includeGroup 'org.spigotmc' } } @@ -48,7 +50,7 @@ allprojects { dependencies { // Platform - compileOnly 'com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT' + compileOnly(libs.paperapi.old) } } @@ -61,13 +63,14 @@ dependencies { implementation project(path: ':common:common-server', configuration: 'runtimeElements') // DependencyDownload - implementation 'dev.vankka:minecraftdependencydownload-bukkit:' + rootProject.mddVersion + implementation(libs.mcdependencydownload.bukkit.bootstrap) // Adventure - runtimeDownloadApi 'net.kyori:adventure-platform-bukkit:' + rootProject.adventurePlatformVersion + runtimeDownloadApi(libs.adventure.api) + runtimeDownloadApi(libs.adventure.platform.bukkit) // Commodore - commodore('me.lucko:commodore:1.13') { + commodore(libs.commodore) { // We only use commodore when it's included in the server, so we don't want to download it exclude module: 'brigadier' // We don't use the commodore file format @@ -75,7 +78,7 @@ dependencies { } // Integrations - compileOnly 'net.milkbowl.vault:VaultAPI:1.7' + compileOnly(libs.vaultapi) } processResources { diff --git a/bukkit/loader/build.gradle b/bukkit/loader/build.gradle index 76ced591..13d8dfcc 100644 --- a/bukkit/loader/build.gradle +++ b/bukkit/loader/build.gradle @@ -7,7 +7,7 @@ dependencies { implementation project(':common:common-api') // DependencyDownload - implementation 'dev.vankka:minecraftdependencydownload-bukkit-loader:' + rootProject.mddVersion + implementation(libs.mcdependencydownload.bukkit.loader) } processResources { diff --git a/bungee/build.gradle b/bungee/build.gradle index 8d3ca6de..f33ba591 100644 --- a/bungee/build.gradle +++ b/bungee/build.gradle @@ -25,7 +25,7 @@ allprojects { dependencies { // Platform - compileOnly 'net.md-5:bungeecord-api:1.17-R0.1-SNAPSHOT' + compileOnly(libs.bungee) } } @@ -37,9 +37,9 @@ dependencies { implementation project(':common:common-proxy') // DependencyDownload - implementation 'dev.vankka:minecraftdependencydownload-bungee:' + rootProject.mddVersion + implementation(libs.mcdependencydownload.bungee.bootstrap) // Adventure - runtimeDownloadApi 'net.kyori:adventure-platform-bungeecord:' + rootProject.adventurePlatformVersion - runtimeDownloadApi 'net.kyori:adventure-text-serializer-bungeecord:' + rootProject.adventurePlatformVersion + runtimeDownloadApi(libs.adventure.platform.bungee) + runtimeDownloadApi(libs.adventure.serializer.bungee) } diff --git a/bungee/loader/build.gradle b/bungee/loader/build.gradle index 4a44cac8..a3ca7e94 100644 --- a/bungee/loader/build.gradle +++ b/bungee/loader/build.gradle @@ -7,7 +7,7 @@ dependencies { implementation project(':common:common-api') // DependencyDownload - implementation 'dev.vankka:minecraftdependencydownload-bungee-loader:' + rootProject.mddVersion + implementation(libs.mcdependencydownload.bungee.loader) } processResources { diff --git a/common/api/build.gradle b/common/api/build.gradle index ee9bd10a..0de17421 100644 --- a/common/api/build.gradle +++ b/common/api/build.gradle @@ -3,5 +3,5 @@ dependencies { api project(':api') // Logging - api 'org.slf4j:slf4j-api:1.7.32' + api(libs.slf4j.api) } diff --git a/common/build.gradle b/common/build.gradle index f78d8ef9..14213272 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -33,49 +33,49 @@ dependencies { testImplementation project(':common:common-api') // DependencyDownload - api 'dev.vankka:dependencydownload-runtime:' + rootProject.ddVersion + api(libs.dependencydownload.runtime) // Discord Webhooks - runtimeDownloadApi 'club.minnced:discord-webhooks:0.7.5' + runtimeDownloadApi(libs.webhooks) // Apache Commons - runtimeDownloadApi 'org.apache.commons:commons-lang3:3.12.0' - runtimeDownloadApi 'commons-io:commons-io:2.10.0' + runtimeDownloadApi(libs.commons.lang) + runtimeDownloadApi(libs.commons.io) // Caffeine - runtimeDownloadApi('com.github.ben-manes.caffeine:caffeine:2.9.2') { + runtimeDownloadApi(libs.caffeine) { exclude group: 'com.google.errorprone', module: 'error_prone_annotations' } - // Config - runtimeDownloadApi 'org.spongepowered:configurate-yaml:' + rootProject.configurateVersion - runtimeDownloadApi 'org.spongepowered:configurate-hocon:' + rootProject.configurateVersion - // Jackson (transitive in :api) - compileOnlyApi 'com.fasterxml.jackson.core:jackson-databind:2.10.1' + compileOnlyApi(libs.jackson.databind) + + // Config + runtimeDownloadApi(libs.configurate.yaml) + runtimeDownloadApi(libs.configurate.hocon) // Logging compileOnlyApi project(':common:common-slf4j-hack') - compileOnly 'org.apache.logging.log4j:log4j-core:2.0-beta9' + compileOnly(libs.log4j.core) // Adventure, MCDiscordReserializer, EnhancedLegacyText - runtimeDownloadApi 'net.kyori:adventure-api:' + rootProject.adventureVersion - runtimeDownloadApi 'net.kyori:adventure-text-serializer-plain:' + rootProject.adventureVersion - runtimeDownloadApi 'net.kyori:adventure-text-serializer-legacy:' + rootProject.adventureVersion - runtimeDownloadApi 'net.kyori:adventure-text-serializer-gson:' + rootProject.adventureVersion - runtimeDownloadApi 'dev.vankka:mcdiscordreserializer:4.3.0' - runtimeDownloadApi 'dev.vankka:enhancedlegacytext:1.0.0-SNAPSHOT' - - // Brigadier - compileOnlyApi 'com.mojang:brigadier:1.0.18' + runtimeDownloadApi(libs.adventure.api) + runtimeDownloadApi(libs.adventure.serializer.plain) + runtimeDownloadApi(libs.adventure.serializer.legacy) + runtimeDownloadApi(libs.adventure.serializer.gson) + runtimeDownloadApi(libs.mcdiscordreserializer) + runtimeDownloadApi(libs.enhancedlegacytext) // Database - hikari('com.zaxxer:HikariCP:4.0.3') { exclude group: 'org.slf4j' } - h2Driver 'com.h2database:h2:2.1.210' - mysqlDriver 'mysql:mysql-connector-java:8.0.25' + hikari(libs.hikaricp) { exclude group: 'org.slf4j' } + h2Driver(libs.h2) + mysqlDriver(libs.mysql) + + // Brigadier + compileOnlyApi(libs.brigadier) // Integrations - compileOnlyApi 'net.luckperms:api:5.3' + compileOnlyApi(libs.luckperms) } processResources { @@ -87,4 +87,8 @@ processResources { ) } +repositories { + mavenCentral() +} + // Relocations in buildscript/relocations.gradle diff --git a/common/slf4j-hack/build.gradle b/common/slf4j-hack/build.gradle index ec42264e..11af1912 100644 --- a/common/slf4j-hack/build.gradle +++ b/common/slf4j-hack/build.gradle @@ -1,3 +1,3 @@ dependencies { - api 'org.slf4j:slf4j-api:1.7.32' + api(libs.slf4j.api) } diff --git a/i18n/build.gradle b/i18n/build.gradle index d457920f..eda49460 100644 --- a/i18n/build.gradle +++ b/i18n/build.gradle @@ -21,8 +21,8 @@ dependencies { implementation(project(':sponge')) { transitive = false } implementation(project(':velocity')) { transitive = false } - api 'org.spongepowered:configurate-yaml:' + rootProject.configurateVersion - api 'org.spongepowered:configurate-hocon:' + rootProject.configurateVersion + api(libs.configurate.yaml) + api(libs.configurate.hocon) } application { diff --git a/settings.gradle b/settings.gradle index 32ef62f7..bc5d4d09 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,6 +6,114 @@ pluginManagement { } } +dependencyResolutionManagement { + versionCatalogs { + libs { + // Buildscript + plugin('shadow', 'com.github.johnrengelman.shadow').version('7.1.1') + plugin('licenser', 'org.cadixdev.licenser').version('0.6.1') + plugin('blossom', 'net.kyori.blossom').version('1.3.0') + plugin('indra-git', 'net.kyori.indra.git').version('2.1.1') + + // Bukkit + version('bukkit', '1.16.5-R0.1-SNAPSHOT') + library('paperapi', 'io.papermc.paper', 'paper-api').versionRef('bukkit') + library('paperapi-old', 'com.destroystokyo.paper', 'paper-api').versionRef('bukkit') + library('spigotapi', 'org.spigotmc', 'spigot-api').versionRef('bukkit') + + // Bungee + library('bungee', 'net.md-5', 'bungeecord-api').version('1.17-R0.1-SNAPSHOT') + + // Sponge + version('sponge', '8.0.0') + library('spongeapi', 'org.spongepowered', 'spongeapi').versionRef('sponge') + plugin('spongeplugin', 'org.spongepowered.gradle.plugin').version('2.0.0') + + // Velocity + library('velocity', 'com.velocitypowered', 'velocity-api').version('3.0.0') + + // DependencyDownload + version('dependencydownload', '1.2.2-SNAPSHOT') + plugin('dependencydownload-plugin', 'dev.vankka.dependencydownload.plugin').versionRef('dependencydownload') + library('dependencydownload-runtime', 'dev.vankka', 'dependencydownload-runtime').versionRef('dependencydownload') + library('dependencydownload-jarinjar-bootstrap', 'dev.vankka', 'dependencydownload-jarinjar-bootstrap').versionRef('dependencydownload') + library('dependencydownload-jarinjar-loader', 'dev.vankka', 'dependencydownload-jarinjar-loader').versionRef('dependencydownload') + + // MinecraftDependencyDownload + version('mcdependencydownload', '1.0.0-SNAPSHOT') + library('mcdependencydownload-bukkit-bootstrap', 'dev.vankka', 'minecraftdependencydownload-bukkit').versionRef('mcdependencydownload') + library('mcdependencydownload-bukkit-loader', 'dev.vankka', 'minecraftdependencydownload-bukkit').versionRef('mcdependencydownload') + library('mcdependencydownload-bungee-bootstrap', 'dev.vankka', 'minecraftdependencydownload-bungee').versionRef('mcdependencydownload') + library('mcdependencydownload-bungee-loader', 'dev.vankka', 'minecraftdependencydownload-bungee').versionRef('mcdependencydownload') + library('mcdependencydownload-velocity', 'dev.vankka', 'minecraftdependencydownload-velocity').versionRef('mcdependencydownload') + + // Annotations + library('jetbrains-annotations', 'org.jetbrains', 'annotations').version('23.0.0') + library('findbugs-annotations', 'com.google.code.findbugs', 'jsr305').version('3.0.2') + + // JDA + library('jda', 'net.dv8tion', 'JDA').version('5.0.0-alpha.10') + + // Discord Webhooks + library('webhooks', 'club.minnced', 'discord-webhooks').version('0.8.0') + + // Apache commons + library('commons-lang', 'org.apache.commons', 'commons-lang3').version('3.12.0') + library('commons-io', 'commons-io', 'commons-io').version('2.10.0') + + // Caffeine + library('caffeine', 'com.github.ben-manes.caffeine', 'caffeine').version('2.9.2') + + // Jackson + library('jackson-databind', 'com.fasterxml.jackson.core', 'jackson-databind').version('2.10.1') + + // Config(urate) + version('configurate', '4.1.2') + library('configurate-yaml', 'org.spongepowered', 'configurate-yaml').versionRef('configurate') + library('configurate-hocon', 'org.spongepowered', 'configurate-hocon').versionRef('configurate') + + // DB + library('hikaricp', 'com.zaxxer', 'HikariCP').version('4.0.3') + library('h2', 'com.h2database', 'h2').version('2.1.210') + library('mysql', 'mysql', 'mysql-connector-java').version('8.0.28') + + // Brigadier & Commodore + library('brigadier', 'com.mojang', 'brigadier').version('1.0.18') + library('commodore', 'me.lucko', 'commodore').version('1.13') + + // Integrations + library('luckperms', 'net.luckperms', 'api').version('5.4') + library('vaultapi', 'net.milkbowl.vault', 'VaultAPI').version('1.7') + + // Logging + library('slf4j-api', 'org.slf4j', 'slf4j-api').version('1.7.36') + library('log4j-core', 'org.apache.logging.log4j', 'log4j-core').version('2.0-beta9') + + // Adventure + version('adventure', '4.10.1') + library('adventure-api', 'net.kyori', 'adventure-api').versionRef('adventure') + library('adventure-serializer-plain', 'net.kyori', 'adventure-text-serializer-plain').versionRef('adventure') + library('adventure-serializer-legacy', 'net.kyori', 'adventure-text-serializer-legacy').versionRef('adventure') + library('adventure-serializer-gson', 'net.kyori', 'adventure-text-serializer-gson').versionRef('adventure') + + // Adventure Platform + version('adventure-platform', '4.1.0') + library('adventure-platform-bukkit', 'net.kyori', 'adventure-platform-bukkit').versionRef('adventure-platform') + library('adventure-platform-bungee', 'net.kyori', 'adventure-platform-bungeecord').versionRef('adventure-platform') + library('adventure-serializer-bungee', 'net.kyori', 'adventure-text-serializer-bungeecord').versionRef('adventure-platform') + + // MCDiscordReserializer & EnhancedLegacyText + library('mcdiscordreserializer', 'dev.vankka', 'mcdiscordreserializer').version('4.3.0') + library('enhancedlegacytext', 'dev.vankka', 'enhancedlegacytext').version('1.0.0-SNAPSHOT') + + // JUnit + version('junit', '5.8.2') + library('jupiter-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit') + library('jupiter-engine', 'org.junit.jupiter', 'junit-jupiter-engine').versionRef('junit') + } + } +} + rootProject.name = 'DiscordSRV2' [ diff --git a/sponge/build.gradle b/sponge/build.gradle index d1c49d8e..b7b3b3b3 100644 --- a/sponge/build.gradle +++ b/sponge/build.gradle @@ -6,7 +6,6 @@ shadowJar { // Relocations in buildscript/relocations.gradle } -var spongeVersion = '8.0.0' allprojects { repositories { exclusiveContent { @@ -21,8 +20,8 @@ allprojects { dependencies { // Platform - annotationProcessor 'org.spongepowered:spongeapi:' + spongeVersion - compileOnly 'org.spongepowered:spongeapi:' + spongeVersion + annotationProcessor(libs.spongeapi) + compileOnly(libs.spongeapi) } } @@ -34,6 +33,6 @@ dependencies { implementation project(':common:common-server') // Dependency Download - implementation 'dev.vankka:dependencydownload-jarinjar-bootstrap:' + rootProject.ddVersion + implementation(libs.dependencydownload.jarinjar.bootstrap) compileOnlyApi project(':sponge:sponge-loader') } diff --git a/sponge/loader/build.gradle b/sponge/loader/build.gradle index 72528bb3..3c384867 100644 --- a/sponge/loader/build.gradle +++ b/sponge/loader/build.gradle @@ -2,7 +2,7 @@ import org.spongepowered.gradle.plugin.config.PluginLoaders import org.spongepowered.plugin.metadata.model.PluginDependency plugins { - id 'org.spongepowered.gradle.plugin' version '2.0.0' + alias(libs.plugins.spongeplugin) } apply from: rootProject.file('buildscript/loader.gradle') @@ -12,7 +12,7 @@ dependencies { implementation project(':common:common-api') // DependencyDownload - implementation 'dev.vankka:dependencydownload-jarinjar-loader:' + rootProject.ddVersion + implementation(libs.dependencydownload.jarinjar.loader) } shadowJar { @@ -22,7 +22,7 @@ shadowJar { // buildscript/loader.gradle includes the jarinjar in the jar sponge { - apiVersion('8.0.0-SNAPSHOT') + apiVersion(libs.versions.sponge.get()) license('GPLv3') loader { name(PluginLoaders.JAVA_PLAIN) diff --git a/velocity/build.gradle b/velocity/build.gradle index 381df80b..33388acc 100644 --- a/velocity/build.gradle +++ b/velocity/build.gradle @@ -18,7 +18,6 @@ repositories { } } -var velocityVersion = '3.0.0' dependencies { // API annotationProcessor project(':api') @@ -28,11 +27,11 @@ dependencies { implementation project(':common:common-proxy') // Platform - annotationProcessor 'com.velocitypowered:velocity-api:' + velocityVersion - compileOnly 'com.velocitypowered:velocity-api:' + velocityVersion + annotationProcessor(libs.velocity) + compileOnly(libs.velocity) // DependencyDownload - implementation 'dev.vankka.minecraftdependencydownload:velocity:' + rootProject.mddVersion + implementation(libs.mcdependencydownload.velocity) } jar {