diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d27dfa5ae91..2f14fe0710bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,6 +53,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Configure JDK uses: actions/setup-java@v3 diff --git a/build.gradle.kts b/build.gradle.kts index 4bed6247ac13..4aad022ff071 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,4 @@ +import com.diffplug.gradle.spotless.SpotlessExtension import com.vanniktech.maven.publish.MavenPublishBaseExtension import com.vanniktech.maven.publish.SonatypeHost import java.net.URL @@ -69,7 +70,6 @@ subprojects { if (project.name == "regression-test") return@subprojects apply(plugin = "checkstyle") - apply(plugin = "com.diffplug.spotless") apply(plugin = "ru.vyarus.animalsniffer") apply(plugin = "biz.aQute.bnd.builder") @@ -173,6 +173,23 @@ subprojects { } } + apply(plugin = "com.diffplug.spotless") + configure { + ratchetFrom("origin/master") + kotlin { + target("**/*.kt") + ktlint(libs.versions.ktlint.get()).userData( + mapOf( + "indent_size" to "2", + "disabled_rules" to "filename" + ) + ) + trimTrailingWhitespace() + endWithNewline() + } + } + + tasks.withType { sourceCompatibility = JavaVersion.VERSION_1_8.toString() targetCompatibility = JavaVersion.VERSION_1_8.toString() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 37ddf11eeb66..3f2372603c98 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,6 +10,7 @@ org-conscrypt = "2.5.2" org-jetbrains-kotlin = "1.6.10" org-junit-jupiter = "5.8.2" picocli = "4.6.3" +ktlint = "0.44.0" [libraries] amazonCorretto = "software.amazon.cryptools:AmazonCorrettoCryptoProvider:1.6.1"