import com.dropbox.affectedmoduledetector.AffectedModuleConfiguration
import com.dropbox.sample.Dependencies

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        mavenLocal()
    }
    dependencies {
        classpath Dependencies.Libs.ANDROID_BUILD_TOOLS
        classpath Dependencies.Libs.KOTLIN_GRADLE_PLUGIN
        classpath Dependencies.Libs.KTLINT
        classpath Dependencies.Libs.DETEKT
    }
}

apply plugin: "org.jlleitschuh.gradle.ktlint"
apply plugin: "com.dropbox.affectedmoduledetector"

affectedModuleDetector {
    baseDir = "${project.rootDir}"
    pathsAffectingAllModules = [
            "buildSrc/"
    ]
    specifiedBranch = "origin/main"
    compareFrom = "SpecifiedBranchCommitMergeBase"
    customTasks = [
            new AffectedModuleConfiguration.CustomTask(
                    "runDetektByImpact",
                    "detekt",
                    "Run static analysis tool by Impact analysis"
            )
    ]
    logFolder = "${project.rootDir}"
    excludedModules = [
            "sample-util"
    ]
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
