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

kotlin {
    experimental {
        coroutines 'enable'
    }
}

androidExtensions {
    experimental = true
}

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "andreabresolin.kotlincoroutinesexamples"
        minSdkVersion 23
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        // Additional properties specific to the build
        buildConfigField "String", "WEATHER_API_ENDPOINT", "\"http://api.openweathermap.org/\""
        buildConfigField "String", "WEATHER_API_APP_ID", "\"f04391f2a7b156421675d08ac24dc908\""
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

ext {
    support_library_version = '27.1.1'
    constraint_layout_version = '1.1.0'
    espresso_version = '3.0.1'
    dagger_version = '2.14.1'
    retrofit_version = '2.3.0'
    okhttp_version = '3.9.1'
    kotlin_coroutines_version = '0.22.5'
    mockito_version = '2.18.3'
    truth_version = '0.39'
    architecture_lifecycle_compiler_version = '1.1.0'
    architecture_lifecycle_extensions_version = '1.1.1'
    architecture_core_testing_version = '1.1.0'
    glide_version = '4.6.1'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:appcompat-v7:$support_library_version"
    implementation "com.android.support.constraint:constraint-layout:$constraint_layout_version"
    androidTestImplementation("com.android.support.test.espresso:espresso-core:$espresso_version", {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    // RecyclerView
    implementation "com.android.support:recyclerview-v7:$support_library_version"

    // CardView
    implementation "com.android.support:cardview-v7:$support_library_version"

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

    // Retrofit
    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"

    // okhttp
    implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version"
    implementation "com.squareup.okhttp3:okhttp:$okhttp_version"

    // Kotlin coroutines
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"

    // Architecture Components: Lifecycle
    annotationProcessor "android.arch.lifecycle:compiler:$architecture_lifecycle_compiler_version"

    // Architecture Components: LiveData and ViewModel
    implementation "android.arch.lifecycle:extensions:$architecture_lifecycle_extensions_version"
    testImplementation "android.arch.core:core-testing:$architecture_core_testing_version"

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

    // Testing
    testImplementation 'junit:junit:4.12'
    testImplementation "org.mockito:mockito-core:$mockito_version"
    testImplementation "com.google.truth:truth:$truth_version"
}
