From 1750dd3b97a276287bf9b28562804fedd578c11f Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 30 Apr 2021 09:50:22 +0200 Subject: [PATCH] =?UTF-8?q?Opt=20in=20future=20proof=20gradle=20features?= =?UTF-8?q?=20=F0=9F=9A=80=20=20(#2950)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Opt in future proof gradle features * Resolve merge conflicts --- Bukkit/build.gradle.kts | 40 ++++++++--------- Core/build.gradle.kts | 38 ++++++++-------- build.gradle.kts | 9 ++-- gradle/libs.versions.toml | 95 +++++++++++++++++++++++++++++++++++++++ settings.gradle.kts | 5 ++- 5 files changed, 141 insertions(+), 46 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/Bukkit/build.gradle.kts b/Bukkit/build.gradle.kts index fa4f8f06e..88b02addc 100644 --- a/Bukkit/build.gradle.kts +++ b/Bukkit/build.gradle.kts @@ -32,44 +32,40 @@ repositories { } dependencies { - api(project(":PlotSquared-Core")) - - // - // Implementation details - // + api(projects.plotSquaredCore) // Metrics - implementation("org.bstats:bstats-bukkit:2.2.1") + implementation(libs.bstats) - // Minecraft - compileOnlyApi("com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT") - implementation("io.papermc:paperlib:1.0.6") + // Paper + compileOnlyApi(libs.paper) + implementation(libs.paperlib) // Plugins - compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.2.2") { + compileOnly(libs.worldeditBukkit) { exclude(group = "org.bukkit") exclude(group = "org.spigotmc") } - compileOnly("com.github.MilkBowl:VaultAPI:1.7") { + compileOnly(libs.vault) { exclude(group = "org.bukkit") } - compileOnly("me.clip:placeholderapi:2.10.9") - compileOnly("net.luckperms:api:5.3") - compileOnly("net.ess3:EssentialsX:2.18.2") - compileOnly("se.hyperver.hyperverse:Core:0.6.0-SNAPSHOT") { isTransitive = false } - compileOnly("be.maximvdw:MVdWPlaceholderAPI:3.1.1") { isTransitive = false } + compileOnly(libs.placeholderapi) + compileOnly(libs.luckperms) + compileOnly(libs.essentialsx) + compileOnly(libs.hyperverse) { isTransitive = false } + compileOnly(libs.mvdwapi) { isTransitive = false } // Other libraries - implementation("com.sk89q:squirrelid:1.0.0-SNAPSHOT") { isTransitive = false } - implementation("org.incendo.serverlib:ServerLib:2.1.0") + implementation(libs.squirrelid) { isTransitive = false } + implementation(libs.serverlib) // Our libraries - implementation("com.intellectualsites.arkitektonika:Arkitektonika-Client:2.0-SNAPSHOT") - implementation("com.intellectualsites.http:HTTP4J:1.1-SNAPSHOT") - implementation("com.intellectualsites.paster:Paster:1.0.2-SNAPSHOT") + implementation(libs.arkitektonika) + implementation(libs.http4j) + implementation(libs.paster) // Adventure - implementation("net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT") + implementation(libs.platform) } tasks.processResources { diff --git a/Core/build.gradle.kts b/Core/build.gradle.kts index 1756e7d33..8582255b7 100644 --- a/Core/build.gradle.kts +++ b/Core/build.gradle.kts @@ -2,56 +2,56 @@ import java.time.format.DateTimeFormatter dependencies { // Expected everywhere. - compileOnlyApi("org.checkerframework:checker-qual:3.12.0") + compileOnlyApi(libs.checkerqual) // Minecraft expectations - compileOnlyApi("com.google.guava:guava:21.0") { + compileOnlyApi(libs.guava) { because("Minecraft uses 21.0") } - compileOnlyApi("com.google.code.gson:gson:2.8.0") { + compileOnlyApi(libs.gson) { because("Minecraft uses 2.8.0") } // Platform expectations - compileOnlyApi("org.yaml:snakeyaml:1.27") { + compileOnlyApi(libs.snakeyaml) { because("Bukkit uses 1.27") } - // Adventure stuff - api("net.kyori:adventure-api:4.7.0") - api("net.kyori:adventure-text-minimessage:4.0.0-SNAPSHOT") + // Adventure + api(libs.adventure) + api(libs.minimessage) // Guice - api("com.google.inject:guice:5.0.1") { + api(libs.guice) { exclude(group = "com.google.guava") } - api("com.google.inject.extensions:guice-assistedinject:5.0.1") { + api(libs.guiceassistedinject) { exclude("com.google.inject", "guice") } - compileOnlyApi("com.google.code.findbugs:annotations:3.0.1") + compileOnlyApi(libs.findbugs) // Plugins - compileOnlyApi("com.sk89q.worldedit:worldedit-core:7.2.2") { + compileOnlyApi(libs.worldeditCore) { exclude(group = "bukkit-classloader-check") exclude(group = "mockito-core") exclude(group = "dummypermscompat") } - testImplementation("com.sk89q.worldedit:worldedit-core:7.2.2") + testImplementation(libs.worldeditCore) // Logging - api("org.slf4j:slf4j-api:1.7.25") - runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1") { + api(libs.slf4j) + runtimeOnly(libs.log4j) { exclude(group = "org.slf4j") } // Other libraries - api("org.khelekore:prtree:1.7.0-SNAPSHOT") - api("aopalliance:aopalliance:1.0") - api("com.intellectualsites:Pipeline:1.4.0-SNAPSHOT") { + api(libs.prtree) + api(libs.aopalliance) + api(libs.pipeline) { exclude(group = "com.google.guava") } - api("com.intellectualsites.arkitektonika:Arkitektonika-Client:2.0-SNAPSHOT") - api("com.intellectualsites.paster:Paster:1.0.2-SNAPSHOT") + api(libs.arkitektonika) + api(libs.paster) } tasks.processResources { diff --git a/build.gradle.kts b/build.gradle.kts index 51c3e0840..dc17e579a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -82,9 +82,10 @@ allprojects { testImplementation("junit:junit:4.13.2") } - configure { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = sourceCompatibility + plugins.withId("java") { + the().toolchain { + languageVersion.set(JavaLanguageVersion.of(11)) + } } configure { @@ -120,7 +121,7 @@ allprojects { name.set("Alexander Söderberg") } developer { - id.set("N0tMyFaultOG") + id.set("NotMyFault") name.set("NotMyFault") } developer { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..cfd286bf7 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,95 @@ +[versions] +checker-qual = "3.12.0" + +guava = "21.0" +gson = "2.8.0" + +snakeyaml = "1.27" + +adventure-api = "4.7.0" +adventure-text-minimessage = "4.0.0-SNAPSHOT" +adventure-platform-bukkit = "4.0.0-SNAPSHOT" + +guice = "5.0.1" +findbugs = "3.0.1" + +worldedit = "7.2.5" +vault = "1.7" +placeholderapi = "2.10.9" +luckperms = "5.3" +essentialsx = "2.18.2" +hyperverse = "0.6.0-SNAPSHOT" + +slf4j-api = "1.7.25" +log4j-slf4j-impl = "2.8.1" + +prtree = "1.7.0-SNAPSHOT" +aopalliance = "1.0" +pipeline = "1.4.0-SNAPSHOT" + +arkitektonika = "2.0-SNAPSHOT" +paster = "1.0.2-SNAPSHOT" + +bstats = "2.2.1" + +paper = "1.16.5-R0.1-SNAPSHOT" +paperlib = "1.0.6" + +mvdwapi = "3.1.1" +squirrelid = "1.0.0-SNAPSHOT" +serverlib = "2.1.0" +http4j = "1.1-SNAPSHOT" + +[libraries] +# Expected everywhere. +checkerqual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checker-qual" } + +# Minecraft expectations +guava = { group = "com.google.guava", name = "guava", version.ref = "guava" } +gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } + +# Platform expectations +snakeyaml = { group = "org.yaml", name = "snakeyaml", version.ref = "snakeyaml" } + +# Adventure +adventure = { group = "net.kyori", name = "adventure-api", version.ref = "adventure-api" } +minimessage = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "adventure-text-minimessage" } +platform = { group = "net.kyori", name = "adventure-platform-bukkit", version.ref = "adventure-platform-bukkit" } + +# Guice +guice = { group = "com.google.inject", name = "guice", version.ref = "guice" } +guiceassistedinject = { group = "com.google.inject.extensions", name = "guice-assistedinject", version.ref = "guice" } +findbugs = { group = "com.google.code.findbugs", name = "annotations", version.ref = "findbugs" } + +# Plugins +worldeditCore = { group = "com.sk89q.worldedit", name = "worldedit-core", version.ref = "worldedit" } +worldeditBukkit = { group = "com.sk89q.worldedit", name = "worldedit-bukkit", version.ref = "worldedit" } +vault = { group = "com.github.MilkBowl", name = "VaultAPI", version.ref = "vault" } +placeholderapi = { group = "me.clip", name = "placeholderapi", version.ref = "placeholderapi" } +luckperms = { group = "net.luckperms", name = "api", version.ref = "luckperms" } +essentialsx = { group = "net.ess3", name = "EssentialsX", version.ref = "essentialsx" } +hyperverse = { group = "se.hyperver.hyperverse", name = "Core", version.ref = "hyperverse" } + +# Logging +slf4j = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j-api" } +log4j = { group = "org.apache.logging.log4j", name = "log4j-slf4j-impl", version.ref = "log4j-slf4j-impl" } + +# Other libraries +prtree = { group = "org.khelekore", name = "prtree", version.ref = "prtree" } +aopalliance = { group = "aopalliance", name = "aopalliance", version.ref = "aopalliance" } +pipeline = { group = "com.intellectualsites", name = "Pipeline", version.ref = "pipeline" } +mvdwapi = { group = "be.maximvdw", name = "MVdWPlaceholderAPI", version.ref = "mvdwapi" } +squirrelid = { group = "com.sk89q", name = "squirrelid", version.ref = "squirrelid" } +serverlib = { group = "org.incendo.serverlib", name = "ServerLib", version.ref = "serverlib" } + +# Our libraries +arkitektonika = { group = "com.intellectualsites.arkitektonika", name = "Arkitektonika-Client", version.ref = "arkitektonika" } +http4j = { group = "com.intellectualsites.http", name = "HTTP4J", version.ref = "http4j" } +paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref = "paster" } + +# Metrics +bstats = { group = "org.bstats", name = "bstats-bukkit", version.ref = "bstats" } + +# Paper +paper = { group = "com.destroystokyo.paper", name = "paper-api", version.ref = "paper" } +paperlib = { group = "io.papermc", name = "paperlib", version.ref = "paperlib" } diff --git a/settings.gradle.kts b/settings.gradle.kts index c06a2cd45..c6cbce9df 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,4 +3,7 @@ rootProject.name = "PlotSquared" include("Core", "Bukkit") project(":Core").name = "PlotSquared-Core" -project(":Bukkit").name = "PlotSquared-Bukkit" \ No newline at end of file +project(":Bukkit").name = "PlotSquared-Bukkit" + +enableFeaturePreview("VERSION_CATALOGS") +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")