Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump kotlin to 1.5.31, bump ktlint to 0.43.2 #597

Merged
merged 2 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]

### Changed

- **Breaking**: minimal supported Gradle version is `6.8` ([#597](https://github.com/JLLeitschuh/ktlint-gradle/pull/597))
- Update Kotlin to `1.5.31` version ([#597](https://github.com/JLLeitschuh/ktlint-gradle/pull/597))
- Set default KtLint version to `0.43.2` ([#597](https://github.com/JLLeitschuh/ktlint-gradle/pull/597))

## [10.3.0] - 2022-05-03

### Added
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ 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.0`
Minimal supported [Gradle](https://www.gradle.org) version: `6.8`

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

### Ktlint plugin

Expand Down Expand Up @@ -566,7 +566,7 @@ To run tests in [IDEA IDE](https://www.jetbrains.com/idea/),
firstly you need to run following gradle task (or after any dependency change):

```bash
$ ./plugin/gradlew pluginUnderTestMetadata
$ ./plugin/gradlew -p ./plugin pluginUnderTestMetadata
```

Optionally you can add this step test run configuration.
Expand Down
4 changes: 2 additions & 2 deletions plugin/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
kotlin = "1.5.21"
ktlint = "0.42.1"
kotlin = "1.5.31"
ktlint = "0.43.2"
androidPlugin = "4.1.0"
semver = "1.1.1"
jgit = "5.6.0.201912101111-r"
Expand Down
2 changes: 1 addition & 1 deletion plugin/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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.5.21"
id("org.jetbrains.kotlin.jvm") version "1.5.31"
id("com.gradle.plugin-publish") version "0.15.0"
`java-gradle-plugin`
`maven-publish`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ open class KtlintBasePlugin : Plugin<Project> {
}

companion object {
const val LOWEST_SUPPORTED_GRADLE_VERSION = "6.0"
const val LOWEST_SUPPORTED_GRADLE_VERSION = "6.8"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this consistent with the Android Gradle Plugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I am not sure what you mean, but we need at least 6.8 version of gradle to make it work with ktlint 0.43.2.
Here is the table
image

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal constructor(
/**
* The version of KtLint to use.
*/
val version: Property<String> = objectFactory.property { set("0.42.1") }
val version: Property<String> = objectFactory.property { set("0.43.2") }

/**
* Enable relative paths in reports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,11 @@ import org.jlleitschuh.gradle.ktlint.testdsl.build
import org.jlleitschuh.gradle.ktlint.testdsl.project
import org.junit.jupiter.api.DisplayName

@GradleTestVersions(minVersion = "6.6.1")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer needed, because min gradle version is 6.8

@GradleTestVersions
class ConfigurationCacheTest : AbstractPluginTest() {
private val configurationCacheFlag = "--configuration-cache"
private val configurationCacheWarnFlag = "--configuration-cache-problems=warn"

/**
* 2 warnings are still reported by the Kotlin plugin. We can't fix them.
* But make sure we aren't creating more issues.
* ```
* 2 problems were found storing the configuration cache, 1 of which seems unique.
* plugin 'org.jetbrains.kotlin.jvm': registration of listener on 'Gradle.addBuildListener' is unsupported
* See https://docs.gradle.org/6.6-milestone-3/userguide/configuration_cache.html#config_cache:requirements:build_listeners
* ```
*/
private val maxProblemsFlag = "-Dorg.gradle.unsafe.configuration-cache.max-problems=2"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if it is still applicable, I run the tests with the value set to 0 and everything worked correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to restore and set the value to 0?


@DisplayName("Should support configuration cache without errors on running linting")
@CommonTest
internal fun configurationCacheForCheckTask(gradleVersion: GradleVersion) {
Expand All @@ -34,14 +23,13 @@ class ConfigurationCacheTest : AbstractPluginTest() {
"src/main/kotlin/clean-source.kt",
"""
val foo = "bar"

""".trimIndent()
)

build(
configurationCacheFlag,
configurationCacheWarnFlag,
maxProblemsFlag,
CHECK_PARENT_TASK_NAME
) {
assertThat(task(":$mainSourceSetCheckTaskName")?.outcome).isEqualTo(TaskOutcome.SUCCESS)
Expand All @@ -50,7 +38,6 @@ class ConfigurationCacheTest : AbstractPluginTest() {
build(
configurationCacheFlag,
configurationCacheWarnFlag,
maxProblemsFlag,
CHECK_PARENT_TASK_NAME
) {
assertThat(task(":$mainSourceSetCheckTaskName")?.outcome).isEqualTo(TaskOutcome.UP_TO_DATE)
Expand All @@ -74,7 +61,6 @@ class ConfigurationCacheTest : AbstractPluginTest() {
build(
configurationCacheFlag,
configurationCacheWarnFlag,
maxProblemsFlag,
FORMAT_PARENT_TASK_NAME
) {
assertThat(task(":$formatTaskName")?.outcome).isEqualTo(TaskOutcome.SUCCESS)
Expand All @@ -84,7 +70,6 @@ class ConfigurationCacheTest : AbstractPluginTest() {
build(
configurationCacheFlag,
configurationCacheWarnFlag,
maxProblemsFlag,
FORMAT_PARENT_TASK_NAME
) {
assertThat(task(":$formatTaskName")?.outcome).isEqualTo(TaskOutcome.SUCCESS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class KtLintSupportedVersionsTest : AbstractPluginTest() {
//language=Groovy
buildGradle.appendText(
"""

ktlint.version = "$ktLintVersion"
""".trimIndent()
)
Expand All @@ -56,9 +56,9 @@ class KtLintSupportedVersionsTest : AbstractPluginTest() {
//language=Groovy
buildGradle.appendText(
"""

ktlint.version = "$ktLintVersion"

""".trimIndent()
)

Expand All @@ -82,7 +82,7 @@ class KtLintSupportedVersionsTest : AbstractPluginTest() {
buildGradle.appendText(
"""
ktlint.version = "$ktLintVersion"

""".trimIndent()
)

Expand All @@ -108,7 +108,10 @@ class KtLintSupportedVersionsTest : AbstractPluginTest() {
"0.40.0",
"0.41.0",
"0.42.0",
"0.42.1"
"0.42.1",
// "0.43.0" does not work on JDK1.8
// "0.43.1" asked not to use it
"0.43.2",
).also {
// "0.37.0" is failing on Windows machines that is fixed in the next version
if (!OS.WINDOWS.isCurrentOs) it.add("0.37.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ class KtlintPluginTest : AbstractPluginTest() {
)

build(":dependencies", "--configuration", KTLINT_RULESET_CONFIGURATION_NAME) {
assertThat(output).contains("com.pinterest.ktlint:ktlint-core:0.34.2 -> 0.42.1")
assertThat(output).contains("com.pinterest.ktlint:ktlint-core:0.34.2 -> 0.43.2")
}
}
}
Expand All @@ -610,7 +610,7 @@ class KtlintPluginTest : AbstractPluginTest() {
)

build(":dependencies", "--configuration", KTLINT_REPORTER_CONFIGURATION_NAME) {
assertThat(output).contains("com.pinterest.ktlint:ktlint-core:0.34.2 -> 0.42.1")
assertThat(output).contains("com.pinterest.ktlint:ktlint-core:0.34.2 -> 0.43.2")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object TestVersions {
const val maxSupportedGradleVersion = "7.1.1"
val pluginVersion = File("VERSION_CURRENT.txt").readText().trim()
const val minSupportedKotlinPluginVersion = "1.4.32"
const val maxSupportedKotlinPluginVersion = "1.5.21"
const val maxSupportedKotlinPluginVersion = "1.5.31"
}

@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CLASS)
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pluginManagement {
includeBuild("./plugin")

plugins {
id("org.jetbrains.kotlin.jvm") version "1.5.21"
id("org.jetbrains.kotlin.js") version "1.5.21"
id("org.jetbrains.kotlin.jvm") version "1.5.31"
id("org.jetbrains.kotlin.js") version "1.5.31"
}

repositories {
Expand Down