From 27cf999e879a067a00cd3d7a40acd4b2b12389d4 Mon Sep 17 00:00:00 2001 From: zml Date: Sat, 24 Aug 2024 20:05:44 -0700 Subject: [PATCH] chore(testlib): Use JVM version restrictions to avoid failing tests --- build.gradle | 2 +- gradle/libs.versions.toml | 4 +- .../spotless/kotlin/in/build.gradle.kts | 2 +- .../perLanguageFormat/in/build.gradle.kts | 2 +- indra-testlib/build.gradle | 8 ---- .../indra/test/IndraFunctionalTestBase.java | 9 ++-- .../kyori/indra/test/LegacyGradleVersion.java | 42 ------------------- .../kyori/indra/test/LegacyGradleVersion.java | 42 ------------------- 8 files changed, 10 insertions(+), 101 deletions(-) delete mode 100644 indra-testlib/src/main/java/net/kyori/indra/test/LegacyGradleVersion.java delete mode 100644 indra-testlib/src/main/java20/net/kyori/indra/test/LegacyGradleVersion.java diff --git a/build.gradle b/build.gradle index 343e6d14..e9a7941e 100644 --- a/build.gradle +++ b/build.gradle @@ -53,7 +53,7 @@ subprojects { javaVersions { target 11 minimumToolchain 17 - testWith(11, 17, 20) + testWith(11, 17, 21) } signWithKeyFromPrefixedProperties("kyori") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bb798d02..e23c34ac 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,10 +8,10 @@ gradlePluginPublish = "1.2.1" immutables = "2.10.1" indra = "3.1.3" jetbrainsAnnotations = "24.1.0" -jgit = "6.10.0.+" # stay on 5.x series, 6+ requires Java 11 +jgit = "6.10.0.+" junit = "5.10.3" kotlin = "1.9.25" -mammoth = "1.3.1" +mammoth = "1.4.0" spotless = "6.21.0" [libraries] diff --git a/indra-licenser-spotless/src/test/resources/net/kyori/indra/licenser/spotless/kotlin/in/build.gradle.kts b/indra-licenser-spotless/src/test/resources/net/kyori/indra/licenser/spotless/kotlin/in/build.gradle.kts index 4153c279..af99dfd4 100644 --- a/indra-licenser-spotless/src/test/resources/net/kyori/indra/licenser/spotless/kotlin/in/build.gradle.kts +++ b/indra-licenser-spotless/src/test/resources/net/kyori/indra/licenser/spotless/kotlin/in/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("net.kyori.indra.licenser.spotless") - kotlin("jvm") version "1.8.21" + kotlin("jvm") version "2.0.20" } kotlin { diff --git a/indra-licenser-spotless/src/test/resources/net/kyori/indra/licenser/spotless/perLanguageFormat/in/build.gradle.kts b/indra-licenser-spotless/src/test/resources/net/kyori/indra/licenser/spotless/perLanguageFormat/in/build.gradle.kts index 0f4696ed..c5fce786 100644 --- a/indra-licenser-spotless/src/test/resources/net/kyori/indra/licenser/spotless/perLanguageFormat/in/build.gradle.kts +++ b/indra-licenser-spotless/src/test/resources/net/kyori/indra/licenser/spotless/perLanguageFormat/in/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("net.kyori.indra.licenser.spotless") - kotlin("jvm") version "1.8.21" + kotlin("jvm") version "2.0.20" } kotlin { diff --git a/indra-testlib/build.gradle b/indra-testlib/build.gradle index c7bb9288..6b2a3aa9 100644 --- a/indra-testlib/build.gradle +++ b/indra-testlib/build.gradle @@ -2,14 +2,6 @@ dependencies { api libs.mammoth.test } -sourceSets { - main { - multirelease { - alternateVersions 20 - } - } -} - javadoc { enabled = false } diff --git a/indra-testlib/src/main/java/net/kyori/indra/test/IndraFunctionalTestBase.java b/indra-testlib/src/main/java/net/kyori/indra/test/IndraFunctionalTestBase.java index 16365675..f7076116 100644 --- a/indra-testlib/src/main/java/net/kyori/indra/test/IndraFunctionalTestBase.java +++ b/indra-testlib/src/main/java/net/kyori/indra/test/IndraFunctionalTestBase.java @@ -1,7 +1,7 @@ /* * This file is part of indra, licensed under the MIT License. * - * Copyright (c) 2020-2023 KyoriPowered + * Copyright (c) 2020-2024 KyoriPowered * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -37,9 +37,10 @@ * A base annotation for both operations that use the configuration cache and those that don't. */ @GradleFunctionalTest -@LegacyGradleVersion -@TestVariant(gradleVersion = "8.4") -@TestVariantResource(value = "/injected-gradle-versions", optional = true) +@TestVariant(gradleVersion = "7.6.4", maximumRuntimeVersion = 20) +@TestVariant(gradleVersion = "8.9", maximumRuntimeVersion = 16) +@TestVariant(gradleVersion = "8.10", minimumRuntimeVersion = 17) +@TestVariantResource(value = "/injected-gradle-versions", optional = true, minimumRuntimeVersion = 17) @Tag("functional") @Documented @Retention(RetentionPolicy.RUNTIME) diff --git a/indra-testlib/src/main/java/net/kyori/indra/test/LegacyGradleVersion.java b/indra-testlib/src/main/java/net/kyori/indra/test/LegacyGradleVersion.java deleted file mode 100644 index 1b625c5e..00000000 --- a/indra-testlib/src/main/java/net/kyori/indra/test/LegacyGradleVersion.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is part of indra, licensed under the MIT License. - * - * Copyright (c) 2023 KyoriPowered - * - * 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. - */ -package net.kyori.indra.test; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import net.kyori.mammoth.test.TestVariant; - -/** - * An annotation providing Gradle 7.x test variants, so this version can be overridden when running on Java versions - * that older Gradle versions do not support. - */ -@TestVariant(gradleVersion = "7.6.2") -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.ANNOTATION_TYPE}) -public @interface LegacyGradleVersion { -} diff --git a/indra-testlib/src/main/java20/net/kyori/indra/test/LegacyGradleVersion.java b/indra-testlib/src/main/java20/net/kyori/indra/test/LegacyGradleVersion.java deleted file mode 100644 index 5afff8fb..00000000 --- a/indra-testlib/src/main/java20/net/kyori/indra/test/LegacyGradleVersion.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is part of indra, licensed under the MIT License. - * - * Copyright (c) 2023 KyoriPowered - * - * 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. - */ -package net.kyori.indra.test; - - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - - -/** - * An annotation providing Gradle 7.x test variants, so this version can be overridden when running on Java versions - * that older Gradle versions do not support. - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.ANNOTATION_TYPE}) -public @interface LegacyGradleVersion { -}