mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 07:07:37 +01:00
Moves to spotless
This commit is contained in:
42
build.gradle
42
build.gradle
@@ -26,16 +26,9 @@ plugins {
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.9.10' apply false
|
||||
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.10' apply false
|
||||
id 'androidx.benchmark' version '1.1.1' apply false
|
||||
id 'com.diffplug.spotless' version '6.22.0' apply false
|
||||
}
|
||||
|
||||
tasks.register('installGitHook', Copy) {
|
||||
from new File(rootProject.rootDir, 'git-hooks/pre-commit')
|
||||
from new File(rootProject.rootDir, 'git-hooks/pre-push')
|
||||
into { new File(rootProject.rootDir, '.git/hooks') }
|
||||
fileMode 0777
|
||||
}
|
||||
tasks.getByPath(':app:preBuild').dependsOn installGitHook
|
||||
|
||||
subprojects {
|
||||
tasks.withType(KotlinCompile).configureEach {
|
||||
kotlinOptions {
|
||||
@@ -55,4 +48,35 @@ subprojects {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.diffplug.spotless'
|
||||
spotless {
|
||||
kotlin {
|
||||
target '**/*.kt'
|
||||
targetExclude("$buildDir/**/*.kt")
|
||||
|
||||
ktlint("1.1.0")
|
||||
ktfmt().googleStyle()
|
||||
licenseHeaderFile rootProject.file('spotless/copyright.txt'), "package|import|class|object|sealed|open|interface|abstract "
|
||||
}
|
||||
|
||||
groovyGradle {
|
||||
target '*.gradle'
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
tasks.named("preBuild") {
|
||||
dependsOn("spotlessApply")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tasks.register('installGitHook', Copy) {
|
||||
from new File(rootProject.rootDir, 'git-hooks/pre-commit')
|
||||
from new File(rootProject.rootDir, 'git-hooks/pre-push')
|
||||
into { new File(rootProject.rootDir, '.git/hooks') }
|
||||
fileMode 0777
|
||||
}
|
||||
tasks.getByPath(':app:preBuild').dependsOn installGitHook
|
||||
Reference in New Issue
Block a user