Add spotless plugin for code formatting and rule for Kotlin sources

This commit is contained in:
Wolf Montwe 2023-02-03 16:49:14 +01:00
parent 697f201c15
commit 713dbf9462
No known key found for this signature in database
GPG key ID: 24A05D13287F876F
2 changed files with 15 additions and 1 deletions

View file

@ -11,6 +11,7 @@ plugins {
alias(libs.plugins.kotlin.parcelize) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.ktlint) apply false
alias(libs.plugins.spotless)
}
project.ext {
@ -101,6 +102,17 @@ allprojects {
}
}
spotless {
kotlin {
ktlint(libs.versions.ktlint.get())
.setEditorConfigPath("$projectDir/.editorconfig")
target("**/*.kt")
targetExclude("**/build/", "**/resources/")
trimTrailingWhitespace()
endWithNewline()
}
}
tasks.register('testsOnCi') {
dependsOn getSubprojects()
.collect { project -> project.tasks.withType(Test) }

View file

@ -3,7 +3,8 @@
[versions]
androidGradlePlugin = "7.4.0"
ktlint = "0.44.0"
ktlint = "0.47.1"
spotless = "6.14.0"
kotlin = "1.8.0"
kotlinCoroutines = "1.6.4"
@ -39,6 +40,7 @@ kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
ktlint = "org.jlleitschuh.gradle.ktlint:11.0.0"
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
[libraries]
desugar = "com.android.tools:desugar_jdk_libs:1.1.8"