Skip to content

Commit

Permalink
solves build slowdown on spotless dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorpamplona committed Jul 9, 2024
1 parent aa4e6c0 commit 2a9e1bb
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,47 @@ plugins {
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.jetbrainsKotlinJvm) apply false
alias(libs.plugins.androidBenchmark) apply false
alias(libs.plugins.diffplugSpotless) apply false
alias(libs.plugins.diffplugSpotless)
alias(libs.plugins.googleServices) apply false
alias(libs.plugins.jetbrainsComposeCompiler) apply false
}

subprojects {
allprojects {
apply plugin: 'com.diffplug.spotless'
spotless {
kotlin {
target '**/*.kt'
targetExclude("$layout.buildDirectory/**/*.kt")

ktlint("1.3.1")
licenseHeaderFile rootProject.file('spotless/copyright.kt'), "package|import|class|object|sealed|open|interface|abstract "
if (project === rootProject) {
spotless {
predeclareDeps()
}

groovyGradle {
target '*.gradle'
spotlessPredeclare {
kotlin {
ktlint("1.3.1")
}
}
} else {
spotless {
kotlin {
target '**/*.kt'
targetExclude("$layout.buildDirectory/**/*.kt")

ktlint("1.3.1")
licenseHeaderFile rootProject.file('spotless/copyright.kt'), "package|import|class|object|sealed|open|interface|abstract "
}

afterEvaluate {
tasks.named("preBuild") {
dependsOn("spotlessApply")
groovyGradle {
target '*.gradle'
}
}
}
}

subprojects {
afterEvaluate {
tasks.named("preBuild") {
dependsOn("spotlessApply")
}
}
}

tasks.register('installGitHook', Copy) {
from new File(rootProject.rootDir, 'git-hooks/pre-commit')
Expand Down

0 comments on commit 2a9e1bb

Please sign in to comment.