Skip to content

Commit

Permalink
Kotlinter 4.2.0 (#360)
Browse files Browse the repository at this point in the history
* Kotlinter 4.1.2

- Upgrade to ktlint 1.1.1
- Upgrade to JDK 21
- Bump some GitHub action versions
- Upgrade a few libraries to latest except Mockito Kotlin which isn't compatible

* Fix compatibility matri
  • Loading branch information
jeremymailen authored Jan 14, 2024
1 parent 707c219 commit aec6e30
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 43 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
java-version: 21

- name: Gradle wrapper validation
uses: gradle/wrapper-validation-action@859c33240bd026ce8d5f711f5adcc65c2f8eafc1 # https://github.com/gradle/wrapper-validation-action/issues/66
Expand All @@ -38,7 +38,7 @@ jobs:

- name: Upload test results
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}
path: "${{ github.workspace }}/**/build/reports/tests"
Expand All @@ -50,7 +50,7 @@ jobs:
matrix:
os: [ ubuntu-latest, windows-latest ]
gradle: [ 8.4, current, release-candidate ]
java: [ 11, 17, 19 ]
java: [ 11, 17, 21 ]

name: '[${{ matrix.os }}] Gradle: ${{ matrix.gradle }}, Java: ${{ matrix.java }}'
steps:
Expand All @@ -59,7 +59,7 @@ jobs:
fetch-depth: 0

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
Expand All @@ -78,7 +78,7 @@ jobs:
- name: Upload reports
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: "test-project-reports-${{ matrix.os }}-${{ matrix.gradle }}-${{ matrix.java }}"
path: "${{ github.workspace }}/**/build/reports/ktlint"
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
fail-fast: false
matrix:
gradle: [ current ]
java: [ 17 ]
java: [ 21 ]
agp: ${{ fromJSON(needs.provide-agp-version-matrix.outputs.agp-versions) }}

name: '[android] Gradle: ${{ matrix.gradle }}, Java: ${{ matrix.java }}, AGP: ${{ matrix.agp }}'
Expand All @@ -117,7 +117,7 @@ jobs:
fetch-depth: 0

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
Expand All @@ -137,7 +137,7 @@ jobs:
- name: Upload reports
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: "test-project-android-reports-${{ matrix.gradle }}-${{ matrix.java }}-${{ matrix.agp }}"
path: "${{ github.workspace }}/**/build/reports/ktlint"
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
java-version: 21

- name: Gradle wrapper validation
uses: gradle/wrapper-validation-action@v1
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Available on the Gradle Plugins Portal: https://plugins.gradle.org/plugin/org.jm

```kotlin
plugins {
id("org.jmailen.kotlinter") version "4.1.1"
id("org.jmailen.kotlinter") version "4.2.0"
}
```

Expand All @@ -31,7 +31,7 @@ plugins {

```groovy
plugins {
id "org.jmailen.kotlinter" version "4.1.1"
id "org.jmailen.kotlinter" version "4.2.0"
}
```

Expand All @@ -45,7 +45,7 @@ Root `build.gradle.kts`

```kotlin
plugins {
id("org.jmailen.kotlinter") version "4.1.1" apply false
id("org.jmailen.kotlinter") version "4.2.0" apply false
}
```

Expand All @@ -65,7 +65,7 @@ Root `build.gradle`

```groovy
plugins {
id 'org.jmailen.kotlinter' version "4.1.1" apply false
id 'org.jmailen.kotlinter' version "4.2.0" apply false
}
```

Expand All @@ -83,6 +83,7 @@ plugins {

| kotlinter version | min kotlin version | max kotlin version | min gradle version |
|-------------------|--------------------|--------------------|--------------------|
| 4.2.0+ | 1.9.20 | - | 8.4 |
| 4.0.0+ | 1.9.0 | - | 7.6 |
| 3.14.0+ | 1.8.0 | 1.8.22 | 7.6 |
| 3.11.0+ | 1.7.0 | 1.7.22 | 7.0 |
Expand Down
34 changes: 17 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.9.20"
kotlin("jvm") version "1.9.22"
id("com.gradle.plugin-publish") version "1.1.0"
`java-gradle-plugin`
`maven-publish`
id("org.jmailen.kotlinter") version "4.1.0"
id("org.jmailen.kotlinter") version "4.1.1"
idea
}

Expand All @@ -20,15 +20,15 @@ val githubUrl = "https://github.com/jeremymailen/kotlinter-gradle"
val webUrl = "https://github.com/jeremymailen/kotlinter-gradle"
val projectDescription = "Lint and formatting for Kotlin using ktlint with configuration-free setup on JVM and Android projects"

version = "4.1.1"
version = "4.2.0"
group = "org.jmailen.gradle"
description = projectDescription

object Versions {
const val androidTools = "7.3.1"
const val junit = "5.9.3"
const val ktlint = "1.0.1"
const val mockitoKotlin = "4.1.0"
const val ANDROID_TOOLS = "7.3.1"
const val JUNIT = "5.10.1"
const val KTLINT = "1.1.1"
const val MOCKITO_KOTLIN = "4.1.0"
}

configurations {
Expand All @@ -51,7 +51,7 @@ configurations {

dependencies {
compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin")
compileOnly("com.android.tools.build:gradle:${Versions.androidTools}")
compileOnly("com.android.tools.build:gradle:${Versions.ANDROID_TOOLS}")

listOf(
"ktlint-rule-engine",
Expand All @@ -62,20 +62,20 @@ dependencies {
"ktlint-cli-reporter-html",
"ktlint-cli-reporter-plain",
"ktlint-cli-reporter-sarif",
"ktlint-ruleset-standard"
"ktlint-ruleset-standard",
).forEach { module ->
implementation("com.pinterest.ktlint:$module:${Versions.ktlint}")
implementation("com.pinterest.ktlint:$module:${Versions.KTLINT}")
}

testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Versions.junit}")
testImplementation("org.junit.jupiter:junit-jupiter-api:${Versions.junit}")
testImplementation("org.junit.jupiter:junit-jupiter-params:${Versions.junit}")
testImplementation("commons-io:commons-io:2.12.0")
testImplementation("org.mockito.kotlin:mockito-kotlin:${Versions.mockitoKotlin}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}")
testImplementation("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT}")
testImplementation("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT}")
testImplementation("commons-io:commons-io:2.15.1")
testImplementation("org.mockito.kotlin:mockito-kotlin:${Versions.MOCKITO_KOTLIN}")
}

kotlin {
jvmToolchain(17)
jvmToolchain(21)
}

tasks {
Expand Down Expand Up @@ -115,7 +115,7 @@ tasks {
}

wrapper {
gradleVersion = "8.4"
gradleVersion = "8.5"
}
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion 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
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
17 changes: 9 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -144,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -201,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
2 changes: 1 addition & 1 deletion test-project-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("android") version "1.9.10"
kotlin("android") version "1.9.20"
id("com.android.library")
id("org.jmailen.kotlinter")
}
Expand Down
2 changes: 1 addition & 1 deletion test-project/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
plugins {
kotlin("jvm") version "1.9.10"
kotlin("jvm") version "1.9.20"
id("org.jmailen.kotlinter")
}

0 comments on commit aec6e30

Please sign in to comment.