Skip to content

Commit 738fc09

Browse files
committed
test against newest kotlin, gradle, ktlint, and AGP versions
drop testing for gradle 7.4 and 7.5 because they cause our tests with kotlin 2.x to fail, but the plugin will still work in those gradle versions if kotlin 1.x is being used
1 parent d10a065 commit 738fc09

File tree

6 files changed

+11
-61
lines changed

6 files changed

+11
-61
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
88
## [Unreleased]
99

1010
- Update Gradle wrapper and Gradle versions for testing. [#819](https://github.com/JLLeitschuh/ktlint-gradle/pull/819)
11+
- test against newest kotlin, gradle, ktlint, and AGP versions [#833](https://github.com/JLLeitschuh/ktlint-gradle/pull/833). Drop testing for gradle 7.4 and 7.5 because they cause our tests with kotlin 2.x to fail, but the plugin will still work in those gradle versions if kotlin 1.x is being used
1112

1213
## [12.1.2] - 2024-11-25
1314

plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/KtlintBasePlugin.kt

+1-18
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package org.jlleitschuh.gradle.ktlint
22

33
import org.gradle.api.Action
4-
import org.gradle.api.GradleException
54
import org.gradle.api.Plugin
65
import org.gradle.api.Project
76
import org.gradle.api.Task
87
import org.gradle.api.file.ConfigurableFileTree
98
import org.gradle.api.tasks.util.PatternFilterable
10-
import org.gradle.util.GradleVersion
119
import org.jlleitschuh.gradle.ktlint.reporter.CustomReporter
1210
import org.jlleitschuh.gradle.ktlint.tasks.BaseKtLintCheckTask
1311
import org.jlleitschuh.gradle.ktlint.tasks.KtLintCheckTask
@@ -23,8 +21,6 @@ open class KtlintBasePlugin : Plugin<Project> {
2321
internal lateinit var extension: KtlintExtension
2422

2523
override fun apply(target: Project) {
26-
target.checkMinimalSupportedGradleVersion()
27-
2824
val filterTargetApplier: FilterApplier = {
2925
target.tasks.withType(BaseKtLintCheckTask::class.java).configureEach(it)
3026
}
@@ -54,20 +50,7 @@ open class KtlintBasePlugin : Plugin<Project> {
5450
)
5551
}
5652

57-
/**
58-
* @deprecated Now that we declare gradle API metadata, this code should not be needed.
59-
* Ee need to check which version of gradle introduced gradle API metadata checking
60-
*/
61-
@Deprecated("Now that we declare gradle API metadata, this code should not be needed")
62-
private fun Project.checkMinimalSupportedGradleVersion() {
63-
if (GradleVersion.version(gradle.gradleVersion) < GradleVersion.version(LOWEST_SUPPORTED_GRADLE_VERSION)) {
64-
throw GradleException(
65-
"Current version of plugin supports minimal Gradle version: $LOWEST_SUPPORTED_GRADLE_VERSION"
66-
)
67-
}
68-
}
69-
7053
companion object {
71-
const val LOWEST_SUPPORTED_GRADLE_VERSION = "7.4.2"
54+
const val LOWEST_SUPPORTED_GRADLE_VERSION = "7.6.3"
7255
}
7356
}

plugin/src/test/kotlin/org/jlleitschuh/gradle/ktlint/KtLintSupportedVersionsTest.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ class KtLintSupportedVersionsTest : AbstractPluginTest() {
180180
"0.50.0",
181181
"1.0.1",
182182
"1.1.1",
183-
"1.2.1"
183+
"1.2.1",
184+
"1.3.1",
185+
"1.4.1",
186+
"1.5.0"
184187
)
185188

186189
override fun provideArguments(

plugin/src/test/kotlin/org/jlleitschuh/gradle/ktlint/UnsupportedGradleTest.kt

-36
This file was deleted.

plugin/src/test/kotlin/org/jlleitschuh/gradle/ktlint/android/KtlintPluginAndroidTest.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,8 @@ class KtlintPluginAndroidTest : AbstractPluginTest() {
8080
"0.47.1",
8181
maximumJava = 17
8282
),
83-
GRADLE_7_5_AGP_7_4(
84-
// AGP 7.4 requires Gradle 7.5
85-
GradleVersion.version("7.5"),
83+
AGP_7_4(
84+
GradleVersion.version(TestVersions.minSupportedGradleVersion),
8685
"7.4.2",
8786
// AGP 4.1 requires kotlin 1.5.20
8887
"1.5.20",

plugin/src/test/kotlin/org/jlleitschuh/gradle/ktlint/testdsl/TestAnnotations.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import kotlin.streams.asStream
1212
@Suppress("ConstPropertyName")
1313
object TestVersions {
1414
const val minSupportedGradleVersion = KtlintBasePlugin.LOWEST_SUPPORTED_GRADLE_VERSION
15-
const val maxSupportedGradleVersion = "8.11.1"
15+
const val maxSupportedGradleVersion = "8.12.1"
1616
val pluginVersion = File("VERSION_CURRENT.txt").readText().trim()
1717
const val minSupportedKotlinPluginVersion = "1.4.32"
18-
const val maxSupportedKotlinPluginVersion = "1.9.23"
18+
const val maxSupportedKotlinPluginVersion = "2.1.10"
1919
const val minAgpVersion = "4.1.0"
20-
const val maxAgpVersion = "8.4.0"
20+
const val maxAgpVersion = "8.8.0"
2121
}
2222

2323
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CLASS)

0 commit comments

Comments
 (0)