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

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion rootProject.ext.targetSdkVersion
        applicationId "koin.sampleapp"
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        // used by Room, to test migrations
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation":
                                     "$projectDir/schemas".toString()]
            }
        }
    }
    testOptions {
        execution 'ANDROID_TEST_ORCHESTRATOR'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
        test.java.srcDirs += 'src/test/kotlin'

        // used by Room, to test migrations
        androidTest.assets.srcDirs +=
                files("$projectDir/schemas".toString())
    }
}

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

    // Android Support
    implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
    implementation "com.android.support:design:$supportLibraryVersion"

    // Android Test
    testImplementation "junit:junit:$junit_version"
    testImplementation "org.mockito:mockito-core:$mockito_version"
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestUtil 'com.android.support.test:orchestrator:1.0.1'

    // Kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    // Anko
    implementation "org.jetbrains.anko:anko-commons:$anko_version"
    // Koin
    implementation "org.koin:koin-android:$koin_version"
    implementation "org.koin:koin-android-architecture:$koin_version"
    testImplementation "org.koin:koin-test:$koin_version"
    androidTestImplementation "org.koin:koin-test:$koin_version"

    // ViewModel and LiveData
    implementation "android.arch.lifecycle:extensions:$androidArchitectureVersion"
    annotationProcessor "android.arch.lifecycle:compiler:$androidArchitectureVersion"
    testImplementation "android.arch.core:core-testing:$androidArchitectureVersion"

    // Room
    implementation "android.arch.persistence.room:runtime:$roomVersion"
    implementation "android.arch.persistence.room:rxjava2:$roomVersion"
    kapt "android.arch.persistence.room:compiler:$roomVersion"
    annotationProcessor "android.arch.persistence.room:compiler:$roomVersion"
    testImplementation "android.arch.persistence.room:testing:$roomVersion"

    // Networking
    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version"
    implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
    implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version"

    // Rx
    implementation "io.reactivex.rxjava2:rxjava:$rxjava_version"
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'

    // Coroutines
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.5'
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:0.22.5"
    implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-experimental-adapter:1.0.0'

    // UI
    implementation 'com.joanzapata.iconify:android-iconify-weathericons:2.2.2'

    // Gson
    implementation 'com.google.code.gson:gson:2.8.2'
}

