Skip to content

Commit

Permalink
Drop support for older versions of gradle and ktlint
Browse files Browse the repository at this point in the history
increase minimum supported gradle version to 7.4.1
increase minimum supported ktlint version to 0.47.1
support ktlint 1.0.1
remove retry plugin as it is included in enterprise plugin now
upgrade project gradle
update code to utilize kotlin-dsl
fix ktlint errors
upgrade build to gradle 8 and add toolchain resolver
update reporter samples to ktlint 1.0.1
  • Loading branch information
wakingrufus committed Nov 8, 2023
1 parent 0f75ad1 commit 5d0148c
Show file tree
Hide file tree
Showing 64 changed files with 316 additions and 1,333 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

- update latest version text file manually [#716](https://github.com/JLLeitschuh/ktlint-gradle/pull/716)
- Fix configuration cache for relative paths [#722](https://github.com/JLLeitschuh/ktlint-gradle/pull/722)
- Drop support for Gradle 6 and ktlint < 0.47.1 [#720](https://github.com/JLLeitschuh/ktlint-gradle/pull/720)

## [11.6.1] - 2023-10-10

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@ open a [new issue](https://github.com/JLLeitschuh/ktlint-gradle/issues/new).
This plugin was written using the new API available for the Gradle script Kotlin builds.
This API is available in new versions of Gradle.

Minimal supported [Gradle](https://www.gradle.org) version: `6.8`
Minimal supported [Gradle](https://www.gradle.org) version: `7.4`

Minimal supported [Kotlin](https://kotlinlang.org) version: `1.4`

Minimal supported [ktlint](https://github.com/pinterest/ktlint) version: `0.34.0`
(additionally excluding `0.37.0` on Windows OS and `0.38.0`, `0.43.0`, `0.43.1` on all OS types)
Minimal supported [ktlint](https://github.com/pinterest/ktlint) version: `0.47.1`

### Ktlint plugin

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=b586e04868a22fd817c8971330fec37e298f3242eb85c374181b12d637f80302
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
73 changes: 11 additions & 62 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.util.prefixIfNot

plugins {
kotlin("jvm")
id("com.gradle.plugin-publish")
`java-gradle-plugin`
`kotlin-dsl`
`maven-publish`
id("org.jlleitschuh.gradle.ktlint")
id("com.github.johnrengelman.shadow")
id("com.github.breadmoirai.github-release")
id("org.gradle.test-retry")
}

val pluginGroup = "org.jlleitschuh.gradle"
Expand Down Expand Up @@ -60,22 +58,6 @@ configurations["testImplementation"].extendsFrom(shadowImplementation)
sourceSets {
val adapter by creating {
}
val adapter34 by creating {
compileClasspath += adapter.output
}
val adapter34Test by creating {
compileClasspath += adapter.output + adapter34.output
runtimeClasspath += adapter.output + adapter34.output
}
val adapter41 by creating {
compileClasspath += adapter.output
}
val adapter45 by creating {
compileClasspath += adapter.output
}
val adapter46 by creating {
compileClasspath += adapter.output
}
val adapter47 by creating {
compileClasspath += adapter.output
}
Expand All @@ -93,10 +75,6 @@ sourceSets {
}
val adapters = listOf(
adapter,
adapter34,
adapter41,
adapter45,
adapter46,
adapter47,
adapter48,
adapter49,
Expand All @@ -118,10 +96,6 @@ sourceSets {
}
val adapterSources = listOf(
sourceSets.named("adapter"),
sourceSets.named("adapter34"),
sourceSets.named("adapter41"),
sourceSets.named("adapter45"),
sourceSets.named("adapter46"),
sourceSets.named("adapter47"),
sourceSets.named("adapter48"),
sourceSets.named("adapter49"),
Expand All @@ -132,24 +106,11 @@ tasks.named<Jar>("shadowJar") {
this.from(adapterSources.map { sourceSet -> sourceSet.map { it.output.classesDirs } })
}

val test34Task = tasks.register<Test>("test34") {
classpath = sourceSets.named("adapter34Test").get().runtimeClasspath
testClassesDirs = sourceSets.named("adapter34Test").get().output.classesDirs
}
tasks.named("test") {
dependsOn(test34Task)
}

dependencies {
compileOnly(gradleApi())
add("adapterCompileOnly", "com.pinterest.ktlint:ktlint-core:0.34.0")
add("adapterImplementation", libs.commons.io)
add("adapterImplementation", libs.semver)
add("adapter34Implementation", kotlin("reflect"))
add("adapter34CompileOnly", "com.pinterest.ktlint:ktlint-core:0.34.0")
add("adapter41CompileOnly", "com.pinterest.ktlint:ktlint-core:0.41.0")
add("adapter45CompileOnly", "com.pinterest.ktlint:ktlint-core:0.45.2")
add("adapter46CompileOnly", "com.pinterest.ktlint:ktlint-core:0.46.1")

add("adapter47CompileOnly", "com.pinterest.ktlint:ktlint-core:0.47.1")
add("adapter48CompileOnly", "com.pinterest.ktlint:ktlint-core:0.48.2")

Expand Down Expand Up @@ -184,19 +145,11 @@ dependencies {
* https://github.com/JLLeitschuh/ktlint-gradle/issues/9
*/

testImplementation(gradleTestKit())
testImplementation(libs.junit.jupiter)
testImplementation(libs.assertj.core)
testImplementation(libs.kotlin.reflect)
testImplementation(libs.ktlint.core)
testImplementation(libs.archunit.junit5)

add("adapter34TestImplementation", "com.pinterest.ktlint:ktlint-core:0.34.0")
add("adapter34TestImplementation", libs.commons.io)
add("adapter34TestImplementation", gradleTestKit())
add("adapter34TestImplementation", libs.junit.jupiter)
add("adapter34TestImplementation", libs.assertj.core)
add("adapter34TestImplementation", libs.kotlin.reflect)
}

kotlin {
Expand All @@ -212,19 +165,18 @@ kotlin {
}

// Test tasks loods plugin from local maven repository
tasks.named("test").configure {
tasks.named<Test>("test") {
dependsOn("publishToMavenLocal")
}

tasks.withType<Test>().configureEach {
tasks.withType<Test>() {
useJUnitPlatform()
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
doFirst {
logger.lifecycle("maxParallelForks for '$path' is $maxParallelForks")
}
testLogging {
events(
TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED
Expand All @@ -235,13 +187,13 @@ tasks.withType<Test>().configureEach {
showStackTraces = true
}

retry {
val isCiServer = System.getenv().containsKey("CI")
if (isCiServer) {
maxRetries.set(2)
maxFailures.set(10)
}
}
// retry {
// val isCiServer = System.getenv().containsKey("CI")
// if (isCiServer) {
// maxRetries.set(2)
// maxFailures.set(10)
// }
// }
}

val relocateShadowJar = tasks.register<ConfigureShadowRelocation>("relocateShadowJar")
Expand Down Expand Up @@ -392,9 +344,6 @@ pluginBundle {
"ktlintPlugin" {
displayName = "Ktlint Gradle Plugin"
}
"ktlintIdeaPlugin" {
displayName = "Ktlint Gradle IntelliJ Configuration Plugin"
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions plugin/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[versions]
kotlin = "1.5.31"
ktlint = "0.45.2" # last version prior to API changes. we can increase this more once we drop support for the old API.
ktlint = "0.47.1" # last version prior to API changes. we can increase this more once we drop support for the old API.
androidPlugin = "4.1.0"
semver = "1.1.1"
jgit = "5.6.0.201912101111-r"
sl4fj = "1.7.30"
gradleWrapper = "7.3.3"
gradleWrapperSha = "b586e04868a22fd817c8971330fec37e298f3242eb85c374181b12d637f80302"
gradleWrapper = "8.4"
gradleWrapperSha = "3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae"
junit5 = "5.5.2"
assertJ = "3.11.1"
commonsIo = "2.8.0"
Expand Down
4 changes: 2 additions & 2 deletions plugin/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=b586e04868a22fd817c8971330fec37e298f3242eb85c374181b12d637f80302
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 2 additions & 4 deletions plugin/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ pluginManagement {
val latestRelease = file("VERSION_LATEST_RELEASE.txt").readText().trim()
plugins {
id("org.jlleitschuh.gradle.ktlint") version latestRelease
id("org.jetbrains.kotlin.jvm") version "1.9.0"
id("org.jetbrains.kotlin.jvm") version "1.9.10"
id("com.gradle.plugin-publish") version "0.15.0"
`java-gradle-plugin`
`maven-publish`
id("com.github.johnrengelman.shadow") version "7.0.0"
id("com.github.breadmoirai.github-release") version "2.3.7"
id("org.gradle.test-retry") version "1.3.1"
}
}

enableFeaturePreview("VERSION_CATALOGS")

plugins {
`gradle-enterprise`
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}

gradleEnterprise {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 5d0148c

Please sign in to comment.