// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: 'dependencies.gradle'

buildscript {
  ext.kotlin_version = '1.3.61'

  repositories {
    google()
    jcenter()
    maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.6.0'
    classpath 'com.google.gms:google-services:4.3.3'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
  }
}

allprojects {
  repositories {
    mavenCentral()
    google()
    maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
    jcenter()
  }

  plugins.withType(com.android.build.gradle.BasePlugin).configureEach { plugin ->
    plugin.extension.compileOptions {
      sourceCompatibility = JavaVersion.VERSION_1_8
      targetCompatibility = JavaVersion.VERSION_1_8
    }
  }

  tasks.withType(JavaCompile).configureEach { task ->
    task.sourceCompatibility = JavaVersion.VERSION_1_8
    task.targetCompatibility = JavaVersion.VERSION_1_8
  }

  tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile).configureEach { task ->
    task.kotlinOptions {
      jvmTarget = "1.8"
    }
  }

  tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinCompile).configureEach { task ->
    task.kotlinOptions {
      freeCompilerArgs += [
          '-progressive',
          '-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi',
          '-Xuse-experimental=kotlinx.coroutines.ObsoleteCoroutinesApi',
          '-Xuse-experimental=kotlin.time.ExperimentalTime',
      ]
    }
  }
}

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