Files
amethyst/build.gradle
T
Vitor Pamplona f108ba9050 - Spotless 8.4.0 with ktlint() (no version pinned) was resolving ktlint 1.8.0.
- ktlint 1.8.0 changed how rule providers are loaded, and spotless 8.4.0 ends up handing the engine an empty ruleProviders set — so every file fails with IllegalArgumentException: A non-empty set of 'ruleProviders' need to be provided.
2026-05-16 12:43:40 -04:00

85 lines
2.6 KiB
Groovy

plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.jetbrainsKotlinJvm) apply false
alias(libs.plugins.androidBenchmark) apply false
alias(libs.plugins.diffplugSpotless)
alias(libs.plugins.googleServices) apply false
alias(libs.plugins.jetbrainsComposeCompiler) apply false
alias(libs.plugins.composeMultiplatform) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.androidKotlinMultiplatformLibrary) apply false
alias(libs.plugins.serialization)
}
// Shared app version for all subprojects — read from gradle/libs.versions.toml.
// Android versionCode stays local in amethyst/build.gradle (must be monotonic int).
// Desktop packageVersion inherits via project.version in desktopApp/build.gradle.kts.
allprojects {
version = libs.versions.app.get()
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
apply plugin: 'com.diffplug.spotless'
if (project === rootProject) {
spotless {
predeclareDeps()
}
spotlessPredeclare {
kotlin {
ktlint('1.7.1')
}
}
} else {
spotless {
kotlin {
target 'src/**/*.kt'
ktlint('1.7.1')
licenseHeaderFile rootProject.file('.spotless/copyright.kt'), "@file:|package|import|class|object|sealed|open|interface|abstract "
}
groovyGradle {
target '*.gradle'
}
}
}
}
subprojects {
afterEvaluate {
try {
tasks.named("preBuild") {
dependsOn("spotlessApply")
}
} catch (UnknownTaskException ignored) {
tasks.matching {
it.name.startsWith("pre") && it.name.endsWith("Build")
}.configureEach {
dependsOn("spotlessApply")
}
}
}
}
tasks.register('installGitHook', Copy) {
def dotGit = new File(rootProject.rootDir, '.git')
def hooksDir
if (dotGit.isFile()) {
// Git worktree: .git is a file with "gitdir: <path>"
def gitDir = new File(dotGit.text.trim().replace('gitdir: ', ''))
hooksDir = new File(gitDir, 'hooks')
} else {
hooksDir = new File(dotGit, 'hooks')
}
from new File(rootProject.rootDir, '.git-hooks/pre-commit')
from new File(rootProject.rootDir, '.git-hooks/pre-push')
into { hooksDir }
filePermissions { unix(0777) }
}
tasks.getByPath(':amethyst:preBuild').dependsOn installGitHook