import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
    apply from: 'gradle/dependencies.gradle'

    repositories {
        mavenCentral()
        google()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath deps.build.gradlePlugins.android
        classpath deps.build.gradlePlugins.kotlin
        classpath deps.build.gradlePlugins.detekt
        classpath deps.build.gradlePlugins.jacoco
    }
}

apply from: 'gradle/dependencies.gradle'
apply from: 'gradle/utils.gradle'

subprojects {
    buildscript {
        repositories {
            mavenCentral()
            maven { url deps.build.gradlePluginsUrl }
            google()

            maven {
                url "https://dl.bintray.com/kotlin/kotlin-eap/"
            }
        }
    }

    repositories {
        mavenCentral()
        maven { url deps.build.gradlePluginsUrl }
        google()
        maven { url "https://www.jitpack.io" }
    }

    configurations.configureEach {
        resolutionStrategy.eachDependency {
        }
    }
    tasks.withType(KotlinCompile).configureEach {
        compilerOptions {
            jvmTarget = JvmTarget.JVM_11
            freeCompilerArgs.add("-Xopt-in=com.badoo.ribs.annotation.ExperimentalApi")
        }
    }
}

configureDetektForAllSubprojects(project)

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