buildscript {
    ext {
        gson_version = "2.8.2"
        dagger_version = "2.15"
        rx_version = "2.1.8"
        glide_version = "4.7.1"
        rx_firebase_version = "1.1.3"
        support_version = "27.1.1"
        rx_android_version = "2.0.2"
        glide_version = "4.7.1"
        target_sdk_version = 27
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion target_sdk_version
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "frangsierra.kotlinfirechat"
        minSdkVersion 21
        targetSdkVersion target_sdk_version
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    packagingOptions {
        exclude 'META-INF/main.kotlin_module'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    compileOptions {
        sourceCompatibility "1.7"
        targetCompatibility "1.7"
    }

    lintOptions {
        abortOnError false
    }

    configurations.all {
        //This is library is included with two different versions
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //Kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

    //Support
    implementation "com.android.support:appcompat-v7:$support_version"
    implementation "com.android.support:design:$support_version"
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'

    //Firebase
    implementation "com.google.firebase:firebase-firestore:17.0.4"
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation "com.google.firebase:firebase-auth:16.0.2"
    implementation "com.google.firebase:firebase-core:16.0.1"
    implementation "com.google.android.gms:play-services-auth:15.0.1"
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
    implementation "com.firebase:firebase-jobdispatcher:0.8.5"

    //Mini
    implementation 'com.github.pabloogc:Mini:1.0.5'
    annotationProcessor 'com.github.pabloogc.Mini:mini-processor:1.0.5'

    //Glide
    implementation "com.github.bumptech.glide:glide:$glide_version"
    kapt "com.github.bumptech.glide:compiler:$glide_version"

    //Dagger
    implementation "com.google.dagger:dagger-android:$dagger_version"
    implementation "com.google.dagger:dagger-android-support:$dagger_version"
    kapt "com.google.dagger:dagger-compiler:$dagger_version"
    kapt "com.google.dagger:dagger-android-processor:$dagger_version"

    //Rx
    implementation "io.reactivex.rxjava2:rxjava:$rx_version"
    implementation "io.reactivex.rxjava2:rxandroid:$rx_android_version"
    implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.5@aar'

    //Test
    testImplementation 'junit:junit:4.12'
    testImplementation 'com.natpryce:hamkrest:1.4.2.0'
    testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
    testImplementation 'org.junit.platform:junit-platform-runner:1.0.1'
}

repositories {
    mavenCentral()
    maven { url "http://dl.bintray.com/jetbrains/spek" }
}

apply plugin: 'com.google.gms.google-services'