From e8fee9ac2f67dfd3e35f2c6f56fd3273c6f47b44 Mon Sep 17 00:00:00 2001 From: Oleg Yukhnevich Date: Thu, 16 Jan 2025 19:28:55 +0200 Subject: [PATCH] a --- .../src/main/kotlin/TestVersions.kt | 39 ++++++++++++------- .../src/testPlugin/kotlin/JvmPluginTest.kt | 4 +- .../kotlin/MultiplatformJvmPluginTest.kt | 4 +- .../kotlin/MultiplatformPluginTest.kt | 4 +- .../kotlin/MultiplatformJvmProcessorTest.kt | 4 +- .../src/testRuntime/kotlin/JvmRuntimeTest.kt | 2 +- .../MultiplatformCrossModuleRuntimeTest.kt | 2 +- .../kotlin/MultiplatformJvmRuntimeTest.kt | 12 +++--- .../kotlin/MultiplatformRuntimeTest.kt | 2 +- 9 files changed, 43 insertions(+), 30 deletions(-) diff --git a/sweetspi-tests/src/main/kotlin/TestVersions.kt b/sweetspi-tests/src/main/kotlin/TestVersions.kt index 41094ec..71737c4 100644 --- a/sweetspi-tests/src/main/kotlin/TestVersions.kt +++ b/sweetspi-tests/src/main/kotlin/TestVersions.kt @@ -15,24 +15,37 @@ data class TestVersions( val kspVersion: String, ) +private const val MIN_GRADLE = "8.0.2" +private const val LATEST_GRADLE = "8.12" +private val KSP_VERSIONS = listOf( + "2.0.0-1.0.24", + "2.0.10-1.0.24", + "2.0.21-1.0.28", + "2.1.0-1.0.29", + "2.1.10-RC-1.0.29", + "2.1.20-Beta1-1.0.29", +) + abstract class TestVersionsProvider(private val versions: Sequence) : ArgumentsProvider { constructor(block: suspend SequenceScope.() -> Unit) : this(sequence(block)) override fun provideArguments(context: ExtensionContext?): Stream = versions.map { Arguments.of(it) }.asStream() - object All : TestVersionsProvider({ - listOf( - "8.0.2", // oldest supported - "8.12", // latest stable - ).forEach { gradleVersion -> - listOf( - "2.0.0-1.0.24", // oldest supported - "2.0.10-1.0.24", - "2.0.21-1.0.28", - "2.1.0-1.0.29", - "2.1.10-RC-1.0.29", - "2.1.20-Beta1-1.0.29", - ).forEach { kspVersion -> + class LatestGradle : TestVersionsProvider({ + KSP_VERSIONS.forEach { kspVersion -> + yield( + TestVersions( + gradleVersion = LATEST_GRADLE, + kotlinVersion = kspVersion.substringBeforeLast("-"), + kspVersion = kspVersion + ) + ) + } + }) + + class AllGradle : TestVersionsProvider({ + listOf(MIN_GRADLE, LATEST_GRADLE).forEach { gradleVersion -> + KSP_VERSIONS.forEach { kspVersion -> yield( TestVersions( gradleVersion = gradleVersion, diff --git a/sweetspi-tests/src/testPlugin/kotlin/JvmPluginTest.kt b/sweetspi-tests/src/testPlugin/kotlin/JvmPluginTest.kt index d58f03b..33e8e14 100644 --- a/sweetspi-tests/src/testPlugin/kotlin/JvmPluginTest.kt +++ b/sweetspi-tests/src/testPlugin/kotlin/JvmPluginTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Oleg Yukhnevich. Use of this source code is governed by the Apache 2.0 license. + * Copyright (c) 2024-2025 Oleg Yukhnevich. Use of this source code is governed by the Apache 2.0 license. */ package dev.whyoleg.sweetspi.tests.plugin @@ -13,7 +13,7 @@ class JvmPluginTest : AbstractTest() { override val defaultTemplate: TestTemplate get() = TestTemplate.JVM @ParameterizedTest - @ArgumentsSource(TestVersionsProvider.All::class) + @ArgumentsSource(TestVersionsProvider.AllGradle::class) fun testKspIsExecuted(versions: TestVersions) { val project = project(versions = versions) { withSweetSpi() diff --git a/sweetspi-tests/src/testPlugin/kotlin/MultiplatformJvmPluginTest.kt b/sweetspi-tests/src/testPlugin/kotlin/MultiplatformJvmPluginTest.kt index 05eece2..05950f8 100644 --- a/sweetspi-tests/src/testPlugin/kotlin/MultiplatformJvmPluginTest.kt +++ b/sweetspi-tests/src/testPlugin/kotlin/MultiplatformJvmPluginTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Oleg Yukhnevich. Use of this source code is governed by the Apache 2.0 license. + * Copyright (c) 2024-2025 Oleg Yukhnevich. Use of this source code is governed by the Apache 2.0 license. */ package dev.whyoleg.sweetspi.tests.plugin @@ -12,7 +12,7 @@ class MultiplatformJvmPluginTest : AbstractTest() { override val defaultTemplate: TestTemplate get() = TestTemplate.MULTIPLATFORM @ParameterizedTest - @ArgumentsSource(TestVersionsProvider.All::class) + @ArgumentsSource(TestVersionsProvider.AllGradle::class) fun testJvm(versions: TestVersions) { val project = project(versions = versions) { withSweetSpi() diff --git a/sweetspi-tests/src/testPlugin/kotlin/MultiplatformPluginTest.kt b/sweetspi-tests/src/testPlugin/kotlin/MultiplatformPluginTest.kt index 6d5babf..66ac815 100644 --- a/sweetspi-tests/src/testPlugin/kotlin/MultiplatformPluginTest.kt +++ b/sweetspi-tests/src/testPlugin/kotlin/MultiplatformPluginTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Oleg Yukhnevich. Use of this source code is governed by the Apache 2.0 license. + * Copyright (c) 2024-2025 Oleg Yukhnevich. Use of this source code is governed by the Apache 2.0 license. */ package dev.whyoleg.sweetspi.tests.plugin @@ -12,7 +12,7 @@ class MultiplatformPluginTest : AbstractTest() { override val defaultTemplate: TestTemplate get() = TestTemplate.MULTIPLATFORM @ParameterizedTest - @ArgumentsSource(TestVersionsProvider.All::class) + @ArgumentsSource(TestVersionsProvider.AllGradle::class) fun testAllTargets(versions: TestVersions) { val project = project(versions = versions) { withSweetSpi() diff --git a/sweetspi-tests/src/testProcessor/kotlin/MultiplatformJvmProcessorTest.kt b/sweetspi-tests/src/testProcessor/kotlin/MultiplatformJvmProcessorTest.kt index 74047a5..fc2693b 100644 --- a/sweetspi-tests/src/testProcessor/kotlin/MultiplatformJvmProcessorTest.kt +++ b/sweetspi-tests/src/testProcessor/kotlin/MultiplatformJvmProcessorTest.kt @@ -15,7 +15,7 @@ class MultiplatformJvmProcessorTest : AbstractTest() { override val defaultTemplate: TestTemplate get() = TestTemplate.MULTIPLATFORM @ParameterizedTest - @ArgumentsSource(TestVersionsProvider.All::class) + @ArgumentsSource(TestVersionsProvider.LatestGradle::class) fun testJvmTargetOutput(versions: TestVersions) { val project = project(versions) { withSweetSpi() @@ -42,7 +42,7 @@ class MultiplatformJvmProcessorTest : AbstractTest() { } @ParameterizedTest - @ArgumentsSource(TestVersionsProvider.All::class) + @ArgumentsSource(TestVersionsProvider.LatestGradle::class) fun testJvmProviderNotExtendingService(versions: TestVersions) { val project = project(versions) { withSweetSpi() diff --git a/sweetspi-tests/src/testRuntime/kotlin/JvmRuntimeTest.kt b/sweetspi-tests/src/testRuntime/kotlin/JvmRuntimeTest.kt index b257dc9..cf8e743 100644 --- a/sweetspi-tests/src/testRuntime/kotlin/JvmRuntimeTest.kt +++ b/sweetspi-tests/src/testRuntime/kotlin/JvmRuntimeTest.kt @@ -12,7 +12,7 @@ class JvmRuntimeTest : AbstractTest() { override val defaultTemplate: TestTemplate get() = TestTemplate.JVM @ParameterizedTest - @ArgumentsSource(TestVersionsProvider.All::class) + @ArgumentsSource(TestVersionsProvider.LatestGradle::class) fun testRuntimeWorks(versions: TestVersions) { val project = project(versions) { withSweetSpi() diff --git a/sweetspi-tests/src/testRuntime/kotlin/MultiplatformCrossModuleRuntimeTest.kt b/sweetspi-tests/src/testRuntime/kotlin/MultiplatformCrossModuleRuntimeTest.kt index 74a368e..53643a6 100644 --- a/sweetspi-tests/src/testRuntime/kotlin/MultiplatformCrossModuleRuntimeTest.kt +++ b/sweetspi-tests/src/testRuntime/kotlin/MultiplatformCrossModuleRuntimeTest.kt @@ -12,7 +12,7 @@ class MultiplatformCrossModuleRuntimeTest : AbstractTest() { override val defaultTemplate: TestTemplate get() = TestTemplate.MULTIPLATFORM_MULTIMODULE @ParameterizedTest - @ArgumentsSource(TestVersionsProvider.All::class) + @ArgumentsSource(TestVersionsProvider.LatestGradle::class) fun test3ModulesInteraction(versions: TestVersions) { val project = project(versions = versions) { append(SETTINGS_GRADLE_KTS) { diff --git a/sweetspi-tests/src/testRuntime/kotlin/MultiplatformJvmRuntimeTest.kt b/sweetspi-tests/src/testRuntime/kotlin/MultiplatformJvmRuntimeTest.kt index db0d84c..5ef76bc 100644 --- a/sweetspi-tests/src/testRuntime/kotlin/MultiplatformJvmRuntimeTest.kt +++ b/sweetspi-tests/src/testRuntime/kotlin/MultiplatformJvmRuntimeTest.kt @@ -51,7 +51,7 @@ class MultiplatformJvmRuntimeTest : AbstractTest() { } @ParameterizedTest - @ArgumentsSource(TestVersionsProvider.All::class) + @ArgumentsSource(TestVersionsProvider.LatestGradle::class) fun testSimple(versions: TestVersions) = jvmProject(versions) { jvmMainFile( """ @@ -70,7 +70,7 @@ class MultiplatformJvmRuntimeTest : AbstractTest() { }.runJvmTest() @ParameterizedTest - @ArgumentsSource(TestVersionsProvider.All::class) + @ArgumentsSource(TestVersionsProvider.LatestGradle::class) fun testMultipleServices(versions: TestVersions) = jvmProject(versions) { jvmMainFile( """ @@ -90,7 +90,7 @@ class MultiplatformJvmRuntimeTest : AbstractTest() { }.runJvmTest() @ParameterizedTest - @ArgumentsSource(TestVersionsProvider.All::class) + @ArgumentsSource(TestVersionsProvider.LatestGradle::class) fun testMultipleInheritance(versions: TestVersions) = jvmProject(versions) { jvmMainFile( """ @@ -115,7 +115,7 @@ class MultiplatformJvmRuntimeTest : AbstractTest() { }.runJvmTest() @ParameterizedTest - @ArgumentsSource(TestVersionsProvider.All::class) + @ArgumentsSource(TestVersionsProvider.LatestGradle::class) fun testFunction(versions: TestVersions) = jvmProject(versions) { jvmMainFile( """ @@ -140,7 +140,7 @@ class MultiplatformJvmRuntimeTest : AbstractTest() { }.runJvmTest() @ParameterizedTest - @ArgumentsSource(TestVersionsProvider.All::class) + @ArgumentsSource(TestVersionsProvider.LatestGradle::class) fun testFunctionErrorPropagation(versions: TestVersions) = jvmProject(versions) { jvmMainFile( """ @@ -161,7 +161,7 @@ class MultiplatformJvmRuntimeTest : AbstractTest() { }.runJvmTest() @ParameterizedTest - @ArgumentsSource(TestVersionsProvider.All::class) + @ArgumentsSource(TestVersionsProvider.LatestGradle::class) fun testProperty(versions: TestVersions) = jvmProject(versions) { jvmMainFile( """ diff --git a/sweetspi-tests/src/testRuntime/kotlin/MultiplatformRuntimeTest.kt b/sweetspi-tests/src/testRuntime/kotlin/MultiplatformRuntimeTest.kt index eb1002f..da180d0 100644 --- a/sweetspi-tests/src/testRuntime/kotlin/MultiplatformRuntimeTest.kt +++ b/sweetspi-tests/src/testRuntime/kotlin/MultiplatformRuntimeTest.kt @@ -12,7 +12,7 @@ class MultiplatformRuntimeTest : AbstractTest() { override val defaultTemplate: TestTemplate get() = TestTemplate.MULTIPLATFORM @ParameterizedTest - @ArgumentsSource(TestVersionsProvider.All::class) + @ArgumentsSource(TestVersionsProvider.LatestGradle::class) fun testAllTargets(versions: TestVersions) { val project = project(versions = versions) {