Change Spotless configuration to build-plugin

This commit is contained in:
Wolf Montwé 2023-02-13 17:18:33 +01:00
parent 557bf1dcc7
commit 2967e933e4
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
4 changed files with 33 additions and 25 deletions

View file

@ -4,6 +4,8 @@ plugins {
dependencies {
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
implementation(plugin(libs.plugins.spotless))
}
fun plugin(provider: Provider<PluginDependency>) = with(provider.get()) {

View file

@ -0,0 +1,28 @@
import com.diffplug.gradle.spotless.SpotlessExtension
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id("com.diffplug.spotless")
}
configure<SpotlessExtension> {
kotlin {
ktlint(libs.versions.ktlint.get())
target("**/*.kt")
targetExclude("**/build/", "**/resources/", "plugins/openpgp-api-lib/")
}
kotlinGradle {
ktlint(libs.versions.ktlint.get())
target("**/*.gradle.kts")
targetExclude("**/build/")
}
format("markdown") {
prettier()
target("**/*.md")
targetExclude("plugins/openpgp-api-lib/")
}
format("misc") {
target("**/*.gradle", "**/.gitignore")
trimTrailingWhitespace()
}
}

View file

@ -11,7 +11,8 @@ plugins {
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.parcelize) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.spotless)
id("app.k9mail.gradle.plugin.quality.spotless")
}
val propertyTestCoverage: String? by extra
@ -114,28 +115,6 @@ allprojects {
}
}
spotless {
kotlin {
ktlint(libs.versions.ktlint.get())
target("**/*.kt")
targetExclude("**/build/", "**/resources/", "plugins/openpgp-api-lib/")
}
kotlinGradle {
ktlint(libs.versions.ktlint.get())
target("**/*.gradle.kts")
targetExclude("**/build/")
}
format("markdown") {
prettier()
target("**/*.md")
targetExclude("plugins/openpgp-api-lib/")
}
format("misc") {
target("**/*.gradle", "**/.gitignore")
trimTrailingWhitespace()
}
}
tasks.register("testsOnCi") {
dependsOn(
subprojects.map { project -> project.tasks.withType(Test::class.java) }

View file

@ -4,7 +4,6 @@
[versions]
androidGradlePlugin = "7.4.0"
ktlint = "0.47.1"
spotless = "6.14.0"
kotlin = "1.8.0"
kotlinCoroutines = "1.6.4"
@ -39,7 +38,7 @@ ksp = "com.google.devtools.ksp:1.8.0-1.0.8"
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" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
spotless = "com.diffplug.spotless:6.14.0"
[libraries]
desugar = "com.android.tools:desugar_jdk_libs:1.1.8"