buildscript {
    dependencies {
        classpath "com.google.dagger:hilt-android-gradle-plugin:${Versions.hilt}"
        classpath("com.diffplug.spotless:spotless-plugin-gradle:${Versions.spotless}")
    }
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '8.6.1' apply false
    id 'com.android.library' version '8.6.1' apply false
    id 'org.jetbrains.kotlin.android' version '2.1.0' apply false
    id 'org.jetbrains.kotlin.plugin.compose' version '2.1.0' apply false
    id 'com.google.devtools.ksp' version "2.1.0-1.0.29" apply false
    id 'com.diffplug.spotless' version '7.2.1' apply false
}

apply from: "$project.rootDir/spotless.gradle"

tasks.register('createSpotlessPreCommitHook') {
    def gitHooksDirectory = new File("$project.rootDir/.git/hooks/")
    if (!gitHooksDirectory.exists()) gitHooksDirectory.mkdirs()
    new File("$project.rootDir/.git/hooks", "pre-commit").text = """
    #!/bin/bash
    echo "Running spotless check"
    ./gradlew spotlessApply
"""
    "chmod +x .git/hooks/pre-commit".execute()
}
