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

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url 'https://jitpack.io' }
}

android {

    compileSdkVersion 28
    buildToolsVersion "28.0.3"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    lintOptions {
        disable 'MissingTranslation'
    }

    defaultConfig {
        applicationId "net.pokeranalytics.android"
        minSdkVersion 23
        targetSdkVersion 28
        versionCode 25
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            applicationVariants.all { variant ->
                variant.outputs.all { output ->
                    def date = new Date()
                    def formattedDate = date.format('yyMMdd_HHmm')
                    def appName = "PokerAnalytics"
                    def buildType = variant.variantData.variantConfiguration.buildType.name
                    def newName
                    if (buildType == 'debug'){
                        newName = "${appName}_${defaultConfig.versionName}(${defaultConfig.versionCode})_${formattedDate}_debug.apk"
                    } else {
                        newName = "${appName}_${defaultConfig.versionName}(${defaultConfig.versionCode})_${formattedDate}_release.apk"
                    }
                    outputFileName = newName
                }
            }
        }
    }

    configurations {
        all*.exclude group: 'com.google.guava', module: 'listenablefuture'
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    // Kotlin
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1'
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1"
    implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

    // Android
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.core:core-ktx:1.1.0-alpha05'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    implementation 'androidx.browser:browser:1.0.0'

    // Retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
    implementation 'com.google.code.gson:gson:2.8.5'

    // Places
    implementation 'com.google.android.libraries.places:places:1.1.0'

    // Firebase
    implementation 'com.google.firebase:firebase-core:16.0.8'

    // Crashlytics
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'

    // Logs
    implementation 'com.jakewharton.timber:timber:4.7.1'

    // MPAndroidChart
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'

    // Instrumented Tests
    androidTestImplementation 'androidx.test:core:1.1.0'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test:rules:1.1.1'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'

    // Test
    testImplementation 'junit:junit:4.12'

    // Optional -- Robolectric environment
    //testImplementation 'androidx.test:core:1.1.0'
    // Optional -- Mockito framework
    testImplementation 'com.android.support.test:runner:1.0.2'
    testImplementation 'com.android.support.test:rules:1.0.2'
    //testImplementation 'androidx.test.espresso:espresso-core:3.1.0'


}

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