Skip to content

Commit

Permalink
Test with Gradle 8.0.1 and Kotlin 1.8.10
Browse files Browse the repository at this point in the history
  • Loading branch information
tadfisher committed Feb 24, 2023
1 parent 67544e4 commit 1660fc7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class KotlinJsPluginTests : AbstractPluginTest() {
"""
kotlin {
js {
js(IR) {
nodejs()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class KtlintIdeaPluginTest : AbstractPluginTest() {
mavenLocal()
gradlePluginPortal()
}
plugins {
id 'org.jetbrains.kotlin.jvm' version '${TestVersions.maxSupportedKotlinPluginVersion}'
id 'org.jetbrains.kotlin.jvm' version '${TestVersions.maxSupportedKotlinPluginVersion()}'
id 'org.jlleitschuh.gradle.ktlint-idea' version '${TestVersions.pluginVersion}'
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
package org.jlleitschuh.gradle.ktlint.testdsl

import java.io.File
import java.util.stream.Stream
import kotlin.streams.asStream
import org.gradle.util.GradleVersion
import org.jetbrains.kotlin.utils.addToStdlib.cast
import org.jlleitschuh.gradle.ktlint.KtlintBasePlugin
import org.junit.jupiter.api.extension.ExtensionContext
import org.junit.jupiter.params.provider.Arguments
import org.junit.jupiter.params.provider.ArgumentsProvider
import java.io.File
import java.util.stream.Stream
import kotlin.streams.asStream

object TestVersions {
const val minSupportedGradleVersion = KtlintBasePlugin.LOWEST_SUPPORTED_GRADLE_VERSION
const val maxSupportedGradleVersion = "7.6"
const val maxSupportedGradleVersion = "8.0.1"
val pluginVersion = File("VERSION_CURRENT.txt").readText().trim()
const val minSupportedKotlinPluginVersion = "1.4.32"
const val maxSupportedKotlinPluginVersion = "1.5.31"

fun maxSupportedKotlinPluginVersion(
gradleVersion: GradleVersion = GradleVersion.version(maxSupportedGradleVersion)
): String = when (gradleVersion) {
in (GradleVersion.version("6.8.3")..GradleVersion.version(maxSupportedGradleVersion)) -> "1.8.10"
in (GradleVersion.version("6.7.1")..GradleVersion.version("7.1.1")) -> "1.7.21"
else -> minSupportedKotlinPluginVersion
}
}

@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CLASS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,7 @@ fun defaultProjectSetup(gradleVersion: GradleVersion): (File) -> Unit =
projectSetup("jvm", gradleVersion)

private val GradleVersion.supportedKotlinVersion
get() = if (this <= GradleVersion.version("6.1.1")) {
TestVersions.minSupportedKotlinPluginVersion
} else {
TestVersions.maxSupportedKotlinPluginVersion
}
get() = TestVersions.maxSupportedKotlinPluginVersion(this)

fun projectSetup(
kotlinPluginType: String,
Expand Down

0 comments on commit 1660fc7

Please sign in to comment.